Clarify EPs

This commit is contained in:
JohnHake 2020-02-13 13:43:25 -08:00
parent 59a4610efe
commit d3a7850018
21 changed files with 35 additions and 32 deletions

View File

@ -28,7 +28,7 @@ dependencies {
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version '2019.3.2'
version '2019.3.3'
plugins 'java'
updateSinceUntilBuild = false
}

View File

@ -1,5 +1,3 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.intellij.sdk.language;
import com.intellij.formatting.*;

View File

@ -1,5 +1,3 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.intellij.sdk.language.psi.impl;
import com.intellij.extapi.psi.ASTWrapperPsiElement;

View File

@ -18,7 +18,7 @@ Annotate the `simple:key` literal expression, and differentiate between a well-f
```
## 7.2. Register the Annotator
Using an extension point, register the Simple Language annotator class with the IntelliJ Platform:
Using the `com.intellij.annotator` extension point in the plugin configuration file, register the Simple Language annotator class with the IntelliJ Platform:
```xml
<extensions defaultExtensionNs="com.intellij">
<annotator language="JAVA" implementationClass="org.intellij.sdk.language.SimpleAnnotator"/>

View File

@ -23,7 +23,7 @@ Define a code style settings provider for Simple Language by subclassing [`CodeS
```
## 16.3. Register the Code Style Settings Provider
The `SimpleCodeStyleSettingsProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `codeStyleSettingsProvider` extension point.
The `SimpleCodeStyleSettingsProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.codeStyleSettingsProvider` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<codeStyleSettingsProvider implementation="org.intellij.sdk.language.SimpleCodeStyleSettingsProvider"/>
@ -37,7 +37,7 @@ Define a code style settings provider for Simple Language by subclassing [`Langu
```
## 16.5. Register the Language Code Style Settings Provider
The `SimpleLanguageCodeStyleSettingsProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `langCodeStyleSettingsProvider` extension point.
The `SimpleLanguageCodeStyleSettingsProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.langCodeStyleSettingsProvider` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<langCodeStyleSettingsProvider

View File

@ -16,7 +16,7 @@ This commenter defines the line comment prefix as "#".
```
## 17.2. Register the Commenter
The `SimpleCommenter` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `lang.commenter` extension point.
The `SimpleCommenter` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.lang.commenter` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<lang.commenter language="Simple" implementationClass="org.intellij.sdk.language.SimpleCommenter"/>

View File

@ -17,7 +17,7 @@ This rudimentary completion contributor always adds "Hello" to the results set,
```
## 9.2. Register the Completion Contributor
The `SimpleCompletionContributor` implementation is registered in the plugin configuration file with the IntelliJ Platform using the `completion.contributor` extension point.
The `SimpleCompletionContributor` implementation is registered in the plugin configuration file with the IntelliJ Platform using the `com.intellij.completion.contributor` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<completion.contributor language="Simple"

View File

@ -17,7 +17,7 @@ See the comments in `FindUsagesProvider` for more information.
```
## 11.2. Register the Find Usages Provider
The `SimpleFindUsagesProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `lang.findUsagesProvider` extension point.
The `SimpleFindUsagesProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.lang.findUsagesProvider` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<lang.findUsagesProvider language="Simple"

View File

@ -11,7 +11,7 @@ Rather than the usual practice of using a folding builder to collapse a class, m
## 12.1. Define a Folding Builder
The `SimpleFoldingBuilder` replaces usages of properties with their values by default.
Start by subclassing [`FoldingBuilderEx`](upsource:///community/platform/core-api/src/com/intellij/lang/folding/FoldingBuilderEx.java)
Start by subclassing [`FoldingBuilderEx`](upsource:///platform/core-api/src/com/intellij/lang/folding/FoldingBuilderEx.java)
Note that `SimpleFoldingBuilder` also implements [`DumbAware`](upsource:///platform/core-api/src/com/intellij/openapi/project/DumbAware.java), which means the class is allowed to run in dumb mode, when indices are in background update.
@ -28,7 +28,7 @@ The IntelliJ Platform uses the value to substitute for the key when the code get
```
## 12.2. Register the Folding Builder
The `SimpleFoldingBuilder` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `lang.foldingBuilder` extension point.
The `SimpleFoldingBuilder` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.lang.foldingBuilder` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<lang.foldingBuilder language="JAVA"

View File

@ -27,7 +27,7 @@ Create `SimpleFormattingModelBuilder` by subclassing [`FormattingModelBuilder`](
```
## 15.3. Register the Formatter
The `SimpleFormattingModelBuilder` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `lang.formatter` extension point.
The `SimpleFormattingModelBuilder` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.lang.formatter` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<lang.formatter language="Simple"

View File

@ -54,7 +54,7 @@ To enable the `simple_language_plugin` to contribute items to **Navigate \| Clas
```
## 13.4. Register the Go To Symbol Contributor
The `SimpleChooseByNameContributor` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `gotoSymbolContributor` extension point.
The `SimpleChooseByNameContributor` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.gotoSymbolContributor` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<gotoSymbolContributor

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

View File

@ -61,7 +61,7 @@ The `SimpleFileTypeFactory` is registered with the IntelliJ Platform using the `
```
## 2.6. Run the Project
Create an empty file with the extension `\*.simple`, and IntelliJ IDEA automatically associates it with our language.
Create an empty file with the extension `*.simple`, and IntelliJ IDEA automatically associates it with our language.
Note the appearance of the Simple Language file icon next to the `test.simple` file in the **Project Tool Window**, and the editor tab for the file.
![File Type Factory](img/file_type_factory.png){:width="800px"}

View File

@ -46,7 +46,7 @@ The Simple Language parser is defined by subclassing [`ParserDefinition`](upsour
## 4.6. Register the Parser Definition
Registering the parser definition in the `plugin.xml` file makes it available to the IntelliJ Platform.
Use the `lang.parserDefinition` extension point for registration.
Use the `com.intellij.lang.parserDefinition` extension point for registration.
For example, see `simple_language_plugin/src/main/resources/META-INF/plugin.xml`.
```xml
<extensions defaultExtensionNs="com.intellij">

View File

@ -62,7 +62,7 @@ public class MyCorrectLineMarkerProvider implements LineMarkerProvider {
```
## 8.3. Register the Line Marker Provider
The `SimpleLineMarkerProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `codeInsight.lineMarkerProvider` extension point.
The `SimpleLineMarkerProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.codeInsight.lineMarkerProvider` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<codeInsight.lineMarkerProvider language="JAVA"

View File

@ -42,7 +42,7 @@ The parser generates the `SimpleProperty` interface referenced in the code above
## 6.2. Update Grammar and Regenerate the Parser
Now the utility class is added to the grammar file via the `psiImplUtilClass` attribute.
Add methods for a particular rule to specify which one should be used for PSI classes.
Compare the last line of the grammar below to the [previous definition](/tutorials/custom_language_support/grammar_and_parser.md#33-define-the-grammar).
Compare the last line of the grammar below to the [previous definition](/tutorials/custom_language_support/grammar_and_parser.md#define-the-grammar).
```java
{

View File

@ -10,16 +10,22 @@ Resolving references means the ability to go from the usage of an element to its
* bullet list
{:toc}
### 10.1. Define a Named Element Class
The simplified class diagram below shows how the Simple Language fulfills the need to implement `PsiNamedElement`.
The `SimpleNamedElement` interface is subclassed from [`PsiNameIdentifierOwner`]().
The `SimpleNamedElementImpl` class implements the `SimpleNamedElement` interface and extends [`ASTWrapperPsiElement`](upsource:///platform/core-impl/src/com/intellij/extapi/psi/ASTWrapperPsiElement.java).
## 10.1. Define a Named Element Class
The classes below show how the Simple Language fulfills the need to implement `PsiNamedElement`.
![SimpleNamedElementImpl class hierarchy](img/simple_named_element.png){:width="400px"}
The `SimpleNamedElement` interface is subclassed from [`PsiNameIdentifierOwner`](upsource:///platform/core-api/src/com/intellij/psi/PsiNameIdentifierOwner.java).
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleNamedElement.java %}
```
The `SimpleNamedElementImpl` class implements the `SimpleNamedElement` interface and extends [`ASTWrapperPsiElement`](upsource:///platform/core-impl/src/com/intellij/extapi/psi/ASTWrapperPsiElement.java).
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimpleNamedElementImpl.java %}
```
## 10.2. Define Helper Methods for Generated PSI Elements
Modify `SimplePsiImplUtil` to support new methods that get added to the PSI class for Simple Language.
Note that `SimpleElementFactory` isn't defined until the [next step](#103-define-an-element-factory), so for now it shows as an error.
Note that `SimpleElementFactory` isn't defined until the [next step](#define-an-element-factory), so for now it shows as an error.
```java
public class SimplePsiImplUtil {
@ -106,7 +112,7 @@ Contribute a reference to each usage of a property:
```
## 10.7. Register the Reference Contributor
The `SimpleReferenceContributor` implementation is registered with the IntelliJ Platform using the `psi.referenceContributor` extension point.
The `SimpleReferenceContributor` implementation is registered with the IntelliJ Platform using the `com.intellij.psi.referenceContributor` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<psi.referenceContributor implementation="org.intellij.sdk.language.SimpleReferenceContributor"/>
@ -132,7 +138,7 @@ As long as an element is a `SimpleProperty` it is allowed to be refactored:
```
## 10.10. Register the Refactoring Support Provider
The `SimpleRefactoringSupportProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `lang.refactoringSupport` extension point.
The `SimpleRefactoringSupportProvider` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.lang.refactoringSupport` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<lang.refactoringSupport language="Simple"

View File

@ -3,7 +3,7 @@ title: 14. Structure View Factory
---
The [structure view](/reference_guide/custom_language_support/structure_view.md) in the IntelliJ Platform-based IDE can be customized for a specific file type, including Simple Language.
Creating a structure view factory allows showing the structure of any file in a **Structure** tool window for easy navigation between items.
Creating a structure view factory allows showing the structure of any file in a **Structure** Tool Window for easy navigation between items.
* bullet list
{:toc}
@ -32,7 +32,7 @@ The `SortableTreeElement` represents an item in a smart tree that allows using t
```
## 14.4. Register the Structure View Factory
The `SimpleStructureViewFactory` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `lang.psiStructureViewFactory` extension point.
The `SimpleStructureViewFactory` implementation is registered with the IntelliJ Platform in the plugin configuration file using the `com.intellij.lang.psiStructureViewFactory` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<lang.psiStructureViewFactory language="Simple"

View File

@ -25,7 +25,7 @@ Here, `SimpleSyntaxHighlighterFactory` subclasses [`SyntaxHighlighterFactory`](u
```
### 5.3. Register the Syntax Highlighter Factory
Register the factory with the IntelliJ Platform in the plugin configuration file.
Register the factory with the IntelliJ Platform in the plugin configuration file using the `com.intellij.lang.syntaxHighlighterFactory` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<lang.syntaxHighlighterFactory language="Simple"
@ -47,7 +47,7 @@ The `SimpleColorSettingsPage` implements [`ColorSettingsPage`](upsource:///platf
```
### 5.6. Register the Color Settings Page
The settings page for Simple Language colors gets registered as an extension in the plugin configuration file.
Register the Simple Language color settings page with the IntelliJ Platform in the plugin configuration file using the `com.intellij.colorSettingsPage` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<colorSettingsPage implementation="org.intellij.sdk.language.SimpleColorSettingsPage"/>

View File

@ -18,7 +18,7 @@ This file contains a Simple Language snippet within the Java.
```
## 3.2. Define a Test
Subclass `LightJavaCodeInsightFixtureTestCase` to create `SimpleCodeInsightTest`.
Subclass [`LightJavaCodeInsightFixtureTestCase`](upsource:///java/testFramework/src/com/intellij/testFramework/fixtures/LightJavaCodeInsightFixtureTestCase.java) to create `SimpleCodeInsightTest`.
Override `getTestDataPath()`, and return the path from the root of this plugin module to the `testData` directory.
At this point only one test is defined in `SimpleCodeInsightTest`: `testCompletion()`.

View File

@ -47,6 +47,7 @@ Create a file *ParsingTestData.txt* with the copied PSI tree.
## 2.4. Define a Parsing Test
Subclass [`ParsingTestCase`](upsource:///platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java) to create `SimpleParsingTest`:
Override `getTestDataPath()`, and return the path from the root of this plugin module to the `testData` directory.
```java
{% include /code_samples/simple_language_plugin/src/test/java/org/intellij/sdk/language/SimpleParsingTest.java %}
```