Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with auto complete #306

Closed
triplem161 opened this issue May 11, 2017 · 20 comments
Closed

Issue with auto complete #306

triplem161 opened this issue May 11, 2017 · 20 comments

Comments

@triplem161
Copy link

Hi,

I've been using omnisharp emacs for the past 2 year for Unity dev mainly.

After the update of both the emacs package and the omnisharp server I got an issue with the autocomplete with company. It seems nothing is returned from the server.

This happens on both my windows and my mac. I'm using the netcoreapp1.1. This are the messages I get when I start the server

omnisharp: using the server at: C:\Programming\Omnisharp\omnisharp-roslyn\artifacts\publish\OmniSharp\default\netcoreapp1.1\OmniSharp.exe
omnisharp: OmniSharp.Startup, Omnisharp server running using Stdio at location ’e:/Programming Project/Unity/Project 1 (Planet 2D)/Code/’ on host -1.
omnisharp: OmniSharp.Startup, Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
omnisharp: OmniSharp.Startup, Configuration finished.

As well as setting company for omnisharp

(add-to-list 'company-backends 'company-omnisharp)

Am i doing something wrong ?

Thanks

@mpavlinsky
Copy link

mpavlinsky commented May 22, 2017

I'm seeing the same issue after installing omnisharp from brew using the suggested brew install omnisharp/omnisharp-roslyn/omnisharp-mono and adding csharp layer, (setq omnisharp-server-executable-path "/usr/local/bin/omnisharp"), and (setq-default omnisharp--curl-executable-path "/usr/bin/curl")

Messages output:

omnisharp: Starting OmniSharpServer using project folder/solution file: [solution file]
omnisharp: using the server at: /usr/local/bin/omnisharp
omnisharp: OmniSharp.Startup, Omnisharp server running using Stdio at location [solution directory] on host -1.
omnisharp: OmniSharp.Startup, Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
omnisharp: OmniSharp.Startup, Configuration finished.

OSX: 10.12.3
Spacemacs: v0.200.9

I can look into it a bit more later and hopefully add some more information.

@razzmatazz
Copy link
Contributor

@triplem161 – sorry for writing to you this late, but have you tried using the omnisharp-mono version?

the netcoreapp version is not good at handling .csproj & .sln based projects and IIRC omnisharp server is about to deprecate it

@razzmatazz
Copy link
Contributor

@mpavlinsky – do you use http transport for the omnisharp roslyn server? otherwise you don't need to set omnisharp--curl-executable-path

hmm, on the other hand does anything other than completion work?

say what if you do using System._ where _ is the position of the cursor; do you get any completion output? does invoking M-x helm-imenu show classes/methods of the class on the current file?

@triplem161
Copy link
Author

@razzmatazz no problem.

Some how it kind of works on my work station(mac OS) but not on my personnal mac. I'll try to figure it out.

But it only work partially (on my work station), i get the imenu items as well as the autocomplete for using System; but when i try to create private GameObject _go; Gameobject does not trigger any completion.

And when I try _go._ the autocomplete list appears but when i start typing the function i need the autocomplete list disappear. When I try to use the omnisharp-auto-complete method it returns "no completion".

So I don't know if its a roslyn server issue, a company issue or an issue from the last update

Nevertheless on my windows when I'm trying to use the mono version, emacs instantly crash. (Knowing that i build from the dev branch of the omnisharp roslyn repo)

Thanks for the hard work :)

@triplem161
Copy link
Author

Quick update: Fixed my personnal mac, now i get flymake check and some autocomplete correct.

But still have issues with the autocomplete when trying to invoke instances method and variable type.

(Concerning windows, i'm in the middle of moving in a new place so i can't test yet)

Thanks

@razzmatazz
Copy link
Contributor

we found out the cause for windows crashes, see #315 -- basically you should use 32bit (x86) binaries of omnisharp on windows for now, until emacs bug is fixes (which I have reported)

there is now M-x omnisharp-install-server command that should attempt to install server binary automatically on macOS and Linux; not yet on Windows, but shouldn't be too much work.

@triplem161 there was also one PR made on autocomplete that was merged, maybe it could be related to your problem? see #320

@triplem161
Copy link
Author

triplem161 commented Jul 11, 2017

Hey, thanks a lot @razzmatazz

For some reason, it doesn't work with company on my side, as when I type a second letter, the company popus disappear ? I guess I'm doing something silly, any hint ?

But when I try the omnisharp-add-dot-and-auto-complete it uses popup, and i get the expected behaviour.

