2020-02-10 09:40:22 -08:00

1.5 KiB

title
11. Find Usages Provider

A find usage provider uses a word scanner to build an index of words in every file. A scanner breaks the text into words, defines the context for each word, and passes it to the find usage provider.

  • bullet list {:toc}

11.1. Define a Find Usages Provider

The SimpleFindUsagesProvider is implements FindUsagesProvider. Using the DefaultWordsScanner ensures the scanner implementation is thread-safe. See the comments in FindUsagesProvider for more information.

{% include /code_samples/simple_language/src/main/java/com/intellij/sdk/language/SimpleFindUsagesProvider.java %}

11.2. Register the Find Usages Provider

The SimpleFindUsagesProvider implementation is registered with the IntelliJ Platform using the lang.findUsagesProvider extension point.

  <extensions defaultExtensionNs="com.intellij">
    <lang.findUsagesProvider language="Simple" implementationClass="com.intellij.sdk.language.SimpleFindUsagesProvider"/>
  </extensions>

11.3. Run the Project

Rebuild the project, and run simple_language in a Development Instance. The IDE now supports Find Usages for any property with a reference:

Find Usages{:width="800px"}