Skip to content

Commit

Permalink
fix: call init when open file must start ls while indexing.
Browse files Browse the repository at this point in the history
Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Oct 18, 2023
1 parent 96fc899 commit 607707e
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public ConnectToLanguageServerCompletableFuture(@NotNull VirtualFile file, @NotN
connectToLanguageServer(file, project);
return null;
}, MessageFormat.format(MESSAGE_KEY, file.getUrl()), project, null, new CoalesceByKey(ConnectDocumentToLanguageServerSetupParticipant.class.getName(), file.getUrl()));
init();
}
}

Expand All @@ -58,15 +59,15 @@ public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile f
boolean readAccessAllowed = ApplicationManager.getApplication().isReadAccessAllowed();
boolean dumb = DumbService.isDumb(project);
// As document matcher requires read action, we try to open the file in read action and when indexing is finishsed.
if (readAccessAllowed && !dumb) {
// No indexing and read action enabled
// --> force the start of all languages servers mapped with the given file immediately
connectToLanguageServer(file, project);
} else {
// Wait for indexing is finished and read action is enabled
// --> force the start of all languages servers mapped with the given file when indexing is finished and read action is allowed
new ConnectToLanguageServerCompletableFuture(file, project);
}
//if (readAccessAllowed && !dumb) {
// No indexing and read action enabled
// --> force the start of all languages servers mapped with the given file immediately
// connectToLanguageServer(file, project);
//} else {
// Wait for indexing is finished and read action is enabled
// --> force the start of all languages servers mapped with the given file when indexing is finished and read action is allowed
new ConnectToLanguageServerCompletableFuture(file, project);
//}
}

private static void connectToLanguageServer(@NotNull VirtualFile file, @NotNull Project project) {
Expand Down

0 comments on commit 607707e

Please sign in to comment.