File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
packages/jupyterlab-lsp/src Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ import { ILoggerRegistry } from '@jupyterlab/logconsole';
2020import {
2121 ILSPDocumentConnectionManager ,
2222 DocumentConnectionManager ,
23- ILanguageServerManager
23+ ILanguageServerManager ,
24+ TLanguageServerId
2425} from '@jupyterlab/lsp' ;
2526import { ISettingRegistry } from '@jupyterlab/settingregistry' ;
2627import { IStatusBar } from '@jupyterlab/statusbar' ;
@@ -175,7 +176,22 @@ export class LSPExtension {
175176
176177 const previousInitialConfig = this . _connectionManager . initialConfigurations ;
177178 this . _connectionManager . initialConfigurations = languageServerSettings ;
178- // TODO: if priorities changed reset connections
179+
180+ const prioritiesChanged = Object . keys ( languageServerSettings ) . some (
181+ ( key : TLanguageServerId ) => {
182+ const prevConfig = previousInitialConfig ?. [ key ] ;
183+ const newConfig = languageServerSettings [ key ] ;
184+ return prevConfig && newConfig && prevConfig . rank !== newConfig . rank ;
185+ }
186+ ) ;
187+
188+ if ( prioritiesChanged ) {
189+ this . connectionManager . adapters . forEach ( adapter => {
190+ if ( adapter . virtualDocument ) {
191+ adapter [ 'reloadConnection' ] ( ) ;
192+ }
193+ } ) ;
194+ }
179195
180196 // update the server-independent part of configuration immediately
181197 this . connectionManager . updateConfiguration ( languageServerSettings ) ;
You can’t perform that action at this time.
0 commit comments