Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in opening files from different workspace. #1

Open
arunganesh-a opened this issue Feb 22, 2022 · 5 comments
Open

Issue in opening files from different workspace. #1

arunganesh-a opened this issue Feb 22, 2022 · 5 comments

Comments

@arunganesh-a
Copy link

Hi @CGNonofr ,

When we use Java language server and connect the language client using the languageserver-mutualized. It is working fine when we open files from the same workspace(Each maven project is a separate workspace) in different browsers. When we open a file from a different project, the 2nd project workspace does not get loaded.

@CGNonofr
Copy link
Contributor

CGNonofr commented Feb 22, 2022

As said in the documentation, only the first client initialization request will be used. it contains workspaceFolders.

So what you can do:

  • Start the language server with all workspace folders
  • Create the new workspace folder using the workspace folder requests (and remove it when the client disconnect)
  • Put all clients in the same folder

@arunganesh-a
Copy link
Author

arunganesh-a commented Feb 22, 2022

I tried this approach.

this is the initialize method that is sent when I open the editor for the first time. Not sure what is the mistake that I am doing.

First Request sent

{ "jsonrpc": "2.0", "id": 0, "method": "initialize", "params": { "processId": null, "clientInfo": { "name": "Monaco" }, "locale": "en-GB", "rootPath": null, "rootUri": null, "capabilities": { "workspace": { "applyEdit": true, "workspaceEdit": { "documentChanges": true, "resourceOperations": [ "create", "rename", "delete" ], "failureHandling": "textOnlyTransactional", "normalizesLineEndings": true, "changeAnnotationSupport": { "groupsOnLabel": true } }, "didChangeConfiguration": { "dynamicRegistration": true }, "didChangeWatchedFiles": { "dynamicRegistration": true }, "symbol": { "dynamicRegistration": true, "symbolKind": { "valueSet": [1,2,3,...,26] }, "tagSupport": { "valueSet": [ 1 ] } }, "codeLens": { "refreshSupport": true }, "executeCommand": { "dynamicRegistration": true }, "configuration": true, "workspaceFolders": true, "semanticTokens": { "refreshSupport": true } }, "textDocument": { "publishDiagnostics": { "relatedInformation": true, "versionSupport": false, "tagSupport": { "valueSet": [ 1, 2 ] }, "codeDescriptionSupport": true, "dataSupport": true }, "synchronization": { "dynamicRegistration": true, "willSave": true, "willSaveWaitUntil": true, "didSave": true }, "completion": { "dynamicRegistration": true, "contextSupport": true, "completionItem": { "snippetSupport": true, "commitCharactersSupport": true, "documentationFormat": [ "markdown", "plaintext" ], "deprecatedSupport": true, "preselectSupport": true, "tagSupport": { "valueSet": [ 1 ] }, "insertReplaceSupport": true, "resolveSupport": { "properties": [ "documentation", "detail", "additionalTextEdits" ] }, "insertTextModeSupport": { "valueSet": [ 1, 2 ] } }, "completionItemKind": { "valueSet": [1,2,3..,25] } }, "hover": { "dynamicRegistration": true, "contentFormat": [ "markdown", "plaintext" ] }, "signatureHelp": { "dynamicRegistration": true, "signatureInformation": { "documentationFormat": [ "markdown", "plaintext" ], "parameterInformation": { "labelOffsetSupport": true }, "activeParameterSupport": true }, "contextSupport": true }, "definition": { "dynamicRegistration": true, "linkSupport": true }, "references": { "dynamicRegistration": true }, "documentHighlight": { "dynamicRegistration": true }, "documentSymbol": { "dynamicRegistration": true, "symbolKind": { "valueSet": [1,2,3,...,26] }, "hierarchicalDocumentSymbolSupport": true, "tagSupport": { "valueSet": [ 1 ] }, "labelSupport": true }, "codeAction": { "dynamicRegistration": true, "isPreferredSupport": true, "disabledSupport": true, "dataSupport": true, "resolveSupport": { "properties": [ "edit" ] }, "codeActionLiteralSupport": { "codeActionKind": { "valueSet": [ "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" ] } }, "honorsChangeAnnotations": false }, "codeLens": { "dynamicRegistration": true }, "formatting": { "dynamicRegistration": true }, "rangeFormatting": { "dynamicRegistration": true }, "onTypeFormatting": { "dynamicRegistration": true }, "rename": { "dynamicRegistration": true, "prepareSupport": true, "prepareSupportDefaultBehavior": 1, "honorsChangeAnnotations": true }, "documentLink": { "dynamicRegistration": true, "tooltipSupport": true }, "typeDefinition": { "dynamicRegistration": true, "linkSupport": true }, "implementation": { "dynamicRegistration": true, "linkSupport": true }, "colorProvider": { "dynamicRegistration": true }, "foldingRange": { "dynamicRegistration": true, "rangeLimit": 5000, "lineFoldingOnly": true }, "declaration": { "dynamicRegistration": true, "linkSupport": true }, "semanticTokens": { "dynamicRegistration": true, "tokenTypes": [ "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator" ], "tokenModifiers": [ "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" ], "formats": [ "relative" ], "requests": { "range": true, "full": { "delta": true } }, "multilineTokenSupport": false, "overlappingTokenSupport": false }, "callHierarchy": { "dynamicRegistration": true } }, "window": { "showMessage": { "messageActionItem": { "additionalPropertiesSupport": true } }, "showDocument": { "support": true } }, "general": { "regularExpressions": { "engine": "ECMAScript", "version": "ES2020" }, "markdown": { "parser": "marked", "version": "1.1.0" } } }, "initializationOptions": { "workspaceFolders": [ "workspacePath1", "workspacePath2" ] }, "trace": "off", "workspaceFolders": null } }

Message from the client:

{"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"willSave":false,"willSaveWaitUntil":true,"save":{"includeText":true}},"completionProvider":{"resolveProvider":true,"triggerCharacters":[".","@","#","*"]},"workspace":{"workspaceFolders":{"supported":false}}},"serverInfo":{"name":"Mutualized server"}}}

@arunganesh-a
Copy link
Author

In the mutualised server message, I can see
"workspace":{"workspaceFolders":{"supported":false}}
not sure if this has something to do with this issue.

@CGNonofr
Copy link
Contributor

workspaceFolders is supposed to be an array of workspaceFolder, not strings

Message from the client:

you mean from the server?

not sure if this has something to do with this issue.

Nop, it's declarative only, it won't support workspaceFolder requests coming from the client but the init params are forwarded as is. It can still be changed tho

@arunganesh-a
Copy link
Author

Yes from the server.
I tried with workspace folders as an array, still it picks up only the folder in the first index of the array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants