Editorial cleanup

This commit is contained in:
JohnHake 2020-02-12 18:40:06 -08:00
parent 479ebabe33
commit 034dceba8c
26 changed files with 69 additions and 69 deletions

View File

@ -3,22 +3,22 @@ title: 7. Annotator
---
An [Annotator](/reference_guide/custom_language_support/syntax_highlighting_and_error_highlighting.md#annotator) helps highlight and annotate any code based on specific rules.
This section adds annotation functionality to support the Simple language in the context of Java code.
This section adds annotation functionality to support the Simple Language in the context of Java code.
* bullet list
{:toc}
## 7.1. Define an Annotator
The `SimpleAnnotator` subclasses [`Annotator`](upsource:///platform/analysis-api/src/com/intellij/lang/annotation/Annotator.java).
Consider a literal string that starts with "simple:" as a prefix of a Simple language key.
It isn't part of the Simple language, but it is a useful convention for detecting Simple language keys embedded as string literals in other languages, like Java.
Consider a literal string that starts with "simple:" as a prefix of a Simple Language key.
It isn't part of the Simple Language, but it is a useful convention for detecting Simple Language keys embedded as string literals in other languages, like Java.
Annotate the `simple:key` literal expression, and differentiate between a well-formed vs. an unresolved property:
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java %}
```
## 7.2. Register the Annotator
Using an extension point, register the Simple language annotator class with the IntelliJ Platform:
Using an extension point, register the Simple Language annotator class with the IntelliJ Platform:
```xml
<extensions defaultExtensionNs="com.intellij">
<annotator language="JAVA" implementationClass="org.intellij.sdk.language.SimpleAnnotator"/>
@ -26,7 +26,7 @@ Using an extension point, register the Simple language annotator class with the
```
## 7.3. Run the Project
As a test, define the following Java file containing a Simple language `prefix:value` pair:
As a test, define the following Java file containing a Simple Language `prefix:value` pair:
```java
public class Test {
public static void main(String[] args) {
@ -43,4 +43,4 @@ If the property is an undefined name, the annotator flags the code with an error
![Unresolved property](img/unresolved_property.png){:width="800px"}
Try changing the Simple language [color settings](/tutorials/custom_language_support/syntax_highlighter_and_color_settings_page.md#run-the-project-1) to differentiate the annotation from the default language color settings.
Try changing the Simple Language [color settings](/tutorials/custom_language_support/syntax_highlighter_and_color_settings_page.md#run-the-project-1) to differentiate the annotation from the default language color settings.

View File

@ -10,14 +10,14 @@ This example creates a settings/preferences page that uses the default language
{:toc}
## 16.1. Define Code Style Settings
Define a code style settings for Simple language by subclassing [`CustomCodeStyleSettings`](upsource:///platform/lang-api/src/com/intellij/psi/codeStyle/CustomCodeStyleSettings.java).
Define a code style settings for Simple Language by subclassing [`CustomCodeStyleSettings`](upsource:///platform/lang-api/src/com/intellij/psi/codeStyle/CustomCodeStyleSettings.java).
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettings.java %}
```
## 16.2. Define Code Style Settings Provider
The code style settings provider gives the IntelliJ Platform a standard way to instantiate `CustomCodeStyleSettings` for the Simple language.
Define a code style settings provider for Simple language by subclassing [`CodeStyleSettingsProvider`](upsource:///platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsProvider.java).
The code style settings provider gives the IntelliJ Platform a standard way to instantiate `CustomCodeStyleSettings` for the Simple Language.
Define a code style settings provider for Simple Language by subclassing [`CodeStyleSettingsProvider`](upsource:///platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsProvider.java).
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettingsProvider.java %}
```
@ -31,7 +31,7 @@ The `SimpleCodeStyleSettingsProvider` implementation is registered with the Inte
```
## 16.4. Define the Language Code Style Settings Provider
Define a code style settings provider for Simple language by subclassing [`LanguageCodeStyleSettingsProvider`](upsource:///platform/lang-api/src/com/intellij/psi/codeStyle/LanguageCodeStyleSettingsProvider.java), which provides common code style settings for a specific language.
Define a code style settings provider for Simple Language by subclassing [`LanguageCodeStyleSettingsProvider`](upsource:///platform/lang-api/src/com/intellij/psi/codeStyle/LanguageCodeStyleSettingsProvider.java), which provides common code style settings for a specific language.
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguageCodeStyleSettingsProvider.java %}
```
@ -46,6 +46,6 @@ The `SimpleLanguageCodeStyleSettingsProvider` implementation is registered with
```
## 16.6. Run the project
In the IDE Development Instance, open the Simple language code formatting page: **Preferences/Settings \| Editor \| Code Style \| Simple**.
In the IDE Development Instance, open the Simple Language code formatting page: **Preferences/Settings \| Editor \| Code Style \| Simple**.
![Code Style Settings](img/code_style_settings.png)

View File

@ -9,7 +9,7 @@ The [`Commenter`](upsource:///platform/core-api/src/com/intellij/lang/Commenter.
{:toc}
## 17.1. Define a Commenter
The Simple language commenter subclasses `Commenter`.
The Simple Language commenter subclasses `Commenter`.
This commenter defines the line comment prefix as "#".
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCommenter.java %}

View File

@ -3,13 +3,13 @@ title: 9. Completion Contributor
---
Custom languages provide code completion using one of [two approaches](/reference_guide/custom_language_support/code_completion.md).
The Simple language plugin implements the less complex of the two methods, reference completion.
The Simple Language plugin implements the less complex of the two methods, reference completion.
* bullet list
{:toc}
## 9.1. Define a Completion Contributor
For this tutorial, the `simple_language_plugin` provides custom completion for values in Simple language property files.
For this tutorial, the `simple_language_plugin` provides custom completion for values in Simple Language property files.
Create a completion contributor by subclassing [`CompletionContributor`](upsource:///platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java).
This rudimentary completion contributor always adds "Hello" to the results set, regardless of context:
```java

View File

@ -4,7 +4,7 @@ title: 12. Folding Builder
A folding builder identifies the folding regions in the code.
In this step of the tutorial, the folding builder is used to identify folding regions and replace the regions with specific text.
Rather than the usual practice of using a folding builder to collapse a class, method, or comments to fewer lines, the folding builder replaces Simple language keys with their corresponding values.
Rather than the usual practice of using a folding builder to collapse a class, method, or comments to fewer lines, the folding builder replaces Simple Language keys with their corresponding values.
* bullet list
{:toc}
@ -18,9 +18,9 @@ Note that `SimpleFoldingBuilder` also implements [`DumbAware`](upsource:///platf
> **NOTE** A folding builder must implement [`DumbAware`](upsource:///platform/core-api/src/com/intellij/openapi/project/DumbAware.java) to function in this tutorial and pass tests.
The `buildFoldRegions()` method searches down a PSI tree from `root` to find all literal expressions containing the [simple prefix](/tutorials/custom_language_support/annotator.md#define-an-annotator) `simple:`.
The remainder of such a string is expected to contain a Simple language key, and so the text range is stored as a [`FoldingDescriptor`](upsource:///platform/core-api/src/com/intellij/lang/folding/FoldingDescriptor.java).
The remainder of such a string is expected to contain a Simple Language key, and so the text range is stored as a [`FoldingDescriptor`](upsource:///platform/core-api/src/com/intellij/lang/folding/FoldingDescriptor.java).
The `getPlaceholderText()` method retrieves the Simple language value corresponding to the key associated with the (ASTNode) provided.
The `getPlaceholderText()` method retrieves the Simple Language value corresponding to the key associated with the (ASTNode) provided.
The IntelliJ Platform uses the value to substitute for the key when the code gets folded.
```java

View File

@ -2,8 +2,8 @@
title: 3. Grammar and Parser
---
In order for the IntelliJ Platform to parse a Simple language file, [tokens and elements](/reference_guide/custom_language_support/implementing_parser_and_psi.md) must be defined based on [`IElementType`](upsource:///platform/core-api/src/com/intellij/psi/tree/IElementType.java).
The Simple language grammar must also be defined to generate a parser.
In order for the IntelliJ Platform to parse a Simple Language file, [tokens and elements](/reference_guide/custom_language_support/implementing_parser_and_psi.md) must be defined based on [`IElementType`](upsource:///platform/core-api/src/com/intellij/psi/tree/IElementType.java).
The Simple Language grammar must also be defined to generate a parser.
* bullet item
{:toc}
@ -21,7 +21,7 @@ Create the `SimpleElementType` in the `org.intellij.sdk.language.psi` package by
```
## 3.3. Define the Grammar
Define a grammar for the Simple language in the `com/intellij/sdk/language/Simple.bnf` file.
Define a grammar for the Simple Language in the `com/intellij/sdk/language/Simple.bnf` file.
```java
{
parserClass="org.intellij.sdk.language.parser.SimpleParser"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB

After

Width:  |  Height:  |  Size: 423 KiB

View File

@ -17,15 +17,15 @@ The `SimpleLanguage` class is defined in the `org.intellij.sdk.language` package
```
## 2.2. Define an Icon
The [icon](https://raw.githubusercontent.com/JetBrains/intellij-sdk-docs/master/code_samples/simple_language_plugin/src/com/simpleplugin/icons/jar-gray.png) for the Simple language is defined by the `SimpleIcons` class.
There is nothing uniquely Simple language-specific about [defining the icon](/reference_guide/work_with_icons_and_images.md) itself.
The [icon](https://raw.githubusercontent.com/JetBrains/intellij-sdk-docs/master/code_samples/simple_language_plugin/src/com/simpleplugin/icons/jar-gray.png) for the Simple Language is defined by the `SimpleIcons` class.
There is nothing uniquely Simple Language-specific about [defining the icon](/reference_guide/work_with_icons_and_images.md) itself.
The definition follows a pattern similar to defining, e.g., `SdkIcons`.
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleIcons.java %}
```
## 2.3. Define a FileType
The Simple language file type is defined by subclassing [`LanguageFileType`](upsource:///platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java):
The Simple Language file type is defined by subclassing [`LanguageFileType`](upsource:///platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java):
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFileType.java %}
```
@ -62,6 +62,6 @@ 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.
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.
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

@ -9,7 +9,7 @@ The easiest way to create a lexer is to use [JFlex](https://jflex.de/)
{:toc}
## 4.1. Define a Lexer
Define a `Simple.flex` file with rules for the Simple language lexer, as demonstrated in `org.intellij.sdk.language.Simple.flex`.
Define a `Simple.flex` file with rules for the Simple Language lexer, as demonstrated in `org.intellij.sdk.language.Simple.flex`.
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/Simple.flex %}
```
@ -33,13 +33,13 @@ This is done by subclassing [`FlexAdapter`](upsource:///platform/core-api/src/co
```
## 4.4. Define a Root File
The `SimpleFile` implementation is the top-level node of the [tree of `PsiElements`](/reference_guide/custom_language_support/implementing_parser_and_psi.md) for a Simple language file.
The `SimpleFile` implementation is the top-level node of the [tree of `PsiElements`](/reference_guide/custom_language_support/implementing_parser_and_psi.md) for a Simple Language file.
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleFile.java %}
```
## 4.5. Define a Parser
The Simple language parser is defined by subclassing [`ParserDefinition`](upsource:///platform/core-api/src/com/intellij/lang/ParserDefinition.java).
The Simple Language parser is defined by subclassing [`ParserDefinition`](upsource:///platform/core-api/src/com/intellij/lang/ParserDefinition.java).
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleParserDefinition.java %}
```

View File

@ -9,11 +9,11 @@ These markers can provide navigation targets to related code.
{:toc}
## 8.1. Define a Line Marker Provider
A line marker provider annotates usages of Simple language properties within Java code and provides navigation to the definition of these properties.
The visual marker is a Simple language icon in the gutter of the Editor window.
A line marker provider annotates usages of Simple Language properties within Java code and provides navigation to the definition of these properties.
The visual marker is a Simple Language icon in the gutter of the Editor window.
The Simple language marker provider subclasses [`RelatedItemLineMarkerProvider`](upsource:///platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerProvider.java).
For this example, override the `collectNavigationMarkers()` method to collect usage of a Simple language [key and separators](/tutorials/custom_language_support/language_and_filetype.md#define-the-language):
The Simple Language marker provider subclasses [`RelatedItemLineMarkerProvider`](upsource:///platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerProvider.java).
For this example, override the `collectNavigationMarkers()` method to collect usage of a Simple Language [key and separators](/tutorials/custom_language_support/language_and_filetype.md#define-the-language):
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLineMarkerProvider.java %}
```

View File

@ -3,15 +3,15 @@ title: 18. Quick Fix
---
A quick fix for a custom language supports the IntelliJ Platform-based IDE feature [Intention Actions](https://www.jetbrains.com/help/idea/intention-actions.html#apply-intention-actions).
For the Simple language, this tutorial adds a quick fix that helps to define an unresolved property from its usage.
For the Simple Language, this tutorial adds a quick fix that helps to define an unresolved property from its usage.
* bullet list
{:toc}
## 18.1. Update the Element Factory
The `SimpleElementFactory` is updated to include two new methods to support the user choice of creating a new property for the Simple language quick fix.
The `SimpleElementFactory` is updated to include two new methods to support the user choice of creating a new property for the Simple Language quick fix.
The new `createCRLF()` method supports adding a newline to the end of the [`test.simple`](/tutorials/custom_language_support/lexer_and_parser_definition.md#run-the-project) file before adding a new property.
A new overload of `createProperty()` creates a new `key`-`value` pair for Simple language.
A new overload of `createProperty()` creates a new `key`-`value` pair for Simple Language.
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementFactory.java %}
```

View File

@ -11,14 +11,14 @@ Resolving references means the ability to go from the usage of an element to its
{: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 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).
![SimpleNamedElementImpl class hierarchy](img/simple_named_element.png){:width="400px"}
## 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.
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.
```java
@ -98,7 +98,7 @@ The latter enables the reference to resolve to more than one element or to resol
```
## 10.6. Define a Reference Contributor
A reference contributor allows the `simple_language_plugin` to provide references to Simple language from elements in other languages such as Java.
A reference contributor allows the `simple_language_plugin` to provide references to Simple Language from elements in other languages such as Java.
Create `SimpleReferenceContributor` by subclassing [`PsiReferenceContributor`](upsource:///platform/core-api/src/com/intellij/psi/PsiReferenceContributor.java).
Contribute a reference to each usage of a property:
```java

View File

@ -2,7 +2,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.
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.
* bullet list
@ -43,6 +43,6 @@ The `SimpleStructureViewFactory` implementation is registered with the IntelliJ
## 14.5. Run the Project
Rebuild the project, and run `simple_language_plugin` in a Development Instance.
Open the `test.simple` file and choose **View \| Tool Windows \| Structure**.
The IDE now supports a structure view of the Simple language:
The IDE now supports a structure view of the Simple Language:
![Structure View](img/structure_view.png){:width="800px"}

View File

@ -10,15 +10,15 @@ The `SimpleSyntaxHighlighter`, `SimpleSyntaxHighlighterFactory`, and `SimpleColo
{:toc}
## 5.1. Define a Syntax Highlighter
The Simple language syntax highlighter class extends [`SyntaxHighlighterBase`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterBase.java).
As recommended in [Color Scheme Management](/reference_guide/color_scheme_management.md#text-attribute-key-dependency), the Simple language highlighting text attributes are specified as a dependency on one of standard Intellij Platform keys.
For the Simple language, define only one scheme.
The Simple Language syntax highlighter class extends [`SyntaxHighlighterBase`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterBase.java).
As recommended in [Color Scheme Management](/reference_guide/color_scheme_management.md#text-attribute-key-dependency), the Simple Language highlighting text attributes are specified as a dependency on one of standard Intellij Platform keys.
For the Simple Language, define only one scheme.
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighter.java %}
```
### 5.2. Define a Syntax Highlighter Factory
The factory provides a standard way for the IntelliJ Platform to instantiate the syntax highlighter for Simple language files.
The factory provides a standard way for the IntelliJ Platform to instantiate the syntax highlighter for Simple Language files.
Here, `SimpleSyntaxHighlighterFactory` subclasses [`SyntaxHighlighterFactory`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterFactory.java).
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighterFactory.java %}
@ -40,14 +40,14 @@ The colors for Simple Language Key, Separator, and Value highlighting default to
![Syntax highlighter](img/syntax_highlighter.png){:width="800px"}
## 5.5. Define a Color Settings Page
The color settings page adds the ability for users to customize color settings for the highlighting in Simple language files.
The color settings page adds the ability for users to customize color settings for the highlighting in Simple Language files.
The `SimpleColorSettingsPage` implements [`ColorSettingsPage`](upsource:///platform/lang-api/src/com/intellij/openapi/options/colors/ColorSettingsPage.java).
```java
{% include /code_samples/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleColorSettingsPage.java %}
```
### 5.6. Register the Color Settings Page
The settings page for Simple language colors gets registered as an extension in the plugin configuration file.
The settings page for Simple Language colors gets registered as an extension in the plugin configuration file.
```xml
<extensions defaultExtensionNs="com.intellij">
<colorSettingsPage implementation="org.intellij.sdk.language.SimpleColorSettingsPage"/>
@ -55,7 +55,7 @@ The settings page for Simple language colors gets registered as an extension in
```
### 5.7. Run the project
In the IDE Development Instance, open the Simple language highlight settings page: **Preferences/Settings \| Editor \| Color Scheme \| Simple**.
In the IDE Development Instance, open the Simple Language highlight settings page: **Preferences/Settings \| Editor \| Color Scheme \| Simple**.
Each color initially inherits from a _Language Defaults_ value.
![Color Settings Page](img/color_settings_page.png){:width="800px"}

View File

@ -2,14 +2,14 @@
title: 4. Annotator Test
---
This test checks if the Simple language annotator functionality, implemented in the [Annotator](/tutorials/custom_language_support/annotator.md) section of the Custom Language Support Tutorial, works as expected.
This test checks if the Simple Language annotator functionality, implemented in the [Annotator](/tutorials/custom_language_support/annotator.md) section of the Custom Language Support Tutorial, works as expected.
## 4.1. Define Input Test Data
The `DefaultTestData.simple` properties file is reused for this test.
Create an input test file `AnnotatorTestData.java` in the `testData` directory.
This file contains two instances of Simple language embedded in the Java code.
The first instance is a valid use of the `simple:` prefix followed by the Simple language key `website`.
This file contains two instances of Simple Language embedded in the Java code.
The first instance is a valid use of the `simple:` prefix followed by the Simple Language key `website`.
The second is a valid prefix but an invalid key, as noted by the test `<error>` [highlighting](/basics/testing_plugins/testing_highlighting.md).
```java
public class Test {

View File

@ -4,9 +4,9 @@ title: 9. Commenter Test
This test will check if the commenter, implemented in the [Commenter](/tutorials/custom_language_support/commenter.md) section of the Custom Language Support Tutorial, works as expected.
### 9.1. Define a Test Method
## 9.1. Define a Test Method
Add the `testCommenter()` method to the `SimpleCodeInsightTest` class [previously defined](completion_test.md#define-a-test).
This test constructs a Simple language properties file containing one line, with the virtual caret positioned at the beginning of the line.
This test constructs a Simple Language properties file containing one line, with the virtual caret positioned at the beginning of the line.
The test calls the commenter to insert a comment character at the caret, then verifies the results.
It again calls the line comment action to remove the comment character and verifies the results.
@ -21,5 +21,5 @@ It again calls the line comment action to remove the comment character and verif
}
```
### 9.2. Run the Test
## 9.2. Run the Test
[Run](completion_test.md#run-the-test) the test and make sure it's green.

View File

@ -2,7 +2,7 @@
title: 3. Completion Test
---
This test checks if the Simple language code completion functionality, implemented in the [Reference Contributor](/tutorials/custom_language_support/reference_contributor.md) section of the Custom Language Support Tutorial, works as expected.
This test checks if the Simple Language code completion functionality, implemented in the [Reference Contributor](/tutorials/custom_language_support/reference_contributor.md) section of the Custom Language Support Tutorial, works as expected.
## 3.1. Define Test Data
Create the `DefaultTestData.simple` properties file in the `testData` directory.
@ -12,7 +12,7 @@ Create the `DefaultTestData.simple` properties file in the `testData` directory.
```
Create a test input Java file `CompleteTestData.java` in the `testData` directory.
This file contains a Simple language snippet within the Java.
This file contains a Simple Language snippet within the Java.
```java
{% include /code_samples/simple_language_plugin/src/test/testData/CompleteTestData.java %}
```
@ -25,8 +25,8 @@ At this point only one test is defined in `SimpleCodeInsightTest`: `testCompleti
This method:
* Configures the test using the two input files.
* Calls the basic completion functionality.
Behind the scenes, this method call creates a list of possible elements to complete the embedded Simple language reference.
* Checks the list of possible element names to ensure it contains all Simple language completion possibilities.
Behind the scenes, this method call creates a list of possible elements to complete the embedded Simple Language reference.
* Checks the list of possible element names to ensure it contains all Simple Language completion possibilities.
```java
public class SimpleCodeInsightTest extends LightJavaCodeInsightFixtureTestCase {

View File

@ -4,14 +4,14 @@ title: 8. Find Usages Test
This test ensures the find usages provider, implemented in the [Find Usages Provider](/tutorials/custom_language_support/find_usages_provider.md) section of the Custom Language Support Tutorial, works correctly.
## 8.1. Define test data
## 8.1. Define the Test Data
Create the `FindUsagesTestData.simple` properties file in the `testData` directory.
```bash
{% include /code_samples/simple_language_plugin/src/test/testData/FindUsagesTestData.simple %}
```
Create the test file `FindUsagesTestData.java`, which contains one embedded Simple language prefix and key.
Create the test file `FindUsagesTestData.java`, which contains one embedded Simple Language prefix and key.
```java
{% include /code_samples/simple_language_plugin/src/test/testData/FindUsagesTestData.java %}

View File

@ -2,7 +2,7 @@
title: 7. Folding Test
---
This test verifies the Simple language folding builder, implemented in the [Folding Builder](/tutorials/custom_language_support/folding_builder.md) section of the Custom Language Support Tutorial, works as expected.
This test verifies the Simple Language folding builder, implemented in the [Folding Builder](/tutorials/custom_language_support/folding_builder.md) section of the Custom Language Support Tutorial, works as expected.
> **NOTE** A folding builder must implement [`DumbAware`](upsource:///platform/core-api/src/com/intellij/openapi/project/DumbAware.java) to pass tests. See [Define a Folding Builder](/tutorials/custom_language_support/folding_builder.md#define-a-folding-builder) for more information.

View File

@ -2,7 +2,7 @@
title: 5. Formatter Test
---
This test checks if the Simple language formatter, implemented in the [Formatter](/tutorials/custom_language_support/formatter.md) section of the Custom Language Support Tutorial, works as expected.
This test checks if the Simple Language formatter, implemented in the [Formatter](/tutorials/custom_language_support/formatter.md) section of the Custom Language Support Tutorial, works as expected.
## 5.1. Define Test Data
Create the `FormatterTestData.simple` properties file in the `testData` directory.
@ -14,7 +14,7 @@ Create the `FormatterTestData.simple` properties file in the `testData` director
## 5.2. Define a Test Method
Add the `testFormatter()` method to the `SimpleCodeInsightTest` class [previously defined](completion_test.md#define-a-test).
* Again, this method configures the test fixture by using the test file.
* The code style Simple language settings for spaces and blank lines are set.
* The code style Simple Language settings for spaces and blank lines are set.
* The file is then formatted according to the settings.
* The formatted file is compared to the expected results in the benchmark file `DefaultTestData.simple`.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 335 KiB

View File

@ -2,7 +2,7 @@
title: 2. Parsing Test
---
The first test checks if the Simple language parser, implemented in the [Lexer and Parser Definition](/tutorials/custom_language_support/lexer_and_parser_definition.md) section of the Custom Language Support Tutorial, works as expected.
The first test checks if the Simple Language parser, implemented in the [Lexer and Parser Definition](/tutorials/custom_language_support/lexer_and_parser_definition.md) section of the Custom Language Support Tutorial, works as expected.
## 2.1. Update Grammar and Regenerate the Parser
Before creating the parsing test, ensure the parser definition (`Simple.bnf`) includes the lines shown below.
@ -45,13 +45,13 @@ Create a file *ParsingTestData.txt* with the copied PSI tree.
{% include /code_samples/simple_language_plugin/src/test/testData/ParsingTestData.txt %}
```
## 2.4. Define a parsing test
## 2.4. Define a Parsing Test
Subclass [`ParsingTestCase`](upsource:///platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java) to create `SimpleParsingTest`:
```java
{% include /code_samples/simple_language_plugin/src/test/java/org/intellij/sdk/language/SimpleParsingTest.java %}
```
## 2.5. Run the test
## 2.5. Run the Test
Run the test by:
* Opening the Gradle Tool Window.
* Drill down to the `simple_language_plugin`.

View File

@ -5,10 +5,10 @@ title: 10. Reference Test
This test checks if references functionality, implemented in the [Reference Contributor](/tutorials/custom_language_support/reference_contributor.md) section of the Custom Language Support Tutorial, works as expected.
## 10.1. Define Test Data
This test reuses the Simple language properties file `DefaultTestData.simple`.
This test reuses the Simple Language properties file `DefaultTestData.simple`.
Create the test file `ReferenceTestData.java` in the `testData` directory.
This file has one Simple language prefix and key, with the caret placed after the key.
This file has one Simple Language prefix and key, with the caret placed after the key.
```java
{% include /code_samples/simple_language_plugin/src/test/testData/ReferenceTestData.java %}

View File

@ -2,7 +2,7 @@
title: 6. Rename Test
---
This test verifies the Simple language in-place rename functionality, implemented in the [Reference Contributor](/tutorials/custom_language_support/reference_contributor.md) section of the Custom Language Support Tutorial, works as expected.
This test verifies the Simple Language in-place rename functionality, implemented in the [Reference Contributor](/tutorials/custom_language_support/reference_contributor.md) section of the Custom Language Support Tutorial, works as expected.
## 6.1. Define Input Test Data
Create the `RenameTestData.simple` properties file in the `testData` directory.
@ -12,7 +12,7 @@ Create the `RenameTestData.simple` properties file in the `testData` directory.
```
Create the file `RenameTestData.java` in the `testData` directory.
This file contains one Simple language reference embedded in Java, with the [caret position](/basics/testing_plugins/test_project_and_testdata_directories.md#special-markup) placed just after a Simple language key.
This file contains one Simple Language reference embedded in Java, with the [caret position](/basics/testing_plugins/test_project_and_testdata_directories.md#special-markup) placed just after a Simple Language key.
```java
{% include /code_samples/simple_language_plugin/src/test/testData/RenameTestData.java %}
@ -30,7 +30,7 @@ Note the `website =` in `RenameTestData.simple` should be renamed to `websiteUrl
## 6.3. Define a Test Method
Add the `testRename()` method to the `SimpleCodeInsightTest` class [previously defined](completion_test.md#define-a-test).
* Again, this method configures the test fixture by using the test files.
* The fixture then renames the Simple language element at the caret in `RenameTestData.java`.
* The fixture then renames the Simple Language element at the caret in `RenameTestData.java`.
* It then compares the input and output property files, ignoring whitespace.
```java