Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Namespace import no longer works since XText 2.21.0
Namespace import no longer works since XText 2.21.0 [message #1844442] Tue, 14 September 2021 08:00 Go to next message
Evertson Croes is currently offline Evertson CroesFriend
Messages: 5
Registered: September 2021
Junior Member
Situation:

I have created a language server that uses 4 Xtext projects, each with their own grammar.

When I build the language server using Xtext 2.21.0 and I use the IntelliJ LSP plugin to run the language server, everything works as expected. I can open a file and if I use the correct namespace import I can click on references from other files and the files are opened.

However since XText 2.21.0 this no longer works. The references are only resolved when I have the files containing the definitions being referenced to open in IntelliJ. This defeats the purpose of the "go to definition" functionality in a language server.

Does anyone have any idea why this might be the case?
Re: Namespace import no longer works since XText 2.21.0 [message #1844449 is a reply to message #1844442] Tue, 14 September 2021 11:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
did you make sure the lsp versions you use with xtext and the ones in your intellij plugins match.
besides that you could remote debug for exceptions


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Namespace import no longer works since XText 2.21.0 [message #1844454 is a reply to message #1844449] Tue, 14 September 2021 12:41 Go to previous messageGo to next message
Evertson Croes is currently offline Evertson CroesFriend
Messages: 5
Registered: September 2021
Junior Member
Hi Christian, thank you for your reply.

Yes I made sure that I am using the correct IntelliJ plugin. I previously used the wrong one and constantly got errors about the "Widget" not being able to initialise.

I think it has something to do with the code introduced in the LanguageServerImpl (org.eclipse.xtext.ide) in the "initialize" method. There is now code to check if "workspace" configuration is supported. If that is the case it will use workspace folders instead of the base directory. In IntelliJ I don't have workspaces and I think that the "check if workspace is supported" method for some reason is returning "true".

I need a way to tell the Language server to just use the base directory again (as it did in 2.20.0). Is there any way to do this?

Also: Is there a "How to" somewhere about debugging the Language server?
Re: Namespace import no longer works since XText 2.21.0 [message #1844456 is a reply to message #1844442] Tue, 14 September 2021 13:02 Go to previous messageGo to next message
Evertson Croes is currently offline Evertson CroesFriend
Messages: 5
Registered: September 2021
Junior Member
Evertson Croes wrote on Tue, 14 September 2021 08:00
Situation:

I have created a language server that uses 4 Xtext projects, each with their own grammar.

When I build the language server using Xtext 2.21.0 and I use the IntelliJ LSP plugin to run the language server, everything works as expected. I can open a file and if I use the correct namespace import I can click on references from other files and the files are opened.

However since XText 2.21.0 this no longer works. The references are only resolved when I have the files containing the definitions being referenced to open in IntelliJ. This defeats the purpose of the "go to definition" functionality in a language server.

Does anyone have any idea why this might be the case?


I meant "When I build the language server using XText 2.20.0 and I use the IntelliJ LSP plugin to run the language server, everything works as expected.
Re: Namespace import no longer works since XText 2.21.0 [message #1844457 is a reply to message #1844454] Tue, 14 September 2021 13:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you should be able to change the startup script to add remote debugging parameters. then you should be able to connect from eclipse with debugger.
please note there was a change to how projects work / how the initialize params rootPath/rootUri/workspaceFolders are treated.
i dont know what/how your intellij lsp plugin passes.
see https://github.com/eclipse/xtext-core/issues/1238


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Namespace import no longer works since XText 2.21.0 [message #1844488 is a reply to message #1844457] Wed, 15 September 2021 06:34 Go to previous messageGo to next message
Evertson Croes is currently offline Evertson CroesFriend
Messages: 5
Registered: September 2021
Junior Member
Hi Christian,

Indeed I can see there is a change in how the Workspace is initialised from version 2.21.0. Is there a way I can give a configuration or parameter to the server launcher so that it uses the BaseDir just as it did in version 2.20.0?

I have a feeling that that will fix my problem.
Re: Namespace import no longer works since XText 2.21.0 [message #1844489 is a reply to message #1844488] Wed, 15 September 2021 06:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you need to read the code in xtext and also the code of your lsp client plugin

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Namespace import no longer works since XText 2.21.0 [message #1844893 is a reply to message #1844489] Wed, 29 September 2021 06:39 Go to previous messageGo to next message
Evertson Croes is currently offline Evertson CroesFriend
Messages: 5
Registered: September 2021
Junior Member
I did read the code of XText and I see a change in the LanguageServerImpl where it now checks if Workspace structure is supported. I have a feeling that this does not work in an IntelliJ setting. Is there a way to force it to use the baseDir instead of the Workspace setup?
Re: Namespace import no longer works since XText 2.21.0 [message #1844912 is a reply to message #1844893] Wed, 29 September 2021 14:11 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you can always subclass LanguageServerImpl and adjust it to your needs

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Change StringConcatenation for grammar tests
Next Topic:An icon for DSL file
Goto Forum:
  


Current Time: Thu Apr 25 04:46:10 GMT 2024

Powered by FUDForum. Page generated in 0.02969 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top