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

Investigate improving configuration flow by sending workspace/configuration at startup #392

Open
fwcd opened this issue Sep 13, 2022 · 1 comment
Labels
editor support Support for any non-VSCode editors/language clients lsp Language Server Protocol-related

Comments

@fwcd
Copy link
Owner

fwcd commented Sep 13, 2022

Extracted from #367 (comment)

There was some discussion upstream (in the LSP repo) on encouraging servers to move to a pull-model where the server fetches configurations through workspace/configuration at startup instead of relying on the configuration to always be passed at launch. Ideally we should probably do something similar in the medium term.

Some interesting threads:

@fwcd fwcd added editor support Support for any non-VSCode editors/language clients lsp Language Server Protocol-related labels Sep 13, 2022
@NepNep21
Copy link

So, i am actually working on that, however with the way the configuration class currently works it would be quite clunky to implement, what do you suggest as a rough idea? This is how the request and its handling would generally work with the current system:

private fun newConfig(item: String) = ConfigurationItem().also { it.section = item }

override fun initialized(params: InitializedParams?) {
    client.configuration(ConfigurationParams(listOf(
        newConfig("foo"),
        newConfig("bar")
    ))).get().let { // Blocking to ensure we are loaded before continuing
        // Note the boilerplate and inability to use a loop as well as the order requirement
        config.foo = it[0] as X
        config.bar = it[1] as Y
    }
}

Reflection could potentially be used to make it better but that would still be fairly hacky, i believe it would be better to rewrite the config system entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor support Support for any non-VSCode editors/language clients lsp Language Server Protocol-related
Projects
None yet
Development

No branches or pull requests

2 participants