mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
additional_minor_features.md: add EP links to IPE, cleanup
This commit is contained in:
parent
cae1c48350
commit
6721cbd379
@ -226,4 +226,8 @@
|
||||
summary="Browse usages in existing implementations of open-source plugins">
|
||||
<code>%ep%</code></a> extension point
|
||||
</snippet>
|
||||
<snippet id="epLink"><a href="https://jb.gg/ipe?extensions=%ep%"
|
||||
summary="Browse usages in existing implementations of open-source plugins">
|
||||
<code>%ep%</code></a>
|
||||
</snippet>
|
||||
</topic>
|
||||
|
@ -6,12 +6,10 @@
|
||||
|
||||
A number of commonly used minor features are listed in the following format:
|
||||
|
||||
_EP: `fully.qualified.extensionPointName`_ — Extension Point Name (must be specified in <path>[plugin.xml](plugin_configuration_file.md)</path>)
|
||||
_EP: `fully.qualified.extensionPointName`_ — Extension Point Name (must be specified in <path>[plugin.xml](plugin_configuration_file.md)</path>). Click to browse usages in existing implementations of open-source plugins.
|
||||
|
||||
_`com.extensionPoint.class`_ _description text_ — Extension Point class/interface to provide functionality
|
||||
|
||||
_- Sample 1_ - Sample implementation
|
||||
|
||||
> See also [](intellij_platform_extension_point_list.md#langextensionpointsxml) to discover more Language-related Extension Points as well as general guide [](explore_api.md).
|
||||
>
|
||||
{title="Locating more Language EPs"}
|
||||
@ -20,7 +18,7 @@ _- Sample 1_ - Sample implementation
|
||||
|
||||
### Brace Matching
|
||||
|
||||
EP: `com.intellij.lang.braceMatcher`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.lang.braceMatcher"/></include>
|
||||
|
||||
[`PairedBraceMatcher`](%gh-ic%/platform/analysis-api/src/com/intellij/lang/PairedBraceMatcher.java)
|
||||
returns an array of brace pairs ([`BracePair`](%gh-ic%/platform/analysis-api/src/com/intellij/lang/BracePair.java)) specifying the characters for the opening and closing braces and the lexer token types for these characters.
|
||||
@ -36,30 +34,30 @@ See also [](#recognizing-complex-multi-block-expressions).
|
||||
|
||||
<primary-label ref="2022.3"/>
|
||||
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.heavyBracesHighlighter"/></include>
|
||||
|
||||
If the brace matching is "too heavy" and should not be executed in [EDT](threading_model.md), implement
|
||||
[`HeavyBraceHighlighter`](%gh-ic%/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HeavyBraceHighlighter.java)
|
||||
and register in <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.heavyBracesHighlighter"/></include>.
|
||||
[`HeavyBraceHighlighter`](%gh-ic%/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HeavyBraceHighlighter.java).
|
||||
|
||||
### Quote Handling
|
||||
|
||||
EP: `com.intellij.lang.quoteHandler`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.lang.quoteHandler"/></include>
|
||||
|
||||
To support <control>Insert pair quote</control> feature, provide [`QuoteHandler`](%gh-ic%/platform/lang-impl/src/com/intellij/codeInsight/editorActions/QuoteHandler.java).
|
||||
In most cases, [`SimpleTokenSetQuoteHandler`](%gh-ic%/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SimpleTokenSetQuoteHandler.java) base implementation will be suitable.
|
||||
|
||||
### Comment Code
|
||||
|
||||
EP: `com.intellij.lang.commenter`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.lang.commenter"/></include>
|
||||
|
||||
[`Commenter`](%gh-ic%/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.
|
||||
For more complex logic, use [`SelfManagingCommenter`](%gh-ic%/platform/core-api/src/com/intellij/codeInsight/generation/SelfManagingCommenter.java).
|
||||
|
||||
- [`Commenter`](%gh-ic%/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesCommenter.java) for [Properties language plugin](%gh-ic%/plugins/properties)
|
||||
- [Custom Language Support Tutorial: Commenter](commenter.md)
|
||||
|
||||
### Code Folding
|
||||
|
||||
EP: `com.intellij.lang.foldingBuilder`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.lang.foldingBuilder"/></include>
|
||||
|
||||
[`FoldingBuilder`](%gh-ic%/platform/core-api/src/com/intellij/lang/folding/FoldingBuilder.java) returns the list of foldable text ranges (as an array of [`FoldingDescriptor`](%gh-ic%/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).
|
||||
|
||||
@ -67,41 +65,38 @@ EP: `com.intellij.lang.foldingBuilder`
|
||||
|
||||
### Join Lines
|
||||
|
||||
EP: `com.intellij.joinLinesHandler`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.joinLinesHandler"/></include>
|
||||
|
||||
[`JoinLinesHandlerDelegate`](%gh-ic%/platform/lang-api/src/com/intellij/codeInsight/editorActions/JoinLinesHandlerDelegate.java) allows extending support smart/semantic <ui-path>Edit | Join Lines</ui-path> (e.g., String literal split on multiple lines).
|
||||
|
||||
### Smart Enter
|
||||
|
||||
EP: `com.intellij.lang.smartEnterProcessor`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.lang.smartEnterProcessor"/></include>
|
||||
|
||||
[`SmartEnterProcessor`](%gh-ic%/platform/lang-api/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterProcessor.java) handles <ui-path>Edit | Complete Statement</ui-path> (e.g., autocomplete missing semicolon/parentheses).
|
||||
|
||||
### Move Element Left/Right
|
||||
|
||||
EP: `com.intellij.moveLeftRightHandler`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.moveLeftRightHandler"/></include>
|
||||
|
||||
Return children of given element from [`MoveElementLeftRightHandler`](%gh-ic%/platform/lang-api/src/com/intellij/codeInsight/editorActions/moveLeftRight/MoveElementLeftRightHandler.java) for <ui-path>Code | Move Element Left|Right</ui-path>, e.g., method call parameters.
|
||||
Alternatively, implement [`PsiListLikeElement`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiListLikeElement.java) in PSI element.
|
||||
|
||||
### Move Statements Up and Down in the Editor
|
||||
|
||||
EP: `com.intellij.statementUpDownMover`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.statementUpDownMover"/></include>
|
||||
|
||||
[`StatementUpDownMover`](%gh-ic%/platform/lang-api/src/com/intellij/codeInsight/editorActions/moveUpDown/StatementUpDownMover.java)
|
||||
allows for customizing the behavior of moving statements up and down.
|
||||
This can be used to keep code syntactically correct when moving code in the editor, e.g. when moving
|
||||
a variable declaration.
|
||||
|
||||
- [`DeclarationMover`](%gh-ic%/java/java-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/DeclarationMover.java)
|
||||
|
||||
### Splitting and Joining List Constructs
|
||||
|
||||
EP: `com.intellij.listSplitJoinContext`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.listSplitJoinContext"/></include>
|
||||
|
||||
[`ListSplitJoinContext`](%gh-ic%/platform/lang-impl/src/com/intellij/openapi/editor/actions/lists/ListSplitJoinContext.kt)
|
||||
needs to be implemented to define the exact behavior of splitting and joining list-like constructs
|
||||
in a language.
|
||||
needs to be implemented to define the exact behavior of splitting and joining list-like constructs in a language.
|
||||
The UI will show implementations of this EP as an
|
||||
[intention action](https://www.jetbrains.com/help/idea/intention-actions.html)
|
||||
at appropriate locations.
|
||||
@ -113,7 +108,7 @@ for their implementation.
|
||||
|
||||
### Recognizing Complex Multi-Block Expressions
|
||||
|
||||
EP: `com.intellij.codeBlockSupportHandler`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.codeBlockSupportHandler"/></include>
|
||||
|
||||
[`CodeBlockSupportHandler`](%gh-ic%/platform/lang-impl/src/com/intellij/codeInsight/highlighting/CodeBlockSupportHandler.java)
|
||||
allows providing text ranges for more complex code blocks like, e.g., in `if`/`elsif`/`else` blocks.
|
||||
@ -124,13 +119,13 @@ See also [](#brace-matching).
|
||||
|
||||
### Reference Injection
|
||||
|
||||
EP: `com.intellij.referenceInjector`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.referenceInjector"/></include>
|
||||
|
||||
[`ReferenceInjector`](%gh-ic%/platform/analysis-api/src/com/intellij/psi/injection/ReferenceInjector.java) allows users to inject pre-defined references (e.g., "Encoding", "File Reference") into `PsiLanguageInjectionHost` elements (IntelliLang plugin required).
|
||||
|
||||
### Prevent Error Highlighting of Files
|
||||
|
||||
EP: `com.intellij.problemHighlightFilter`, `com.intellij.problemFileHighlightFilter`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.problemHighlightFilter"/></include>, <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.problemFileHighlightFilter"/></include>
|
||||
|
||||
[`ProblemHighlightFilter`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/daemon/ProblemHighlightFilter.java) and
|
||||
the <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.problemFileHighlightFilter"/></include> (which implements
|
||||
@ -140,12 +135,9 @@ the current project scope.
|
||||
Note that these filters should be permissive and only prevent highlighting for files that are absolutely
|
||||
known to be outside the scope.
|
||||
|
||||
- [`JavaProblemHighlightFilter`](%gh-ic%/java/java-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java)
|
||||
- [`PyProblemFileHighlightFilter`](%gh-ic%/python/src/com/jetbrains/python/codeInsight/PyProblemFileHighlightFilter.java)
|
||||
|
||||
### Semantic Highlight Usages
|
||||
|
||||
EP: `com.intellij.highlightUsagesHandlerFactory`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.highlightUsagesHandlerFactory"/></include>
|
||||
|
||||
[`HighlightUsagesHandlerFactory`](%gh-ic%/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerFactory.java) allows highlighting e.g., Exit Points or Exceptions.
|
||||
Can be [](indexing_and_psi_stubs.md#DumbAwareAPI) (2024.3+).
|
||||
@ -154,46 +146,40 @@ Can be [](indexing_and_psi_stubs.md#DumbAwareAPI) (2024.3+).
|
||||
|
||||
### Context Info
|
||||
|
||||
EP: `com.intellij.declarationRangeHandler`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.declarationRangeHandler"/></include>
|
||||
|
||||
[`DeclarationRangeHandler`](%gh-ic%/platform/lang-api/src/com/intellij/codeInsight/hint/DeclarationRangeHandler.java) provides <ui-path>View | Context Info</ui-path> for custom languages with structure view implementation based on a [`TreeBasedStructureViewBuilder`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java).
|
||||
|
||||
### Breadcrumbs
|
||||
|
||||
EP: `com.intellij.breadcrumbsInfoProvider`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.breadcrumbsInfoProvider"/></include>
|
||||
|
||||
[`BreadcrumbsProvider`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ui/breadcrumbs/BreadcrumbsProvider.java)
|
||||
allows for language-specific [breadcrumbs](https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html#editor_breadcrumbs).
|
||||
[Sticky Lines](https://www.jetbrains.com/help/idea/sticky-lines.html) feature also uses this data.
|
||||
|
||||
- [`GroovyBreadcrumbsInfoProvider`](%gh-ic%/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/GroovyBreadcrumbsInfoProvider.kt)
|
||||
|
||||
## IDE Integration
|
||||
|
||||
### TODO View
|
||||
|
||||
[`ParserDefinition.getCommentTokens()`](%gh-ic%/platform/core-api/src/com/intellij/lang/ParserDefinition.java) must return the set of tokens treated as comments to populate the <control>TODO</control> tool window.
|
||||
|
||||
### Spellchecking
|
||||
|
||||
Moved to [](spell_checking.md).
|
||||
|
||||
### Color Preview/Chooser
|
||||
|
||||
EP: `com.intellij.colorProvider`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.colorProvider"/></include>
|
||||
|
||||
[`ElementColorProvider`](%gh-ic%/platform/lang-api/src/com/intellij/openapi/editor/ElementColorProvider.java) renders gutter icon for an element containing color information.
|
||||
|
||||
### File Includes
|
||||
|
||||
EP: `com.intellij.include.provider`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.include.provider"/></include>
|
||||
|
||||
[`FileIncludeProvider`](%gh-ic%/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeProvider.java) provides information about _include_ statements resolving to files (e.g., `<xi:include>` in XML).
|
||||
Including/included files can then be obtained via [`FileIncludeManager`](%gh-ic%/platform/lang-api/src/com/intellij/psi/impl/include/FileIncludeManager.java).
|
||||
|
||||
### Plain Text Completion
|
||||
|
||||
EP: `com.intelllij.completion.plainTextSymbol`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.completion.plainTextSymbol"/></include>
|
||||
|
||||
[`PlainTextSymbolCompletionContributor`](%gh-ic%/platform/lang-api/src/com/intellij/codeInsight/completion/PlainTextSymbolCompletionContributor.java)
|
||||
provides a simple way to extract lookup elements from a file so that users have completion available
|
||||
@ -201,7 +187,7 @@ in, e.g., plain text editors like VCS commit messages.
|
||||
|
||||
### Reader Mode
|
||||
|
||||
EP: `com.intellij.readerModeMatcher`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.readerModeMatcher"/></include>
|
||||
|
||||
[`ReaderModeMatcher`](%gh-ic%/platform/editor-ui-api/src/com/intellij/codeInsight/actions/ReaderModeMatcher.kt)
|
||||
provides a way to decide if files are shown in the correct mode: reader mode vs. normal editor mode.
|
||||
@ -211,7 +197,7 @@ to get familiar with reader mode.
|
||||
|
||||
### Background Colors for Editors and Project View
|
||||
|
||||
EP: `com.intellij.editorTabColorProvider`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.editorTabColorProvider"/></include>
|
||||
|
||||
[`EditorTabColorProvider`](%gh-ic%/platform/ide-core-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabColorProvider.java)
|
||||
allows for the modification of the background colors for specific files.
|
||||
@ -219,24 +205,19 @@ If access to indexes is not required, it can be marked [dumb aware](indexing_and
|
||||
|
||||
### Custom Names and Tooltips for Editor Tabs
|
||||
|
||||
EP: `com.intellij.editorTabTitleProvider`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.editorTabTitleProvider"/></include>
|
||||
|
||||
[`EditorTabTitleProvider`](%gh-ic%/platform/ide-core-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabTitleProvider.kt)
|
||||
allows for specifying custom names and tooltips displayed in the title of editor tabs.
|
||||
If access to indexes is not required, it can be marked [dumb aware](indexing_and_psi_stubs.md#DumbAwareAPI).
|
||||
|
||||
- [`GradleEditorTabTitleProvider`](%gh-ic%/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleEditorTabTitleProvider.kt)
|
||||
|
||||
### Provide Fully Qualified Names (FQN) for Elements
|
||||
|
||||
EP: `com.intellij.ide.actions.QualifiedNameProvider`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.qualifiedNameProvider"/></include>
|
||||
|
||||
[`QualifiedNameProvider`](%gh-ic%/platform/refactoring/src/com/intellij/ide/actions/QualifiedNameProvider.java)
|
||||
provides features like copying and pasting references of FQN for, e.g., classes, functions, or methods.
|
||||
Therefore, the `QualifiedNameProvider` implementation needs to provide logic to convert from and to
|
||||
FQN.
|
||||
|
||||
- [`PyQualifiedNameProvider`](%gh-ic%/python/src/com/jetbrains/python/actions/PyQualifiedNameProvider.java)
|
||||
Therefore, the `QualifiedNameProvider` implementation needs to provide logic to convert from and to FQN.
|
||||
|
||||
### Customized "Copy Path"
|
||||
|
||||
@ -249,10 +230,10 @@ Register the action with the popup menu group `<add-to-group group-id="CopyRefer
|
||||
|
||||
### Label Files as Test Files
|
||||
|
||||
EP: `com.intellij.openapi.roots.TestSourcesFilter`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.testSourcesFilter"/></include>
|
||||
|
||||
[`TestSourcesFilter`](%gh-ic%/platform/projectModel-api/src/com/intellij/openapi/roots/TestSourcesFilter.java)
|
||||
allows for telling the IDE that a file is a test file, even it's not located in a directory marked as
|
||||
allows for telling the IDE that a file is a test file; even it's not located in a directory marked as
|
||||
test root.
|
||||
This can be used in situations where test files are located next to source files.
|
||||
If these files can be distinguished either by filename or content from source files, implementing this
|
||||
@ -262,17 +243,15 @@ EP will mark them as test files for the IDE.
|
||||
|
||||
### Naming Suggestions
|
||||
|
||||
EP: `com.intellij.nameSuggestionProvider`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.nameSuggestionProvider"/></include>
|
||||
|
||||
[`NameSuggestionProvider`](%gh-ic%/platform/refactoring/src/com/intellij/refactoring/rename/NameSuggestionProvider.java) provides name suggestions for the given element, e.g., for Rename refactoring.
|
||||
[`NameSuggestionProvider`](%gh-ic%/platform/refactoring/src/com/intellij/refactoring/rename/NameSuggestionProvider.java) provides name suggestions for the given element, e.g., for [Rename refactoring](rename_refactoring.md).
|
||||
|
||||
### Suggesting Rename and Change Signature Refactorings
|
||||
|
||||
EP: `com.intellij.suggestedRefactoringSupport`
|
||||
EP: <include from="snippets.topic" element-id="epLink"><var name="ep" value="com.intellij.suggestedRefactoringSupport"/></include>
|
||||
|
||||
[`SuggestedRefactoringSupport`](%gh-ic%/platform/lang-api/src/com/intellij/refactoring/suggested/SuggestedRefactoringSupport.kt)
|
||||
provides functionality for suggesting rename and change signature refactorings for custom languages.
|
||||
|
||||
- [`KotlinSuggestedRefactoringSupport`](%gh-ic%/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringSupport.kt)
|
||||
|
||||
<include from="snippets.topic" element-id="missingContent"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user