Skip to content

Commit

Permalink
Add clientscript/command triggers to class contributor
Browse files Browse the repository at this point in the history
  • Loading branch information
waleedyaseen committed Aug 28, 2024
1 parent f0ee203 commit f68da3c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Updated to IntelliJ 2024.2.
- Allowed empty lines in sym files.
- Symbols can now be resolved from sub directories.
- Allow for clientscript/command to be looked up in "Search Everywhere".

## [1.5.1] - 2024-04-15

Expand Down
33 changes: 25 additions & 8 deletions src/main/kotlin/io/runescript/plugin/ide/RsGotoClassContributor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,46 @@ import com.intellij.util.indexing.IdFilter
import io.runescript.plugin.lang.RuneScript
import io.runescript.plugin.lang.psi.RsScript
import io.runescript.plugin.lang.psi.qualifiedName
import io.runescript.plugin.lang.stubs.index.RsClientScriptIndex
import io.runescript.plugin.lang.stubs.index.RsCommandScriptIndex
import io.runescript.plugin.lang.stubs.index.RsProcScriptIndex

class RsGotoClassContributor : ChooseByNameContributorEx, GotoClassContributor {

private val keys = arrayOf(
RsProcScriptIndex.KEY,
RsClientScriptIndex.KEY,
RsCommandScriptIndex.KEY
)

override fun processNames(processor: Processor<in String>, scope: GlobalSearchScope, filter: IdFilter?) {
StubIndex.getInstance().processAllKeys(
RsProcScriptIndex.KEY,
for (key in keys) {
StubIndex.getInstance().processAllKeys(
key,
processor,
scope,
null
)
)
}
}

override fun processElementsWithName(name: String, processor: Processor<in NavigationItem>, parameters: FindSymbolParameters) {
override fun processElementsWithName(
name: String,
processor: Processor<in NavigationItem>,
parameters: FindSymbolParameters
) {
val originScope = parameters.searchScope
StubIndex.getInstance().processElements(
RsProcScriptIndex.KEY,
for (key in keys) {
StubIndex.getInstance().processElements(
key,
name,
parameters.project,
originScope,
null,
RsScript::class.java
) { element ->
processor.process(element)
) { element ->
processor.process(element)
}
}
}

Expand Down

0 comments on commit f68da3c

Please sign in to comment.