From 043173d9ead7e75f4ac3153a29ce480db77c9a67 Mon Sep 17 00:00:00 2001 From: azerr Date: Wed, 1 Jan 2025 18:39:50 +0100 Subject: [PATCH] fix: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'file' of com/intellij/psi/search/GlobalSearchScope.accept must not be null Fixes #721 Signed-off-by: azerr --- .../workspaceSymbol/AbstractLSPWorkspaceSymbolContributor.java | 2 +- .../lsp4ij/features/workspaceSymbol/WorkspaceSymbolData.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/AbstractLSPWorkspaceSymbolContributor.java b/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/AbstractLSPWorkspaceSymbolContributor.java index 78e97a9db..19a894141 100644 --- a/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/AbstractLSPWorkspaceSymbolContributor.java +++ b/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/AbstractLSPWorkspaceSymbolContributor.java @@ -55,7 +55,7 @@ public void processNames(@NotNull Processor processor, List items = getWorkspaceSymbols(queryString, true, project); if (items != null) { items.stream() - .filter(data -> scope.accept(data.getFile())) + .filter(data -> data.getFile() != null && scope.accept(data.getFile())) .map(NavigationItem::getName) .forEach(processor::process); } diff --git a/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/WorkspaceSymbolData.java b/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/WorkspaceSymbolData.java index a5df27eb9..83e90d7f1 100644 --- a/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/WorkspaceSymbolData.java +++ b/src/main/java/com/redhat/devtools/lsp4ij/features/workspaceSymbol/WorkspaceSymbolData.java @@ -90,6 +90,7 @@ public WorkspaceSymbolData(String name, this.presentation = new LSPItemPresentation(name, symbolKind, locationString); } + @Nullable public VirtualFile getFile() { return file; }