Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Get already build xtext resource in languageServer (Get already build xtext resource in languageServer )
Get already build xtext resource in languageServer [message #1851872] Wed, 20 April 2022 17:02 Go to next message
Nagaraj Kandoor is currently offline Nagaraj KandoorFriend
Messages: 56
Registered: May 2020
Member
For my project I am introducing new method in language server context. I need to get allready build xtext resource set so that i need not to load resource again.

When the first build happen request method 'initialize' i see projectManager ResourceSet is populated. I just want to reuse xtext resource so i injected ProjectManager in my class but projectManager.getResourceSet() always return null.

@Inject
ProjectManager projectManager;

@JsonRequest(value = "UpdateModel")
@Override
public CompletableFuture<?> request(InitializeParams parameter) {

ResourceSet myResource =projectManager.getResourceSet(); // returns  resourceSet null

}



Looking forward to here from you.

Re: Get already build xtext resource in languageServer [message #1851874 is a reply to message #1851872] Wed, 20 April 2022 17:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14736
Registered: July 2009
Senior Member
I am not sure if this is the correct way of doing what you want to achieve
Is there a reason you don't call requestmanager runread or runwrite methods as other services do


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Get already build xtext resource in languageServer [message #1851892 is a reply to message #1851874] Thu, 21 April 2022 09:26 Go to previous messageGo to next message
Nagaraj Kandoor is currently offline Nagaraj KandoorFriend
Messages: 56
Registered: May 2020
Member
@ Christian Dietrich

Thank you for your quick reply.

To Answer your questions I just implemented ILanguageServerExtension and made changes according to that. I was able to achieve new method functionality(Update Model). I just want to optimize this further(if xtext resource already build just use it, instead of loading again).

tried : Once I have IlanguageServerAceess i tried to create ResourceSet based on URI ilanguageServerAceess.newLiveScopeResourceSet(uri); // Resource set got created but no resource added.

I have gone through runRead method If my understanding is correct runRead method work for particular resource and its adding request to queue(ExecutorService).

What I am trying to achieve is get all resource and update model and save.

@JsonRequest(value = "UpdateModel")
@Override
public CompletableFuture<?> request(InitializeParams parameter) {

ResourceSet myResource =projectManager.getResourceSet(); // returns resourceSet null

}
Re: Get already build xtext resource in languageServer [message #1851894 is a reply to message #1851892] Thu, 21 April 2022 09:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14736
Registered: July 2009
Senior Member
If the project manager never does a build resourceset won't be there

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Get already build xtext resource in languageServer [message #1851896 is a reply to message #1851894] Thu, 21 April 2022 09:54 Go to previous message
Nagaraj Kandoor is currently offline Nagaraj KandoorFriend
Messages: 56
Registered: May 2020
Member
@ Christian Dietrich
Thank you for your reply.
Previous Topic:LSP4J : Language Server method call never ends
Next Topic:[1...*] cardinality in xtext
Goto Forum:
  


Current Time: Wed Dec 11 11:02:23 GMT 2024

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

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

Back to the top