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

VS Code Folders should have isolated language server context #434

Closed
radeksimko opened this issue Jul 11, 2020 · 11 comments · Fixed by #448
Closed

VS Code Folders should have isolated language server context #434

radeksimko opened this issue Jul 11, 2020 · 11 comments · Fixed by #448
Assignees
Labels
bug Something isn't working

Comments

@radeksimko
Copy link
Member

I am unsure if this is at all duplicate of #417 since we don't have enough details there, but I managed to reproduce a bug with a great help of a community member on Discourse.

This could also be solved by hashicorp/terraform-ls#179 but I think if we know that two folders just aren't related to each other I think we just shouldn't even attempt to be cross-linking them in any way, i.e. these shouldn't share the same language server session.


Hierarchy

.
|-- first
    `-- .terraform
`-- second
    `-- .terraform

Steps to reproduce

  1. Create a hierarchy of two (initialized) root modules as above
  2. Open first in VS Code, e.g. via code first in the terminal
  3. Right click in the Explorer -> Add Folder to Workspace
  4. Pick second folder

Actual behaviour

textDocument/didOpen was sent to the server, which looked up first root module as a candidate for second, because they share the same LS session.

Expected behaviour

New language server session or process is launched for second folder and initialize request is sent, which triggers an isolated discovery of root module(s) within second.

We could also leverage workspace/workspaceFolders, but I am afraid that might require some more significant changes on the server side. Also workspace/workspaceFolders is opt-in per LSP and when it isn't supported by the server then most clients (those I had chance to try) just launch isolated session and send new initialize request, so I think the extension should just mimic this behaviour for now.

@radeksimko radeksimko added the bug Something isn't working label Jul 11, 2020
@matt-FFFFFF

This comment has been minimized.

@radeksimko
Copy link
Member Author

@matt-FFFFFF I believe that "no root module found" is generally unrelated to this bug. The way this bug would be experienced by the end user is in fact by finding either incorrect or more than 1 root module.

@radeksimko
Copy link
Member Author

I would be curious to see the log though, if you don't mind sharing it - that might help me understand why it isn't being discovered - see https://github.com/hashicorp/terraform-ls/blob/master/docs/TROUBLESHOOTING.md for how to set up logging.

@matt-FFFFFF
Copy link

Apologies. Having searched again I can see that my issue is already reported.

@radeksimko
Copy link
Member Author

@matt-FFFFFF No worries, there's a number of reports with "no root module found" message, but they may each have different root cause - which is why I'd really appreciate looking at the log.

@matt-FFFFFF
Copy link

Sure. Getting them now

@radeksimko
Copy link
Member Author

Once you have the logs then this may be the best place for continuing the discussion: hashicorp/terraform-ls#221

@matt-FFFFFF
Copy link

Typically. It's not doing it now... Will report in that issue when I get something

@aeschright
Copy link
Contributor

For reference, here's the VSCode example on handling multiple workspace folders: https://github.com/microsoft/vscode-extension-samples/tree/master/lsp-multi-server-sample

@paultyng
Copy link
Contributor

I think this is related and/or a duplicate of #330

@ghost
Copy link

ghost commented Oct 9, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants