Skip to content

Commit f0ee203

Browse files
committed
Resolve symbols from sub directories
1 parent ec3c74e commit f0ee203

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- Reworked project model, removing the old SDK model.
1616
- Updated to IntelliJ 2024.2.
1717
- Allowed empty lines in sym files.
18+
- Symbols can now be resolved from sub directories.
1819

1920
## [1.5.1] - 2024-04-15
2021

src/main/kotlin/io/runescript/plugin/symbollang/psi/index/RsSymbolIndex.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ class RsSymbolIndex : StringStubIndexExtension<RsSymSymbol>() {
2424
val lookupType = if (type == RsPrimitiveType.NAMEDOBJ) RsPrimitiveType.OBJ else type
2525
val scope = GlobalSearchScope.allScope(project)
2626
val configs = StubIndex.getElements(KEY, name, project, scope, RsSymSymbol::class.java)
27-
return configs.singleOrNull { it.containingFile.nameWithoutExtension == lookupType.literal }
27+
return configs.singleOrNull {
28+
// TODO: Only include if the file is within the symbols directory.
29+
val containingFile = it.containingFile
30+
val parent = containingFile.parent
31+
if (parent != null && parent.name == lookupType.literal) {
32+
true
33+
} else {
34+
containingFile.nameWithoutExtension == lookupType.literal
35+
}
36+
}
2837
}
2938

3039
val PsiFile.nameWithoutExtension: String

0 commit comments

Comments
 (0)