Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Finding references not working until files are opened #169

Open
Ashreen121 opened this issue Aug 4, 2022 · 2 comments
Open

Finding references not working until files are opened #169

Ashreen121 opened this issue Aug 4, 2022 · 2 comments

Comments

@Ashreen121
Copy link

Ashreen121 commented Aug 4, 2022

I created my language server using Xtext on Eclipse IDE Enterprise 2022. Xtext can be installed from the Eclipse Marketplace. In particular, I followed this tutorial with a few additional steps to produce the language server: https://www.eclipse.org/Xtext/documentation/340_lsp_support.html

To produce the language server run ./gradlew assemble in the root project folder of the Xtext project. The JAR file is created in the ide project inside of the build\libs directory. You should see two JAR files, and the one we are interested in is the one with ls appended at end of file name.

In IntelliJ with this plugin enabled, I set up my server definition using a Raw command with the following options:
Extension: dmodel (this should be the file extension name of your new language)
Command: java -jar path/to/jar/file

The plugin works pretty well in terms of hover, completion etc, however I find some strange behavior with finding references/definitions. When I try to find an entity's definition(which is in another file) it reports it is unable to resolve an entity's reference/definition with a squiggly red underline. However, it does fix itself once the corresponding file with its definition is physically opened in the editor, therefore allowing me to find its definition by ctrl+click. I am not sure if this is related to the plugin itself or the language server. Anyone have insight into why this behavior occurs when using Xtext generated language servers? Screenshots of this behavior is below.

IDE-error

no-error

Hopefully this is enough information for anyone interested in playing around with Xtext Language servers, to try to recreate this problem. Do let me know if any further information will be useful.

@nixel2007
Copy link

Are you sure that the problem is in lsp plugin? Does your language server support finding references in closed files? Does it work in vscode for example?

@Ashreen121
Copy link
Author

Thanks for your reply @nixel2007.

I have tried using my language server with Sublime text 3 and it works perfectly, which is why I thought this the problem is related to the Intellij LSP plugin.

I have also updated my first comment, to include more details about the issue and steps to reproduce the buggy behavior.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants