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

csharp-ls seems to conflate definition with implementation? #4

Closed
josteink opened this issue Nov 9, 2021 · 4 comments
Closed

csharp-ls seems to conflate definition with implementation? #4

josteink opened this issue Nov 9, 2021 · 4 comments

Comments

@josteink
Copy link

josteink commented Nov 9, 2021

Not sure if this is the fault of csharp-ls or not, but it seems like a good place to start 😄

Consider the following c# code:

interface IDemo
{
    void Foo();
}

class Demo : IDemo
{
    void Foo()
    {
        Console.WriteLine("Bar");
    }
}

When positioning the cursor at IDemo (line 6) and selecting (in Emacs) lsp-find-definition I'm taken to line 1, where the interface is defined. This makes sense.

However when I use lsp-find-implementation at IDemo (line 1), I expect to be given the implementations of that interface (line 6). Instead the behaviour seems to be just like lsp-find-definition, and I remain at line 1.

Are these two functions implemented the same way inside csharp-ls? Or is this a lsp-mode issue? Or have I simply misunderstood something about what the current C# LSP providers are capable of?

@josteink
Copy link
Author

josteink commented Nov 9, 2021

Looking at the code that does indeed seem to be the case:

|> Map.add "textDocument/definition" (handleTextDocumentDefinitionOrImpl |> requestHandlingWithStateChange)
|> Map.add "textDocument/implementation" (handleTextDocumentDefinitionOrImpl |> requestHandlingWithStateChange)

@razzmatazz
Copy link
Owner

Yeah, that was a cheap shot on my part to get something working but I didn’t get that much into semantic differences to realize it’s a bad idea :)

@josteink
Copy link
Author

Fair enough. But IMO it's probably better/more correct to not advertise the "find implementation" capability until that is sorted out.

What do you think?

@razzmatazz
Copy link
Owner

oh definitely

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