All of this on Windows (haven't try on mac yet)

Thanks for the hard work

@razzmatazz
Copy link
Contributor

@triplem161 autocomplete is case-sensitive, maybe that is the cause for disappearance of the popup? i think we should make it case-insensitive, imho..

@triplem161
Copy link
Author

@razzmatazz by case-sensitive you mean using a capital letter during completion. It seems that it's just not working with company-mode, probably a bad setting on my side.

I'll investigate, and that will give me the opportunity to learn elisp :).

@razzmatazz
Copy link
Contributor

@triplem161 could you try the new M-x omnisharp-install-server command which is available for windows too with the latest distro from MELPA? (you should comment out (setq omnisharp-server-executable-path) when using omnisharp-install-server). This should aleviate the need to muck with the server binaries manually

@razzmatazz
Copy link
Contributor

razzmatazz commented Jul 17, 2017

@triplem161 also do you have (company-mode) enabled on the buffer? (via mode hook or manually)

if you don't have csharp-mode-hook setup then you need to:

  • invoke M-x company-mode to enable company mode on the buffer
  • type object._ where underscore is position of the cursor and then invoke M-x company-complete — this should trigger completion via company manually

I think we need a better configuration example in https://github.com/OmniSharp/omnisharp-emacs#installation-on-regular-emacs...

@triplem161
Copy link
Author

triplem161 commented Jul 17, 2017

Hey @razzmatazz,

I tried the install server on windows, its working properly. So can i invoke this command to update to a new build when available ?

Concerning the autocomplete i still have the same issue. I have set my hook properly, and company mode is correctly loaded when i open a cs file. But still the same issue.

gameObject._ (the autocomplete displays the full list of candidate)
gameObject.G_ (doesn't pop anything, it deletes the popup list and calling M-x company-complete , M-x company-omnisharp or M-x omnisharp-auto-complete returns no completions)

I rolled back to the legacy version to try and it seems to work normally.

Edit : i check the value of omnisharp--auto-complete-display-backend and it returns popup
and for omnisharp--auto-complete-display-backends-alist it returns:

((popup . omnisharp--auto-complete-display-function-popup)
 (ido . omnisharp--auto-complete-display-function-ido))

@razzmatazz
Copy link
Contributor

@triplem161 sorry for replying this late..

  • yes, omnisharp.el has a version of omnisharp server version set as a customizable and this version will be updated semi-periodically so you don't have to worry about updating the server manually. -- omnisharp-emacs will ask you to install the server (new version of it) again after package update automatically

  • do you really have member starting with G in the class of gameObject ? I think company/omnisharp autocomplete mechanism is case-sensitive, so this might be your issue but I am not sure.. would you be able to provide a tiny test-case project?

@razzmatazz
Copy link
Contributor

razzmatazz commented Aug 13, 2017

I have also fixed the autocomplete case-sensitivity problem in #351, maybe that helps you?

@triplem161
Copy link
Author

@razzmatazz No problem,

I still have the issue. But I somehow start to see a weird pattern. The autocompletion works out of the class scope somehow.

When I'm typing the keyword "pu" out of class scope, I got the autocompletion correctly for public.
But when type in class scope the completion doesn't work.

The thing that worries me is that I feel I'm the only one having this issue, which make me think it's from my config (on which I spent days trying to fix)

I can set up a quick test case project for you, but it would require Unity on your side.

@razzmatazz
Copy link
Contributor

razzmatazz commented Aug 15, 2017 via email

@triplem161
Copy link
Author

I just tried visual code and it seems to work properly there. (in and out of class scope).

Now, that i'm thinking I was more thinking that the issue may come from company-mode.
As when i call omnisharp-add-dot-and-complete, i got a different popup, and got the expected behaviour (it works as the legacy version).

I'm sorry I can't give you more hint as my elisp knowledge is inexistant. But I kind of skimmed thru the code, and i'm not sure when is company mode is called.

But I believe if other user had issues they would have reported it as well (I don't think i'm the only one), so I'm more concern about a bad config on my side.

@triplem161
Copy link
Author

Hey, coming back to you, been busy the past few months.

I spend the last hour, trying to fix my issue. I removed everything, had a clean emacs and install only omnisharp and company-mode. And it worked as intended !

Now when i roll back to my full config, the issue reappeared, I'm now deleting one by one each package to find the culprit. But without much success yet.

Do you have any knowledge of package that could clash between each other ? For instance I have auto-complete and company-mode.

But i'm getting there (hopefully by the end of the day :D )

@triplem161
Copy link
Author

triplem161 commented Oct 14, 2017

I found the issue. I'm not sure if it's from company-mode or something related to omnisharp-mode, or just me that did something stupid.

Here is the code that is faulty in my config :

(use-package whitespace
  :diminish whitespace-mode
  :init ()
  (add-hook 'prog-mode-hook 'whitespace-mode)
  :config
  (setq whitespace-style '(tabs tab-mark trailing))
  (setq
   whitespace-display-mappings
   '(
     (tab-mark 9 [8728 9] [92 9])
     ))
  )

I'll investigate on my side

Edit : it seems to be a company issue, I'm closing this issue then

Thanks for you time, sadly spent on a config issue on my side...

@Dustoe
Copy link

Dustoe commented Dec 21, 2018

Could you send me your config since I'm having the same problem right now and I don't have a lot of experience with emacs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants