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

Add support for opening single files #195

Merged
merged 16 commits into from
Jul 19, 2021

Conversation

lukaszsamson
Copy link
Collaborator

It seems there was some support at some point but it got broken (probably when workspace folders concept was introduced). This PR brings it back and fixes some issues and inconsistencies around untitled files.

Addresses elixir-lsp/elixir-ls#307, depends on elixir-lsp/elixir-ls#562

make it possible to start default client for single file
…itled file

this leads to broken behavior of 2 servers running with the same rootUri
When starting a default client even if we do not pass a workspace folder to client options vs code will fall back to first workspace folder if any is open. This means that we cannot use default client for that case as it will result in 2 servers started for the same rootUri.
We need to pass a permissive document filter that will match untitled files to the first workspace client. Otherwise language server features won't work for such files. We cannot pass them to all clients as in that case in multiworkspace cases all servers would be handling the same messages.
On the other hand if no folder is open we have to use default client.
Copy link
Member

@axelson axelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall thrust of changes looks good, I just have some clarification and cleaning-related comments.

src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Show resolved Hide resolved
src/extension.ts Show resolved Hide resolved
src/extension.ts Show resolved Hide resolved
@lukaszsamson lukaszsamson requested a review from axelson July 6, 2021 06:34
@lukaszsamson
Copy link
Collaborator Author

@axelson I think I addressed all of the comments

Copy link
Member

@axelson axelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks! ❤️

@axelson axelson merged commit e3d8d3b into elixir-lsp:master Jul 19, 2021
@lukaszsamson lukaszsamson deleted the ls-single-file branch March 15, 2024 07:10
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

Successfully merging this pull request may close these issues.

2 participants