additional_minor_features.md: rework

This commit is contained in:
Yann Cébron 2019-11-26 14:42:18 +01:00
parent 5f5e0014db
commit b089e453be

View File

@ -2,73 +2,119 @@
title: Additional Minor Features
---
A number of minor features are listed in the following format:
---
_EP: `fully.qualified.extensionPointName`_ - Extension Point Name (must be specified in `plugin.xml`)
_`com.extensionPoint.class`_ _description text_ - Extension Point class/interface to provide functionality
_- Sample 1_ - Sample implementation
---
### Brace Matching
EP: `com.intellij.lang.braceMatcher`
In order to implement *brace matching*, once the syntax highlighting lexer has been implemented, all that is required is to implement the
[PairedBraceMatcher](upsource:///platform/lang-api/src/com/intellij/lang/PairedBraceMatcher.java)
interface and to return an array of brace pairs (
Returns an array of brace pairs (
[BracePair](upsource:///platform/lang-api/src/com/intellij/lang/BracePair.java)
) for the language.
Each brace pair specifies the characters for the opening and closing braces and the lexer token types for these characters.
) specifying the characters for the opening and closing braces and the lexer token types for these characters.
(In principle, it is possible to return multi-character tokens, like "begin" and "end", as the start and end tokens of a brace pair.
The IDE will match such braces, but the highlighting for such braces will not be fully correct.)
Certain types of braces can be marked as structural.
Structural braces have higher priority than regular braces: they are matched with each other even if there are unmatched braces of other types between them, and an opening non-structural braces is not matched with a closing one if one of them is inside a pair of matched structural braces and another is outside.
Structural braces have higher priority than regular braces: they are matched with each other even if there are unmatched braces of other types between them.
An opening non-structural brace is not matched with a closing one if one of them is inside a pair of matched structural braces and another is outside.
### Comment Code
EP: `com.intellij.lang.commenter`
[Commenter](upsource:///platform/core-api/src/com/intellij/lang/Commenter.java)
Returns the prefix for the line comment, and the prefix and suffix for the block comment, if supported by the language.
- [Commenter](upsource:///plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesCommenter.java)
for [Properties language plugin](upsource:///plugins/properties/)
- [Custom Language Support Tutorial: Commenter](/tutorials/custom_language_support/commenter.md)
### Code Folding
EP: `com.intellij.lang.foldingBuilder`
The *code folding* is controlled by the plugin through the
[FoldingBuilder](upsource:///platform/core-api/src/com/intellij/lang/folding/FoldingBuilder.java)
interface.
The interface returns the list of text ranges which are foldable (as an array of
Returns the list of text ranges that are foldable (as an array of
[FoldingDescriptor](upsource:///platform/core-api/src/com/intellij/lang/folding/FoldingDescriptor.java)
objects), the replacement text which is shown for each range when it is folded, and the default state of each folding region (folded or unfolded).
The *Comment Code* feature is controlled through the
[Commenter](upsource:///platform/core-api/src/com/intellij/lang/Commenter.java)
interface.
The interface can return the prefix for the line comment, and the prefix and suffix for the block comment, if such features are supported by the language.
**Example:**
[Commenter](upsource:///plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesCommenter.java)
for [Properties language plugin](upsource:///plugins/properties/)
- [Custom Language Support Tutorial: Folding Builder](/tutorials/custom_language_support/folding_builder.md)
To support smart/semantic *Join Lines* see
[JoinLinesHandlerDelegate](upsource:///platform/lang-api/src/com/intellij/codeInsight/editorActions/JoinLinesHandlerDelegate.java).
### Join Lines
EP: `com.intellij.joinLinesHandler`
*Smart Enter* (e.g. autocomplete missing semicolon/parentheses) can be provided via
[SmartEnterProcessor](upsource:///platform/lang-api/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterProcessor.java).
[JoinLinesHandlerDelegate](upsource:///platform/lang-api/src/com/intellij/codeInsight/editorActions/JoinLinesHandlerDelegate.java)
allows extending support smart/semantic *Edit \| Join Lines* (e.g., String literal split on multiple lines).
### Smart Enter
EP: `com.intellij.lang.smartEnterProcessor`
[SmartEnterProcessor](upsource:///platform/lang-api/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterProcessor.java)
handles *Edit \| Complete Statement* (e.g., autocomplete missing semicolon/parentheses).
### Naming Suggestions
EP: `com.intellij.nameSuggestionProvider`
*Naming suggestions* for Rename Refactoring can be provided via
[NameSuggestionProvider](upsource:///platform/lang-api/src/com/intellij/refactoring/rename/NameSuggestionProvider.java).
provides name suggestions for the given element, e.g., for Rename refactoring.
*Semantic highlight usages* (e.g. exit points) can be achieved using
[HighlightUsagesHandlerFactory](upsource:///platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerFactory.java).
*View \| Parameter Info* is provided via
### Semantic Highlight Usages
EP: `com.intellij.highlightUsagesHandlerFactory`
[HighlightUsagesHandlerFactory](upsource:///platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerFactory.java)
allows highlighting e.g. Exit Points or Exceptions.
### Parameter Info
EP: `com.intellij.codeInsight.parameterInfo`
[ParameterInfoHandler](upsource:///platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoHandler.java)
(extension point `codeInsight.parameterInfo`).
provides support for *View \| Parameter Info*.
The *To Do view* is supported automatically if the plugin provides a correct implementation of the
[ParserDefinition.getCommentTokens()](upsource:///platform/core-api/src/com/intellij/lang/ParserDefinition.java)<!--#L79-->
method.
The *View \| Context Info* feature is supported for custom languages since IntelliJ IDEA 10.5.
In order for it to work, you need to have a structure view implementation based on a
[TreeBasedStructureViewBuilder](upsource:///platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java),
and additionally to provide an implementation of
### To Do View
EP: n/a
[ParserDefinition.getCommentTokens()](upsource:///platform/core-api/src/com/intellij/lang/ParserDefinition.java)
must return the set of tokens treated as comments to populate *To Do View*.
### Context Info
EP: `com.intellij.declarationRangeHandler`
[DeclarationRangeHandler](upsource:///platform/lang-api/src/com/intellij/codeInsight/hint/DeclarationRangeHandler.java)
for your language and to register it in the `declarationRangeHandler` extension point.
provides *View \| Context Info* for custom languages with structure view implementation based on a
[TreeBasedStructureViewBuilder](upsource:///platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java).
### Spellchecking
EP: `com.intellij.spellchecker.support`
*Spellchecking* can be provided via EP `spellchecker.support` (
[SpellcheckingStrategy](upsource:///spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java)
) where you can return
[Tokenizer](upsource:///spellchecker/src/com/intellij/spellchecker/tokenizer/Tokenizer.java)
to use, possibly depending on the passed in
[PsiElement](upsource:///platform/core-api/src/com/intellij/psi/PsiElement.java)
(or `EMPTY_TOKENIZER` for no spellchecking).
provides [Tokenizer](upsource:///spellchecker/src/com/intellij/spellchecker/tokenizer/Tokenizer.java)
to use for given `PsiElement` (return `EMPTY_TOKENIZER` for no spellchecking).
### Reference Injection
EP: `com.intellij.referenceInjector`
**New in IntelliJ IDEA 13**: user-configurable *reference injections* can be provided via `referenceInjector` extension point (
[ReferenceInjector](upsource:///platform/lang-api/src/com/intellij/psi/injection/ReferenceInjector.java)
) (IntelliLang plugin required).
allows users to inject pre-defined references (e.g., "Encoding", "File Reference") into `PsiLanguageInjectionHost` elements (IntelliLang plugin required).
*Color preview/chooser* gutter icons are supported via `com.intellij.colorProvider` ([ElementColorProvider](upsource:///platform/lang-api/src/com/intellij/openapi/editor/ElementColorProvider.java)) extension point.
### Color Preview/Chooser
EP: `com.intellij.colorProvider`
[ElementColorProvider](upsource:///platform/lang-api/src/com/intellij/openapi/editor/ElementColorProvider.java)
renders gutter icon for element containing color information.