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

Don't install with Vim's 8.1.320 built-in package support #494

Closed
Braytiner opened this issue Aug 3, 2019 · 16 comments · Fixed by #501
Closed

Don't install with Vim's 8.1.320 built-in package support #494

Braytiner opened this issue Aug 3, 2019 · 16 comments · Fixed by #501

Comments

@Braytiner
Copy link

Hi! I'm trying to install OmniSharp in Vim 8.1.320 with built-in package support, but its doesn't work.

Other plugins like Nerdtree, airline, devicons works fine.

My plugins folder is: /home/braytiner/.vim/pack/plugins/start

I cloned OmniSharp into this folder, but nothing happened when I opened .cs file.

I have this line in my .vimrc file;

let g:OmniSharp_server_stdio = 1

Does OmniSharp have built-in package support?

Thanks!

@nickspoons
Copy link
Member

Yes it should work fine in that location.

Can you see any omnisharp-vim scripts in the output of :scriptnames?

@Braytiner
Copy link
Author

Yes:

42: ~/.vim/pack/plugins/start/omnisharp-vim/plugin/OmniSharp.vim
43: ~/.vim/pack/plugins/start/omnisharp-vim/ftdetect/csx.vim

@nickspoons
Copy link
Member

nickspoons commented Aug 4, 2019

Ok well that's as it should be, OmniSharp-vim is loading fine. You need to open a .cs file before the server is started, and the commands become available. If you run :scriptnames again after opening a .cs file, you should see more OmniSharp-vim scripts in the list.

What are you trying, that isn't working?

@mvrozanti
Copy link

I am having this problem as well, even though I have the same output from :scriptnames.

For instance, when editing this file and calling :OmniSharpFixUsings, it eliminates required imports, such as Microsoft.AspNetCore.Mvc, along with all of the other project's namespace imports such as the needed for the manipulation of the Usuario class.

There are other problems such as not completing a domain-specific interface's methods.

Here are my csproj and sln files. Maybe this is a version compatibility problem?

@nickspoons
Copy link
Member

@mvrozanti that doesn't sound like the same problem at all. OP says that nothing is working for him - for you there is clearly server interaction, commands have been defined and they call the server and act on the response.

It sounds more like you have some server issues, possibly to do with dotnet/msbuild incompatibilities. It's impossible to guess without any information about your system.

Could you please open a new issue and include an OmniSharp-roslyn log?

Add this to your config:

let g:OmniSharp_loglevel = 'debug'

Then, after opening vim to a .cs file and waiting for the server to start and trying some commands, open the log with

:OmniSharpOpenLog

And please share your OmniSharp-vim configuration, plus OS etc.

@marcusrugger
Copy link
Contributor

The problem

I am having the same problem as described by the original poster. I have tried using the plugin through both Pathogen and through Vim 8.x package support and I get the same result either way: it doesn't do anything.

Perhaps I am doing something wrong, but if I am, I do not know what it is.

Expected

As I understand the README, after I have the plugin installed, when I open a .cs file, it is suppose to ask to download the server. It does not.

The README also says that I can manually install the server with :OmniSharpInstall, but Vim does not recognize the command, nor does it recognize any other :Omni* command that I'm aware of.

Configuration

I have the plugin installed (cloned) at:

~/.vim/pack/plugins/start/omnisharp-vim

In my .vimrc I have:

let g:OmniSharp_server_use_mono = 1
let g:OmniSharp_server_stdio = 1

Versions:

App/OS Version
Ubuntu 18.04.3 LTS
Vim 8.1.1888
Mono 6.0.0.319
MSBuild 16.0.0.0
Dotnet 2.2.401

Scriptnames:

  1: ~/.vimrc
  2: /usr/local/share/vim/vim81/syntax/syntax.vim
  3: /usr/local/share/vim/vim81/syntax/synload.vim
  4: /usr/local/share/vim/vim81/syntax/syncolor.vim
  5: /usr/local/share/vim/vim81/filetype.vim
  6: /usr/local/share/vim/vim81/plugin/getscriptPlugin.vim
  7: /usr/local/share/vim/vim81/plugin/gzip.vim
  8: /usr/local/share/vim/vim81/plugin/logiPat.vim
  9: /usr/local/share/vim/vim81/plugin/manpager.vim
 10: /usr/local/share/vim/vim81/plugin/matchparen.vim
 11: /usr/local/share/vim/vim81/plugin/netrwPlugin.vim
 12: /usr/local/share/vim/vim81/plugin/rrhelper.vim
 13: /usr/local/share/vim/vim81/plugin/spellfile.vim
 14: /usr/local/share/vim/vim81/plugin/tarPlugin.vim
 15: /usr/local/share/vim/vim81/plugin/tohtml.vim
 16: /usr/local/share/vim/vim81/plugin/vimballPlugin.vim
 17: /usr/local/share/vim/vim81/plugin/zipPlugin.vim
 18: ~/.vim/pack/plugins/start/omnisharp-vim/plugin/OmniSharp.vim
 19: ~/.vim/pack/plugins/start/omnisharp-vim/ftdetect/csx.vim

Scriptnames after opening a .cs file:

  1: ~/.vimrc
  2: /usr/local/share/vim/vim81/syntax/syntax.vim
  3: /usr/local/share/vim/vim81/syntax/synload.vim
  4: /usr/local/share/vim/vim81/syntax/syncolor.vim
  5: /usr/local/share/vim/vim81/filetype.vim
  6: /usr/local/share/vim/vim81/plugin/getscriptPlugin.vim
  7: /usr/local/share/vim/vim81/plugin/gzip.vim
  8: /usr/local/share/vim/vim81/plugin/logiPat.vim
  9: /usr/local/share/vim/vim81/plugin/manpager.vim
 10: /usr/local/share/vim/vim81/plugin/matchparen.vim
 11: /usr/local/share/vim/vim81/plugin/netrwPlugin.vim
 12: /usr/local/share/vim/vim81/plugin/rrhelper.vim
 13: /usr/local/share/vim/vim81/plugin/spellfile.vim
 14: /usr/local/share/vim/vim81/plugin/tarPlugin.vim
 15: /usr/local/share/vim/vim81/plugin/tohtml.vim
 16: /usr/local/share/vim/vim81/plugin/vimballPlugin.vim
 17: /usr/local/share/vim/vim81/plugin/zipPlugin.vim
 18: ~/.vim/pack/plugins/start/omnisharp-vim/plugin/OmniSharp.vim
 19: ~/.vim/pack/plugins/start/omnisharp-vim/ftdetect/csx.vim
 20: /usr/local/share/vim/vim81/syntax/cs.vim
 21: /usr/local/share/vim/vim81/syntax/xml.vim
 22: /usr/local/share/vim/vim81/syntax/dtd.vim

Manual Installation

I have also tried to manually install the Roslyn server by building it from source, but unfortunately I am blocked on that front because of this problem. I only bring this up for completeness, as I'm not sure if I even got the server installed that it would work because Vim doesn't seem to be properly loading the plugin, as far as I can tell.

As such, I'm not really sure how to proceed. I'd be happy to provide any additional information that might be helpful.

@nickspoons
Copy link
Member

nickspoons commented Aug 19, 2019

Ok that is strange - you don't have the .../ftplugin/cs/OmniSharp.vim file in your :scriptnames output after loading a .cs file.

Just for a lark, could you try moving/renaming the file like this:

mv  ~/.vim/pack/plugins/start/omnisharp-vim/ftplugin/cs/OmniSharp.vim  ~/.vim/pack/plugins/start/omnisharp-vim/ftplugin/cs.vim

@marcusrugger
Copy link
Contributor

It doesn't seem to make any difference.

Following your suggestion, I copied it up one level into the ftplugin folder:

~/.vim/pack/plugins/start/omnisharp-vim/ftplugin
marcus@MarcusLinux: dir -R
.:
total 12
drwxrwxr-x 2 marcus marcus 4096 Aug 19 20:15 cs
-rw-rw-r-- 1 marcus marcus 6985 Aug 19 20:16 cs.vim

./cs:
total 8
-rw-rw-r-- 1 marcus marcus 6985 Aug 19 17:44 OmniSharp.vim

I also tried deleting the OmniSharp.vim and cs folder, and that didn't work either (as in, scriptnames shows the same scripts).

Is there any way to increase the verbosity of Vim so we can see if it's just a parsing error somewhere?

@marcusrugger
Copy link
Contributor

Just for giggles, I tried putting a syntax error in the ftdetect/csx.vim file to see what Vim would do, and as expected, Vim complained about the error.

I then tried putting a syntax error in the ftplugin/cs/OmniSharp.vim file, and after loading a .cs file, Vim registered no complaint. I did this too with the ftplugin/cs.vim file we just created and got the same result. Suggesting that neither of these two scripts are being loaded.

@nickspoons
Copy link
Member

@marcusrugger could you please share your entire .vimrc?

You do have filetype indent plugin on in there?

@marcusrugger
Copy link
Contributor

Holding head down in shame, "Umm, no."

@marcusrugger
Copy link
Contributor

OK, that seems to have fixed. My apologies. I had no idea that was required.

@nickspoons
Copy link
Member

nickspoons commented Aug 19, 2019

OK great, yeah that's going to be necessary for any plugin with filetype-specific sections - as well as for your own config.

The line is in the example .vimrc but hasn't been made more specific - plugin managers like vim-plug do this for you. I suspect this is also OP's problem.

@marcusrugger
Copy link
Contributor

I just did a pull request which adds a comment to the README. If you would like to see something different, or more thorough, let me know and I'll be glad to do it.

@nickspoons
Copy link
Member

@marcusrugger I was just doing it too 😄 I'll have a look, thanks.

@nickspoons
Copy link
Member

@marcusrugger thanks, and I've updated the installation instructions to include native packages, and included a note about filetype indent plugin on there too.

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

Successfully merging a pull request may close this issue.

4 participants