@@ -121,8 +121,8 @@ public static void main(String[] args) {
121121 private LanguageClient client = null ;
122122
123123 private Map <String , String > workspaceRoots = new HashMap <>();
124- private Map <String , LanguageService > scriptServices = new HashMap <>();
125- private Map <String , LanguageService > configServices = new HashMap <>();
124+ private Map <String , ConfigService > configServices = new HashMap <>();
125+ private Map <String , ScriptService > scriptServices = new HashMap <>();
126126
127127 private LanguageServerConfiguration configuration = LanguageServerConfiguration .defaults ();
128128
@@ -461,6 +461,7 @@ public void didChangeConfiguration(DidChangeConfigurationParams params) {
461461 withDefault (JsonUtils .getBoolean (settings , "nextflow.formatting.harshilAlignment" ), configuration .harshilAlignment ()),
462462 withDefault (JsonUtils .getBoolean (settings , "nextflow.formatting.maheshForm" ), configuration .maheshForm ()),
463463 withDefault (JsonUtils .getInteger (settings , "nextflow.completion.maxItems" ), configuration .maxCompletionItems ()),
464+ withDefault (JsonUtils .getString (settings , "nextflow.pluginRegistryUrl" ), configuration .pluginRegistryUrl ()),
464465 withDefault (JsonUtils .getBoolean (settings , "nextflow.formatting.sortDeclarations" ), configuration .sortDeclarations ()),
465466 withDefault (JsonUtils .getBoolean (settings , "nextflow.typeChecking" ), configuration .typeChecking ())
466467 );
@@ -483,6 +484,7 @@ private <T> T withDefault(T value, T defaultValue) {
483484 private boolean shouldInitialize (LanguageServerConfiguration previous , LanguageServerConfiguration current ) {
484485 return previous .errorReportingMode () != current .errorReportingMode ()
485486 || !DefaultGroovyMethods .equals (previous .excludePatterns (), current .excludePatterns ())
487+ || previous .pluginRegistryUrl () != current .pluginRegistryUrl ()
486488 || previous .typeChecking () != current .typeChecking ();
487489 }
488490
@@ -500,8 +502,8 @@ private void initializeWorkspaces() {
500502 progress .update (progressMessage , count * 100 / total );
501503 count ++;
502504
503- scriptServices .get (name ).initialize (configuration );
504505 configServices .get (name ).initialize (configuration );
506+ scriptServices .get (name ).initialize (configuration , configServices .get (name ).getPluginSpecCache ());
505507 }
506508
507509 progress .end ();
@@ -519,16 +521,16 @@ public void didChangeWorkspaceFolders(DidChangeWorkspaceFoldersParams params) {
519521 var name = workspaceFolder .getName ();
520522 log .debug ("workspace/didChangeWorkspaceFolders remove " + name );
521523 workspaceRoots .remove (name );
522- scriptServices .remove (name ).clearDiagnostics ();
523524 configServices .remove (name ).clearDiagnostics ();
525+ scriptServices .remove (name ).clearDiagnostics ();
524526 }
525527 for ( var workspaceFolder : event .getAdded () ) {
526528 var name = workspaceFolder .getName ();
527529 var uri = workspaceFolder .getUri ();
528530 log .debug ("workspace/didChangeWorkspaceFolders add " + name + " " + uri );
529531 addWorkspaceFolder (name , uri );
530- scriptServices .get (name ).initialize (configuration );
531532 configServices .get (name ).initialize (configuration );
533+ scriptServices .get (name ).initialize (configuration , configServices .get (name ).getPluginSpecCache ());
532534 }
533535 }
534536
@@ -620,13 +622,13 @@ public CompletableFuture<Either<List<? extends SymbolInformation>, List<? extend
620622 private void addWorkspaceFolder (String name , String uri ) {
621623 workspaceRoots .put (name , uri );
622624
623- var scriptService = new ScriptService (uri );
624- scriptService .connect (client );
625- scriptServices .put (name , scriptService );
626-
627625 var configService = new ConfigService (uri );
628626 configService .connect (client );
629627 configServices .put (name , configService );
628+
629+ var scriptService = new ScriptService (uri );
630+ scriptService .connect (client );
631+ scriptServices .put (name , scriptService );
630632 }
631633
632634 private String relativePath (String uri ) {
@@ -654,12 +656,12 @@ private LanguageService getLanguageService(String uri) {
654656 return service ;
655657 }
656658
657- private LanguageService getLanguageService0 (String uri , Map <String , LanguageService > services ) {
659+ private LanguageService getLanguageService0 (String uri , Map <String , ? extends LanguageService > services ) {
658660 var service = workspaceRoots .entrySet ().stream ()
659661 .filter ((entry ) -> entry .getValue () != null && uri .startsWith (entry .getValue ()))
660662 .findFirst ()
661- .map ((entry ) -> services .get (entry .getKey ()))
662- .orElse (services .get (DEFAULT_WORKSPACE_FOLDER_NAME ));
663+ .map ((entry ) -> ( LanguageService ) services .get (entry .getKey ()))
664+ .orElse (( LanguageService ) services .get (DEFAULT_WORKSPACE_FOLDER_NAME ));
663665 if ( service == null || !service .matchesFile (uri ) )
664666 return null ;
665667 return service ;
0 commit comments