Skip to main content



      Home
Home » Modeling » TMF (Xtext) » VSCode extension retrieve workspace configuration
VSCode extension retrieve workspace configuration [message #1861028] Thu, 14 September 2023 13:50 Go to next message
Eclipse UserFriend
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 14:03 Go to previous messageGo to next message
Eclipse UserFriend
Subclass languageserverimpl. Handle it. Bind subclass in serverModule or mixin for in. Create custom launcher class with new module
Re: VSCode extension retrieve workspace configuration [message #1861037 is a reply to message #1861029] Fri, 15 September 2023 03:15 Go to previous messageGo to next message
Eclipse UserFriend
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 04:59 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: VSCode extension retrieve workspace configuration [message #1861105 is a reply to message #1861042] Thu, 21 September 2023 02:47 Go to previous messageGo to next message
Eclipse UserFriend
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 03:03 Go to previous message
Eclipse UserFriend
i assume you need to debug affected calculation / project / workspace manager (e.g. org.eclipse.xtext.build.Indexer)
Previous Topic:How can I prevent my Xtext Maven build from breaking every 3 months?
Next Topic:Grammar Modularity
Goto Forum:
  


Current Time: Thu Jun 12 15:52:28 EDT 2025

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

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

Back to the top