Added ChooseByNameContributor.

This commit is contained in:
Chris Hodges 2021-07-20 11:18:42 +02:00
parent 9a37b9c569
commit 331b88c05f
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,24 @@
package de.platon42.intellij.plugins.m68k.refs
import com.intellij.navigation.ChooseByNameContributor
import com.intellij.navigation.NavigationItem
import com.intellij.openapi.project.Project
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil.findAllGlobalLabels
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil.findAllSymbolDefinitions
class M68kChooseByNameContributor : ChooseByNameContributor {
override fun getNames(project: Project, includeNonProjectItems: Boolean): Array<String> {
return listOf(findAllGlobalLabels(project), findAllSymbolDefinitions(project))
.asSequence()
.flatten()
.mapNotNull { it.name }
.toList()
.toTypedArray()
}
override fun getItemsByName(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean): Array<NavigationItem> {
return listOf(findAllGlobalLabels(project), findAllSymbolDefinitions(project))
.flatten()
.toTypedArray()
}
}

View File

@ -29,6 +29,7 @@
implementationClass="de.platon42.intellij.plugins.m68k.refs.M68kSymbolReferenceElementManipulator"/>
<psi.referenceContributor implementation="de.platon42.intellij.plugins.m68k.refs.M68kReferenceContributor"/>
<gotoSymbolContributor implementation="de.platon42.intellij.plugins.m68k.refs.M68kChooseByNameContributor"/>
<renameInputValidator implementation="de.platon42.intellij.plugins.m68k.psi.M68kRenameInputValidator"/>
</extensions>