Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » VSCode extension retrieve workspace configuration
VSCode extension retrieve workspace configuration [message #1861028] Thu, 14 September 2023 17:50 Go to next message
Yannick DAVELUY is currently offline Yannick DAVELUYFriend
Messages: 39
Registered: July 2020
Member
Hello,
I would like to retrieve the client configuration from my xtext language server.

When I call LanguageClient.configuration(...) on server side I get a org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Unhandled method workspace/configuration.

It seems not implemented.

Any idea on how to solve this issue ?
Re: VSCode extension retrieve workspace configuration [message #1861029 is a reply to message #1861028] Thu, 14 September 2023 18:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
Subclass languageserverimpl. Handle it. Bind subclass in serverModule or mixin for in. Create custom launcher class with new module

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: VSCode extension retrieve workspace configuration [message #1861037 is a reply to message #1861029] Fri, 15 September 2023 07:15 Go to previous messageGo to next message
Yannick DAVELUY is currently offline Yannick DAVELUYFriend
Messages: 39
Registered: July 2020
Member
Thanks for your answer.

My current design match to what you said. In fact it seems not possible to call the client.configuration(...) during LanguageServer.Initialize(...). I will delay the call later.

In fact my need is to configure a list of project dependencies in VS Code configuration:
"configuration": [
			{
				"type": "object",
				"title": "MyDsl",
				"properties": {
					"mydsl.dependencies": {
						"type": "array",
						"scope": "resource",
						"item": "string",
						"default": [
							"mydsl_common_library"
						],
						"description": "Project dependencies:"
					}
				}
			}
		]


On Xtext side I would like to retrieve this list and store the dependencies in a specialized IProjectConfig and to create a ProjectDescription with a populated list of dependencies. After I will have to create a custom IAllContainerState to link the dependencies with the provided VSCode workspace folders.

Is it a correct approach ?
Re: VSCode extension retrieve workspace configuration [message #1861042 is a reply to message #1861037] Fri, 15 September 2023 08:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
i am not sure. you need to try out.
native question?
why not store project setup in a special file in workspace?
how do you handle the deps clientside?

can you have a look at the didChangeWorkspaceFolders and didChangeConfiguration impls?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: VSCode extension retrieve workspace configuration [message #1861105 is a reply to message #1861042] Thu, 21 September 2023 06:47 Go to previous messageGo to next message
Yannick DAVELUY is currently offline Yannick DAVELUYFriend
Messages: 39
Registered: July 2020
Member
My initial idea was to reuse the VSCode configuration to reuse its editor. But this solution is platform dependent and I prefer now have a custom configuration file for my DSL.

My json configuration file contains the list of project dependencies. When the configuration files is changed I notify the server:
    context.subscriptions.push(
        workspace.createFileSystemWatcher('**/.mydsl/settings.json').onDidChange(() => {
            lc.sendNotification(`workspace/didChangeConfiguration`, undefined)
        })
    );

and on Server side I update the project config and run a new build in case the configuration changes.

I still have some issues with project cross references. When I change a dsl in project A, changes are not reflected in the index of project B(with dep on A).
Re: VSCode extension retrieve workspace configuration [message #1861107 is a reply to message #1861105] Thu, 21 September 2023 07:03 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
i assume you need to debug affected calculation / project / workspace manager (e.g. org.eclipse.xtext.build.Indexer)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:How can I prevent my Xtext Maven build from breaking every 3 months?
Next Topic:Grammar Modularity
Goto Forum:
  


Current Time: Thu Dec 26 23:17:46 GMT 2024

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

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

Back to the top