Custom Language Tutorial/Reference crosslinks

This commit is contained in:
Yann Cébron 2020-05-14 12:26:50 +02:00
parent 73f93d4951
commit fcc08c9ef4
15 changed files with 47 additions and 15 deletions

View File

@ -62,6 +62,9 @@ If the block before the cursor is incomplete (contains elements that the user wi
**New in IntelliJ IDEA 13**:
Code formatting can be suppressed per region via [special comments](https://youtrack.jetbrains.com/issue/IDEA-56995#comment=27-605969).
**Example**:
[Custom Language Support Tutorial: Formatter](/tutorials/custom_language_support/formatter.md)
### Code Style Settings
To specify the default indent size for the language provided by your plugin, and to allow the user to configure the tab size and indent size you need to implement the
@ -69,6 +72,9 @@ To specify the default indent size for the language provided by your plugin, and
interface and to register the implementation in the `com.intellij.fileTypeIndentOptionsProvider` extension point.
The return value of `createIndentOptions()` determines the default indent size.
**Example**:
[Custom Language Support Tutorial: Code Style Settings](/tutorials/custom_language_support/code_style_settings.md)
### Rearranger
**New in IntelliJ IDEA 12:**

View File

@ -33,7 +33,7 @@ provides better performance (because of its support for incremental analysis) an
The code intentions for custom languages also use the regular API for intentions.
The intention classes need to implement the
[`IntentionAction`](upsource:///platform/analysis-api/src/com/intellij/codeInsight/intention/IntentionAction.java)
interface and are registered using the `com.intellij.intentionAction` extension point in `plugin.xml`.
interface and are registered using the `com.intellij.intentionAction` extension point.
**Examples:**
- [Code Intentions Tutorial](/tutorials/code_intentions.md)

View File

@ -3,9 +3,11 @@ title: 7. Annotator
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
An [Annotator](/reference_guide/custom_language_support/syntax_highlighting_and_error_highlighting.md#annotator) helps highlight and annotate any code based on specific rules.
An `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.
**Reference**: [Annotator](/reference_guide/custom_language_support/syntax_highlighting_and_error_highlighting.md#annotator)
* bullet list
{:toc}

View File

@ -1,12 +1,14 @@
---
title: 16. Code Style Setting
title: 16. Code Style Settings
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
[Code style settings](/reference_guide/custom_language_support/code_formatting.md#code-style-settings) enable defining formatting options.
Code style settings enable defining formatting options.
A code style settings provider creates an instance of the settings and also creates an options page in settings/preferences.
This example creates a settings/preferences page that uses the default language code style settings, customized by a language code style settings provider.
**Reference**: [Code Style Settings](/reference_guide/custom_language_support/code_formatting.md#code-style-settings)
* bullet list
{:toc}

View File

@ -3,9 +3,11 @@ title: 9. Completion Contributor
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
Custom languages provide code completion using one of [two approaches](/reference_guide/custom_language_support/code_completion.md).
Custom languages provide code completion using one of two approaches: Contributor and Reference-based completion.
The Simple Language plugin implements the less complex of the two methods, reference completion.
**Reference**: [Code Completion](/reference_guide/custom_language_support/code_completion.md)
* bullet list
{:toc}

View File

@ -3,9 +3,11 @@ title: 11. Find Usages Provider
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
A [find usage provider](/reference_guide/custom_language_support/find_usages.md) uses a word scanner to build an index of words in every file.
A `FindUsagesProvider` uses a word scanner to build an index of words in every file.
A scanner breaks the text into words and defines the context for each word.
**Reference**: [Find Usages](/reference_guide/custom_language_support/find_usages.md)
* bullet list
{:toc}

View File

@ -4,9 +4,11 @@ title: 15. Formatter
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
The IntelliJ Platform includes a powerful framework for implementing formatting for custom languages.
A [formatter](/reference_guide/custom_language_support/code_formatting.md) enables reformatting code automatically based on code style settings.
A formatter enables reformatting code automatically based on code style settings.
The formatter controls spaces, indents, wrap, and alignment.
**Reference**: [Code Formatter](/reference_guide/custom_language_support/code_formatting.md)
* bullet list
{:toc}

View File

@ -5,6 +5,8 @@ title: 13. Go To Symbol Contributor
A _Go to Symbol Contributor_ helps the user to navigate to any PSI element by its name.
**Reference**: [Go to Class and Go to Symbol](/reference_guide/custom_language_support/go_to_class_and_go_to_symbol.md)
* bullet list
{:toc}

View File

@ -3,9 +3,11 @@ title: 3. Grammar and Parser
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
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).
In order for the IntelliJ Platform to parse a Simple Language file, tokens and elements 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.
**Reference**: [Implementing a Parser and PSI](/reference_guide/custom_language_support/implementing_parser_and_psi.md)
* bullet item
{:toc}

View File

@ -3,10 +3,12 @@ title: 2. Language and File Type
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
The IntelliJ Platform [determines file type](/reference_guide/custom_language_support/registering_file_type.md) by examining the name of a file.
The IntelliJ Platform determines file type by examining the name of a file.
Each language has [Language](upsource:///platform/core-api/src/com/intellij/lang/Language.java) and [LanguageFileType](upsource:///platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java) objects defining the language.
Register the `LanguageFileType` with the IntelliJ Platform in the plugin configuration file.
**Reference**: [Registering a File Type](/reference_guide/custom_language_support/registering_file_type.md)
* bullet item
{:toc}

View File

@ -3,9 +3,11 @@ title: 4. Lexer and Parser Definition
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
The lexical analyzer defines how the [contents of a file are broken into tokens](/reference_guide/custom_language_support/implementing_lexer.md), which is the basis for supporting custom language features.
The lexical analyzer defines how the contents of a file are broken into tokens, which is the basis for supporting custom language features.
The easiest way to create a lexer is to use [JFlex](https://jflex.de/).
**Reference**: [Implementing Lexer](/reference_guide/custom_language_support/implementing_lexer.md)
* bullet item
{:toc}

View File

@ -6,6 +6,8 @@ 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.
**Reference**: [Code Inspections and Intentions](/reference_guide/custom_language_support/code_inspections_and_intentions.md)
* bullet list
{:toc}

View File

@ -3,11 +3,13 @@ title: 10. Reference Contributor
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
The [References functionality](/reference_guide/custom_language_support/references_and_resolve.md) is one of the most important parts in the implementation of custom language support.
The references functionality is one of the most important parts in the implementation of custom language support.
Resolving references means the ability to go from the usage of an element to its declaration, completion, rename refactoring, find usages, etc.
> **Note** Every PSI element that can be renamed or referenced needs to implement [`PsiNamedElement`](upsource:///platform/core-api/src/com/intellij/psi/PsiNamedElement.java) interface.
**Reference**: [References and Resolve](/reference_guide/custom_language_support/references_and_resolve.md)
* bullet list
{:toc}

View File

@ -3,8 +3,10 @@ title: 14. Structure View Factory
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
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.
The structure view can be customized for a specific file type.
Creating a structure view factory allows showing the structure of any file in a _Structure_ Tool Window for easy navigation between items in the current editor.
**Reference**: [Structure View](/reference_guide/custom_language_support/structure_view.md)
* bullet list
{:toc}

View File

@ -3,10 +3,12 @@ title: 5. Syntax Highlighter and Color Settings Page
---
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
The first level of [syntax highlighting](/reference_guide/custom_language_support/syntax_highlighting_and_error_highlighting.md#lexer) is based on the lexer output, and is provided by `SyntaxHighlighter`.
A plugin can also define [color settings](/reference_guide/custom_language_support/syntax_highlighting_and_error_highlighting.md#color-settings) based on `ColorSettingPage` so the user can configure highlight colors.
The first level of syntax highlighting is based on the lexer output, and is provided by `SyntaxHighlighter`.
A plugin can also define color settings based on `ColorSettingPage` so the user can configure highlight colors.
The `SimpleSyntaxHighlighter`, `SimpleSyntaxHighlighterFactory`, and `SimpleColorSettingsPage` discussed on this page are demonstrated in the `simple_language_plugin` code sample.
**Reference**: [Syntax Highlighting and Error Highlighting](/reference_guide/custom_language_support/syntax_highlighting_and_error_highlighting.md)
* bullet list
{:toc}