-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix refactoring in Java and Kotlin code which was broken since 0.41.9 (…
- Loading branch information
Showing
4 changed files
with
36 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/org/asciidoc/intellij/indexer/AsciiDocJavaScopeEnlarger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.asciidoc.intellij.indexer; | ||
|
||
import com.intellij.psi.PsiClass; | ||
import com.intellij.psi.PsiElement; | ||
import com.intellij.psi.PsiPackage; | ||
import com.intellij.psi.search.SearchScope; | ||
import com.intellij.psi.search.UseScopeEnlarger; | ||
import org.asciidoc.intellij.psi.AsciiDocSearchScope; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class AsciiDocJavaScopeEnlarger extends UseScopeEnlarger { | ||
@Nullable | ||
@Override | ||
public SearchScope getAdditionalUseScope(@NotNull PsiElement element) { | ||
// Any Java class or package can be referenced from an AsciiDoc element within the same project. | ||
// See org.asciidoc.intellij.psi.AsciiDocJavaReference for the code. Both have the com.intellij.psi.search.GlobalSearchScope, as otherwise this might break refactorings | ||
// as previously reported in https://github.com/asciidoctor/asciidoctor-intellij-plugin/issues/1591 | ||
if (element instanceof PsiClass || element instanceof PsiPackage) { | ||
return new AsciiDocSearchScope(element.getProject()).restrictedByAsciiDocFileType(); | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters