OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.72k stars 168 forks source link

Unable to get Documentation to work #797

Closed Tainted-Fool closed 2 years ago

Tainted-Fool commented 2 years ago

Hello, I am currently learning C sharp and came across this plugin for vim. I have been tinkering with the configurations for a while now but cannot seem to figure out one thing and that is getting the documentation to work. Note: I am using Kali which is a Debian distro

My vimrc has the same configurations as the example on the README.md file and these are the steps that I used to install dotnet.

wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt update
sudo apt install -y apt-transport-https
sudo apt-get install -y dotnet-sdk-6.0
sudo apt-get install -y dotnet-sdk-5.0
sudo apt-get install -y dotnet-sdk-3.1

sudo apt install apt-transport-https dirmngr gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/debian stable-buster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-complete

Dotnet install reference Mono install reference

Finally, I copy the vimrc configs and get prompted to install the omnisharp-roslyn server which I do. Everything seems to be working except the documentation and I really would like to have it since it would help in learning.

image image image

Any help would be greatly appreciated! Thank you

nickspoons commented 2 years ago

Is this a dotnet project? If so, you don't need mono, try using the net6 version of the server. See my comment here for instructions on how to change server.

If you're still having problems, check the server log for issues, :OmniSharpOpenLog

Tainted-Fool commented 2 years ago

Thanks for the quick update!

So I went ahead and uninstalled mono-complete with sudo apt remove --purge mono-complete and added let g:OmniSharp_server_use_net6 = 1 to the bottom of the vimrc configuration file. However, the issue is still there. Nothing shows up.

Here is what I get when I go back to the csharp file: image

I used the command :OmniSharpOpenLog with the newly added line and got this: image image

Commenting out the use_net6 line and reverting to the previous server is not working. I get no syntax highlight or anything now. image

Running :OmniSharpOpenLog shows this now.: image

Maybe running that mono uninstall command broke it? because that is the only changed I've made

nickspoons commented 2 years ago

I can't tell from your comment if you re-installed the server with :OmniSharpInstall after changing the use_net6 setting, but I suspect you did because the server isn't working after remove that line again. Any time you change that line in your config, you need to re-install the server, because there are different binaries that get downloaded and omnisharp-vim starts them in different ways.

nickspoons commented 2 years ago

But without use_net6 = 1 you do need mono installed. You shouldn't need it installed when running the net6 version.

Tainted-Fool commented 2 years ago

Yeah I was prompted to reinstall the server when I made the change. After making the change the documentation is still not showing up. It's completely blank. This is with setting use_net6 = 1 and re-installing the server again.

image

Running :OmniSharpFixUsings added using Internal to the file but the documentation is still not popping up. image

nickspoons commented 2 years ago

Right. Look as far as OmniSharp-vim is concerned, this is working correctly. The server (OmniSharp-roslyn) is currently not giving you documentation and I'm not exactly sure why, there have been lots of issues like this in the past and they never have the same solution :sweat_smile:

Have you built your project? You may need to do that at least once before you get full server support.

nickspoons commented 2 years ago

That using Internal fix is a bit suspicious. Is that a library you've added a reference to yourself? Can you share your .csproj file?

nickspoons commented 2 years ago

Wait what?

image

Your .cs file is under ~ but the server somehow thinks it should use the example.csproj from this repo? That's peculiar, I think you've got a bit of a strange file structure there

nickspoons commented 2 years ago

Please try the following:

$ mkdir -p ~/cs/helloworld
$ cd !$
$ dotnet new console
$ vim Program.cs

See if you have better luck in a dedicated directory containing a .csproj file.

Note: with dotnet6 dotnet new console will create a very minimal Project.cs file, using default usings and namespace etc. so it doesn't look exactly like your current example. You can just copy your example file in if you want.

Tainted-Fool commented 2 years ago

Yup that was it! It was the file structure. Big thank you for your assistance 😄 image

nickspoons commented 2 years ago

Nice one, happy to help