Skip to content

Missing method parameter completion #30

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

Open
GroundCombo opened this issue Apr 8, 2022 · 8 comments
Open

Missing method parameter completion #30

GroundCombo opened this issue Apr 8, 2022 · 8 comments

Comments

@GroundCombo
Copy link

Apologies if this doesn't belong to csharp-ls, but I have no idea where to start looking and would appreciate any hints.

I'm trying to get Unity projects to work with Emacs and LSP, and I've gotten to a point where csharp-ls is starting, clearly understands the project and offers type information and references. However, I'm only getting completions for method names. So, instead of tabbable variable placeholders such as (typing "foo.")

foo.MyMethod(int bar)

it only offers

foo.MyMethod

The full method signature is shown in the echo area when I move over it, so the issue seems to be on the completion side.

The good old obsolete omnisharp-mode has been working perfectly in the same project. I'm testing this with Emacs 28.1, csharp-ls 0.4.3 and the latest lsp-mode from MELPA. lsp-mode is using the default :capf as the completion provider.

@razzmatazz
Copy link
Owner

Hi @GroundCombo !

I suspect you are Missing lsp textDocument/signatureHelp implementation which is missing on csharp-ls now.

I am working on this when I get spare time and this is the next thing on my queue

@GroundCombo
Copy link
Author

Oh, that's good to know and explains a lot. I also tried omnisharp with lsp and it seems to offer the signatureHelp capability, but . is not in the trigger characters and the other triggers result in errors... so I'll just use omnisharp-mode for now. Thanks!

@razzmatazz
Copy link
Owner

razzmatazz commented Apr 23, 2022

I have released https://www.nuget.org/packages/csharp-ls/0.5.0 which has textDocument/signatureHelp implementation now

please check if this works for you -- not 100% this is how it should work, but it apparently works ok for me on emacs

FYI @vytautassurvila

@GroundCombo
Copy link
Author

I'm seeing the signatureHelp capability now in lsp logs, but it doesn't quite seem to do the trick. Just to make sure we're on the same page, here's what I am expecting (omnisharp-mode):

Screenshot 2022-04-24 at 16 16 00

And this is what lsp-mode shows.
Screenshot 2022-04-24 at 16 02 29

signatureHelp is not being called in the above situation, only textDocument/completion. If I press < or ( after the method name, signatureHelp is called but did not show anything new.

I've attached some logs from the initialization and typing ".Add"; please let me know if you would like some additional information.

lsp-log-init.txt
lsp-messages.txt
lsp-completion.txt

@razzmatazz
Copy link
Owner

Ok, I think now I understand your problem. Not sure if this can be fixed with lsp though, in order to behave like omnisharp-emacs..

Signature help appears when you open parens after fn name and is triggered by "(" and "," chars. So this is probably too late as you want to see arg list already on the autocomplete Dropdown.

I will check if I can make the full fn signature available on autocomplete list and if it is readable.

But the part with "tabbing" between args is probably responsibility of lsp-mode and I'm not sure it provides that atm.

@GroundCombo
Copy link
Author

I'm not familiar with lsp-mode's internals, but I believe it supports yasnippet for parameter placeholders, so it shouuuld work if the server provides the placeholder information.

@razzmatazz
Copy link
Owner

I was looking into how omnisharp-roslyn does this and it is somewhat complicated, it seems roslyn does not provide proper apis to do this easily (or did not provide it at the time omnisharp-roslyn completion service was written).. so I will keep this on my mind for a while until i figure what is the easiest way to provide this info..

currently i am thinking about doing a simple hack there and if the completion is requested after a '.' symbol then i can do a lookup for object type that goes before the dot and query actual method params for this -- but this will require me coding something that is supposedly already in roslyn, will be bug-prone and i am not particularly wiling to go that route yet..

@razzmatazz
Copy link
Owner

razzmatazz commented Sep 7, 2022

I think I might be able to do something about this after all, after browsing omnisharp-roslyn and roslyn codebase.. things are a bit complicated, but this should be implementable once I understand the APIs

I started my work in #47

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

No branches or pull requests

2 participants