From 347a6188793545aa5ef1a6e40295c1d030fbb544 Mon Sep 17 00:00:00 2001 From: azerr Date: Thu, 12 Dec 2024 15:32:46 +0100 Subject: [PATCH] fix: remove isValid which can require a ReadAcion when element is a TreeElement (ex: Qute token). Signed-off-by: azerr --- .../LSPWorkspaceImplementationsSearch.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/LSPWorkspaceImplementationsSearch.java b/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/LSPWorkspaceImplementationsSearch.java index 64706e5a8..e21dc81e9 100644 --- a/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/LSPWorkspaceImplementationsSearch.java +++ b/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/LSPWorkspaceImplementationsSearch.java @@ -11,6 +11,7 @@ package com.redhat.devtools.lsp4ij.features.workspaceSymbol; import com.intellij.codeInsight.CodeInsightBundle; +import com.intellij.openapi.application.QueryExecutorBase; import com.intellij.openapi.editor.Document; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.Project; @@ -45,41 +46,45 @@ /** * Implements the IDE's standard Go To Implementation(s) action using LSP textDocument/implementation. --> */ -public class LSPWorkspaceImplementationsSearch implements QueryExecutor { +public class LSPWorkspaceImplementationsSearch extends QueryExecutorBase { private static final Logger LOGGER = LoggerFactory.getLogger(LSPWorkspaceImplementationsSearch.class); + public LSPWorkspaceImplementationsSearch() { + super(true); + } + @Override - public boolean execute(@NotNull DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull Processor consumer) { + public void processQuery(DefinitionsScopedSearch.@NotNull SearchParameters queryParameters, @NotNull Processor consumer) { Project project = queryParameters.getProject(); if (project.isDisposed()) { - return true; + return; } PsiElement element = queryParameters.getElement(); if (!element.isValid()) { - return true; + return; } PsiFile file = element.getContainingFile(); if ((file == null) || !file.isValid()) { - return true; + return; } Document document = LSPIJUtils.getDocument(file); if (document == null) { - return true; + return; } if (ProjectIndexingManager.canExecuteLSPFeature(file) != ExecuteLSPFeatureStatus.NOW) { // The file is not associated to a language server - return true; + return; } // Check if the file can support the feature if (!LanguageServiceAccessor.getInstance(project) .hasAny(file.getVirtualFile(), ls -> ls.getClientFeatures().getImplementationFeature().isImplementationSupported(file))) { - return true; + return; } int offset = element.getTextRange().getStartOffset(); @@ -111,12 +116,10 @@ public boolean execute(@NotNull DefinitionsScopedSearch.SearchParameters queryPa // textDocument/implementations has been collected correctly for (Location implementation : implementations) { if (!consumer.process(LSPPsiElementFactory.toPsiElement(implementation, project))) { - return false; + return; } } } } - - return true; } }