You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to integrate the Golang LSP (gopls) with eclipse using LSP4E and encountered a problem with hyperlinks. It looks like the current implementation of OpenDeclarationHyperlinkDetector.detectHyperlinks() makes requests for Definitions, Declarations, TypeDefinitions, and Implementations and then merges the results into a single list. Unfortunately, if any of these calls returns an error, the whole call to detectHyperlinks() fails. In the case of gopls, I'm seeing cases when trying to drill down on a function call (named Execute) where Definition and Declaration return good results, but TypeDefinition returns the error "no type definition for Execute" instead of an empty list and Implementations returns the error "Execute is a function, not a method" instead of an empty list.
Looking at this, I think a more appropriate implementation of the merge of the 4 lists of hyperlinks would be to ignore any errors and take only from the successful calls, thus keeping failures from poisoning the overall result.
I'm using version 0.18.12.202408150719 with Eclipse 2024-12 (4.34) and testing with gopls "golang.org/x/tools/gopls v0.17.1"
A simple "hello world" go program that exhibits the problem is
As a workaround in my integration, I was able to disable typeDefinition and implementation calls by intercepting the Initialization call to the LSP and overriding the ServerCapabilities that were returned, disabling TypeDefinitionProvider and ImplementationProvider. This allowed my hyperlinks to start working, but at the expense of disabling functionality that I may eventually want elsewhere.
I'm swamped with other stuff, so I don't know when I'll get to the point of working on an actual PR. I'll take a look, but please don't wait on me if you see an easy fix.
will-lauer
added a commit
to will-lauer/lsp4e
that referenced
this issue
Jan 7, 2025
Adding LanguageServers.addAllSuccessful as an alternative to
LanguageServers.addAll so that exceptions from one of the requests being
combined can be ignored. Then using this new method in
OpenDeclarationHyperlinkDetector when combining the results from
definitions, declarations, typeDefinitions, and implementions because
some LSPs return errors instead of empty lists for some of these calls.
Instead, we combine only the successful results when building the list
of hyperlinks, ignoring the errors.
This should resolveeclipse-lsp4e#1169
I'm attempting to integrate the Golang LSP (gopls) with eclipse using LSP4E and encountered a problem with hyperlinks. It looks like the current implementation of
OpenDeclarationHyperlinkDetector.detectHyperlinks()
makes requests for Definitions, Declarations, TypeDefinitions, and Implementations and then merges the results into a single list. Unfortunately, if any of these calls returns an error, the whole call todetectHyperlinks()
fails. In the case of gopls, I'm seeing cases when trying to drill down on a function call (named Execute) where Definition and Declaration return good results, but TypeDefinition returns the error "no type definition for Execute" instead of an empty list and Implementations returns the error "Execute is a function, not a method" instead of an empty list.Looking at this, I think a more appropriate implementation of the merge of the 4 lists of hyperlinks would be to ignore any errors and take only from the successful calls, thus keeping failures from poisoning the overall result.
I'm using version 0.18.12.202408150719 with Eclipse 2024-12 (4.34) and testing with gopls "golang.org/x/tools/gopls v0.17.1"
A simple "hello world" go program that exhibits the problem is
when drilling down on
Execute
in the main function.The text was updated successfully, but these errors were encountered: