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

Support workspace/configuration? #699

Closed
tomv564 opened this issue Aug 26, 2019 · 4 comments
Closed

Support workspace/configuration? #699

tomv564 opened this issue Aug 26, 2019 · 4 comments

Comments

@tomv564
Copy link
Contributor

tomv564 commented Aug 26, 2019

Related to #526 where the ESLint server makes the request and subsequently fails to start.

Spec here:
https://github.com/Microsoft/language-server-protocol/blob/gh-pages/specification.md#workspace_configuration

Do other language servers need it?
What is authoritative on these scope names used in the URI? VS Code? EditorConfig?
How does it apply to our package: try to read Sublime settings, or store them in EditorConfig or each language client's settings?

@rwols
Copy link
Member

rwols commented Aug 26, 2019

As with all any[] types in the LSP spec that go directly against the spirit of LSP we can't really do anything generic.

My idea about this was to let a LanguageHandler handle this.

Here's a basic outline of how that would look:

windows.py

        client.on_request(
            "workspace/configuration",
            lambda params, request_id: self._handle_configuration(params, client, request_id))


    def _handle_configuration(self, params, client, id) -> None:
        # LanguageHandler.get_configuration would be a new interface method
        maybe = self._handlers.get_configuration(params)
        if maybe:
            client.send_response(maybe ...)
            return
        # fall back to just getting the view settings
        view = self.window.active_view()
        setting = view.settings().get(params[ ... ])
        client.send_response(setting ...)

@tomv564
Copy link
Contributor Author

tomv564 commented Aug 28, 2019

Some interesting background in this discussion: microsoft/language-server-protocol#567 (comment)

@tomv564
Copy link
Contributor Author

tomv564 commented Sep 30, 2019

@rwols, to respond to your suggestion:

Looking at the code, a LanguageHandler can replace the default implementation by calling client.on_request("workspace/configuration", my_handler) in the on_initialized hook.

As for storing server configuration in the Sublime settings structure instead of the LSP client configs, I think it's interesting (as we discussed in the format on save PR). But I think that servers likely expect the same content as they got from didChangeConfiguration?

@tomv564
Copy link
Contributor Author

tomv564 commented Sep 30, 2019

As an implementation is merged now, I will close the issue until we have more servers that challenge the current functionality.

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

No branches or pull requests

2 participants