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 unique server id #278

Merged
merged 1 commit into from
Jun 3, 2020
Merged

Conversation

alex88
Copy link
Contributor

@alex88 alex88 commented Jun 2, 2020

To be able to handle multi-root workspaces on vscode (elixir-lsp/vscode-elixir-ls#70) there's the need to spawn multiple language servers (one per project).
This is currently not possible because the server registers the spec command for every instance and so no more than one server can be spawned at the same time.
This PR fixes that by generating an unique id every time is initialized.

Just a couple questions, is id ok? Or maybe server_id or instance_id might be better?
Regarding testing, should I test that defp handle_request(initialize_req... sets a new id on the state?

@lukaszsamson
Copy link
Collaborator

Just a couple questions, is id ok? Or maybe server_id or instance_id might be better?

How about server_instance_id?

Regarding testing, should I test that defp handle_request(initialize_req... sets a new id on the state?

IMO not worth it, if it's broken it'll crash anyway

@alex88
Copy link
Contributor Author

alex88 commented Jun 2, 2020

Thanks @lukaszsamson for the quick review, I've pushed the variable name change.
I'll squash everything as soon as everything looks good and the PR is ok to be merged.

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.

Thanks for this ❤️

@axelson axelson merged commit 959bc55 into elixir-lsp:master Jun 3, 2020
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.

3 participants