Skip to content

Commit

Permalink
Handle a situation where an index is not yet known as index not ready (
Browse files Browse the repository at this point in the history
  • Loading branch information
ahus1 committed Dec 21, 2024
1 parent dbe9d38 commit c294287
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This document provides a high-level view of the changes introduced by release.
- Handle YAML parsing errors when showing an editor notification about missing information in the Antora component descriptor (#1753)
- Preventing NPE when creating a missing file (#1754)
- Preventing NPE when parsing block attributes for listings (#1755)
- Handle a situation where an index is not yet known as index not ready (#1756)

=== 0.43.4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.asciidoc.intellij.psi;

import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StubIndex;
Expand Down Expand Up @@ -50,6 +51,14 @@ public Class<AsciiDocAttributeDeclaration> requiredClass() {

@Override
public Collection<AsciiDocAttributeDeclaration> get(@NotNull String key, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), key.toLowerCase(Locale.US), project, scope, requiredClass());
try {
return StubIndex.getElements(getKey(), key.toLowerCase(Locale.US), project, scope, requiredClass());
} catch (NullPointerException e) {
if (e.getMessage().startsWith("Can't find stub index extension")) {
throw IndexNotReadyException.create();
} else {
throw e;
}
}
}
}

0 comments on commit c294287

Please sign in to comment.