From 607707e3cb47a12411809e4fdca7afa73061ceb0 Mon Sep 17 00:00:00 2001 From: azerr Date: Wed, 18 Oct 2023 10:25:32 +0200 Subject: [PATCH] fix: call init when open file must start ls while indexing. Signed-off-by: azerr --- ...umentToLanguageServerSetupParticipant.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4ij/ConnectDocumentToLanguageServerSetupParticipant.java b/src/main/java/com/redhat/devtools/intellij/lsp4ij/ConnectDocumentToLanguageServerSetupParticipant.java index 27e1aae8e..c82633220 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4ij/ConnectDocumentToLanguageServerSetupParticipant.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4ij/ConnectDocumentToLanguageServerSetupParticipant.java @@ -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(); } } @@ -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) {