TabNine icon indicating copy to clipboard operation
TabNine copied to clipboard

Semantic completion for C#

Open dannyalan opened this issue 5 years ago • 18 comments

Hey, it'd be awesome if you supported C# semantically.

Hopefully this can be done?

dannyalan avatar Apr 05 '19 14:04 dannyalan

Can you recommend an LSP server for C#?

zxqfl avatar May 13 '19 22:05 zxqfl

I can't I'm afraid, but I'd be grateful if you replied to some of the issues we've tagged you in. These are more pressing

dannyalan avatar May 14 '19 04:05 dannyalan

Here's one https://github.com/OmniSharp/csharp-language-server-protocol

antonioyon avatar May 14 '19 14:05 antonioyon

Any updates on this? :)

John0x avatar Mar 10 '20 13:03 John0x

I tried to make C# semantic completion to work by using @OmniSharp csharp-language-server-protocol LSP server, but could not do it since I'm not too familiar of how these things should work. I expected that after building that project (which I succeeded) I would have an executable server, which I just need to configure appropriately, but didn't find that executable.

Anyone else ideas how to make it work with TabNine?

jarmo avatar Apr 16 '20 15:04 jarmo

I tried to make C# semantic completion to work by using @OmniSharp csharp-language-server-protocol LSP server, but could not do it since I'm not too familiar of how these things should work. I expected that after building that project (which I succeeded) I would have an executable server, which I just need to configure appropriately, but didn't find that executable.

Anyone else ideas how to make it work with TabNine?

Did you tried the Omnisharp Roslyn LSP from here >> https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Stdio.Driver/Program.cs

I suppose adding this to >> https://github.com/codota/TabNine/blob/master/TabNine.toml would suffice, can you please give it a shot and let us know if it works.

jezus-nunez avatar Apr 18 '20 10:04 jezus-nunez

Good tip! I managed to compile https://github.com/OmniSharp/omnisharp-roslyn however when configuring it in TabNine.toml like this (for Vim):

[language.cs]
command = "C:\\bin\\win7-x64\\OmniSharp.exe"

I just see "The language server exited unexpectedly" in TabNine code completion window in Vim. Is there anywhere I could see any log files of TabNine?

jarmo avatar Apr 18 '20 18:04 jarmo

I also tried -lsp switch (-lsp | --languageserver Use Language Server Protocol.), like this:

[language.cs]
command = "c:\\bin\\win7-x64\\OmniSharp.exe"
args = ["-lsp"]

No difference.

jarmo avatar Apr 18 '20 19:04 jarmo

I think it should be asked in omnisharp repository.

Shougo avatar Apr 19 '20 01:04 Shougo

What part? If I execute OmniSharp.exe myself then it seems to work as expected so it seems to be more like a TabNine or its configuration problem. That's why I asked if I could see any logs created by TabNine.

jarmo avatar Apr 19 '20 10:04 jarmo

It is Tabnine related problem? I think Omnisharp behavior is different from other LSP commands.

Shougo avatar Apr 19 '20 10:04 Shougo

Please test Omnisharp -lsp manually without Tabnine.

Shougo avatar Apr 19 '20 10:04 Shougo

Do you have any suggestions as to how could I test it manually? By just running it, it does not show any output and keeps running (does not crash) - I expect it does wait for some input to give me some output. Can I pipe something into it to test if it works as expected?

I'm sorry, but I don't know too much about inner workings of LSP-s and have previously only setup some to run with TabNine (basically just configuring TabNine.toml).

jarmo avatar Apr 19 '20 11:04 jarmo

So I should ask it on Omnisharp repository. Omnisharp LSP behavior is not same with others.

Shougo avatar Apr 19 '20 23:04 Shougo

@Shougo do you know that this is the case or do you suspect that this is the case?

jarmo avatar Apr 20 '20 11:04 jarmo

Tabnine use stdin and stdout to communicate. I think Omnisharp doesn't use the interface.

Shougo avatar Apr 20 '20 12:04 Shougo

Looking at the code at https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Stdio.Driver/Program.cs and reading the name OmniSharp.Stdio.Driver imply that it should work over stdin/stdout.

jarmo avatar Apr 20 '20 12:04 jarmo

[language.cs]
command = "C:\\bin\\win7-x64\\OmniSharp.exe"

Use scoop to install omnisharp under windows system, and then configure TabNine.toml as follows(for emacs):

[language.csharp]
command = "omnisharp"

It work! image

LambdaRan avatar Sep 02 '21 02:09 LambdaRan

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 03 '22 11:10 stale[bot]