Open eine opened 5 years ago
LSP Multi Server Example: https://github.com/Microsoft/vscode-extension-samples/tree/master/lsp-multi-server-sample
A language server example that demonstrates how to start a server per workspace folder. If the workspace has nested workspace folders only a server for the outer most workspace folder is started assuming that the language service handles nested code.
Ref: Multi-root workspaces where mentioned in #5.
Currently, multi-root workspaces seem not to be supported. I added the following
hdl-prj.json
to VUnit's examples/vhdl/array_axis_vcs:If I open the folder, everything works as expected:
However, when a workspace which contains the folder is opened, the project file is searched for in the first folder only. Hence, if the file which is being browsed belongs to the first folder, everything works ok. But, when it does correspond to a different folder, the project file is not used.
Example of 'valid' workspace:
Example of 'not valid' workspace:
As explained in code.visualstudio.com/api/references/vscode-api#workspace,
vscode.workspace.workspaceFolders
provides:Therefore, I think that this could be fixed by letting ghdl-ls manage multiple projects/folders in parallel, and assuming that a single file will not be mapped to multiple project files. Note that
vscode.workspace.getWorkspaceFolder(Uri)
can be used to get the folder from the path of a file.Moreover, it is possible to add settings to the workspace itself, apart form individual settings for each folder. See https://code.visualstudio.com/docs/editor/multi-root-workspaces#_settings. Hence, it should probably be supported to set a
--std
parameter in the workspace, which is then overriden by some folders, or by thehdl-prj.json
files inside them.