-
Notifications
You must be signed in to change notification settings - Fork 149
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
Can we dynamically update the language server settings? #976
Comments
If I am not mistaken JupyterLab extensions are capable of changing settings of other extensions. This goes like: const extension: JupyterFrontEndPlugin<void> = {
id: MY_PLUGIN_ID,
autoStart: true,
requires: [ISettingRegistry],
activate: (app: JupyterFrontEnd, settingsRegistry: ISettingRegistry) => {
const settings = settingsRegistry.load(ANOTHER_PLUGIN_ID);
settings.set('setting', 'value');
}
} see https://github.com/jupyterlab/extension-examples/tree/main/settings. In this case, that would be: const settings = settingsRegistry.load('@jupyter-lsp/jupyterlab-lsp:plugin');
const current = settings.get('language_servers').user; // you may want to extract default connections (if any using `.composite`) but take the rest of settings from `.user` to polluting user settings with defaults
current['sql-language-server']['serverSettings']['sqlLanguageServer.connections'] = [MY_CONNECTION];
settings.set('language_servers', current); Now, this is not guaranteed to work for jupyterlab-lsp - there may be some code path in how we handle the settings which breaks it. If that is the case, feel welcome to point it out/open a PR. Please let me know if this turned out to be a fruitful approach. |
I assume this helped :) Closing as answered. |
It did help. Thank you :) |
Context
We are developing an extension depending on
jupyterlab-lsp
's autocompletion functionality. We are using joe-re/sql-language-server. We want to be able to dynamically update the Language Server Protocol settings.Description
sql-language-server
requires settings of the following formatAs per my understanding, this is accessible via
@jupyter-lsp/jupyterlab-lsp
plugin. We want to be able to dynamically update"sqlLanguageServer.connections"
to add more connection objects through our JupyterLab extension. Is there any way to do that?The text was updated successfully, but these errors were encountered: