actualized 'Custom Language Support' section

fixed broken URLs
fixed style issues
removed anchors from URLs
This commit is contained in:
Artem Khvastunov 2015-08-06 18:10:33 +02:00
parent 8dd5790bca
commit 63867aee67
15 changed files with 43 additions and 40 deletions

View File

@ -29,7 +29,7 @@ The interface can return the prefix for the line comment, and the prefix and suf
**Example:**
[Commenter](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesCommenter.java)
for [Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
for [Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
To support smart/semantic *Join Lines* see
@ -44,15 +44,15 @@ To support smart/semantic *Join Lines* see
*Semantic highlight usages* (e.g. exit points) can be achieved using
[HighlightUsagesHandlerFactory](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerFactory.java).
*View\|Parameter Info* is provided via
**View \| Parameter Info** is provided via
[ParameterInfoHandler](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoHandler.java)
(extension point `codeInsight.parameterInfo`).
The *To Do view* is supported automatically if the plugin provides a correct implementation of the
[ParserDefinition.getCommentTokens()](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/lang/ParserDefinition.java#L79)
[ParserDefinition.getCommentTokens()](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/lang/ParserDefinition.java)
method.
The *View \| Context Info* feature is supported for custom languages since IntelliJ IDEA 10.5.
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](https://github.com/JetBrains/intellij-community/blob/master/platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java),
and additionally to provide an implementation of
@ -60,13 +60,13 @@ and additionally to provide an implementation of
for your language and to register it in the `declarationRangeHandler` extension point.
*Spellchecking* can be provided via EP `spellchecker.support` (
[SpellcheckingStrategy](https://github.com/JetBrains/intellij-community/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java)
[SpellcheckingStrategy](https://github.com/JetBrains/intellij-community/blob/master/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java)
) where you can return
[Tokenizer](https://github.com/JetBrains/intellij-community/spellchecker/src/com/intellij/spellchecker/tokenizer/Tokenizer.java)
[Tokenizer](https://github.com/JetBrains/intellij-community/blob/master/spellchecker/src/com/intellij/spellchecker/tokenizer/Tokenizer.java)
to use, possibly depending on the passed in
[PsiElement](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/PsiElement.java)
(or `EMPTY_TOKENIZER` for no spellchecking).
New in 13: user-configurable *reference injections* can be provided via `referenceInjector` extension point (
**New in IntelliJ IDEA 13**: user-configurable *reference injections* can be provided via `referenceInjector` extension point (
[ReferenceInjector](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-api/src/com/intellij/psi/injection/ReferenceInjector.java)
) (IntelliLang plugin required).

View File

@ -40,7 +40,7 @@ consists of calling the `extend()` method and passing in the *pattern* specifyin
**Example**:
[CompletionContributor](https://github.com/JetBrains/intellij-plugins/blob/master/osmorc/src/org/osmorc/manifest/completion/OsgiManifestCompletionContributor.java)
for completing keywords in MANIFEST.MF files.
for completing keywords in MANIFEST.MF files
Items shown in the completion list are represented by instances of the

View File

@ -70,8 +70,7 @@ The return value of `createIndentOptions()` determines the default indent size.
### Rearranger
**New in 12:**
**New in IntelliJ IDEA 12:**
Allows custom languages to provide user-configurable arrangement/grouping rules for element types supported by language plugin.
Rules can be refined via modifiers and name, ordering can be applied additionally.
Please see

View File

@ -21,7 +21,7 @@ provides better performance (because of its support for incremental analysis) an
A
[simple inspection](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/TrailingSpacesInPropertyInspection.java)
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
The code intentions for custom languages also use the regular API for intentions.

View File

@ -11,7 +11,7 @@ A standard base class for such implementations is available in the class
**Example**:
[DocumentationProvider](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/lang/properties/PropertiesDocumentationProvider.java)
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
The `getQuickNavigateInfo()` method returns the text to be displayed when the user holds the mouse over an element with ```Ctrl``` pressed.

View File

@ -15,7 +15,7 @@ interfaces.
Implementation of
[FindUsagesProvider](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/findUsages/PropertiesFindUsagesProvider.java)
in
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
The steps of the ```Find Usages``` action are the following:
@ -83,4 +83,4 @@ passed to the provider in this case will be an instance of
**Example:**
[ElementDescriptionProvider](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/lang/properties/PropertiesDescriptionProvider.java)
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)

View File

@ -69,7 +69,7 @@ Lexers must never abort prematurely because of an invalid character.
**Example**:
[Lexer](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/lang/properties/parsing/Properties.flex)
definition for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/lang/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
Types of tokens for lexers are defined by instances of
@ -88,7 +88,7 @@ instance should be returned every time a particular token type is encountered by
**Example:**
[Token types](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/parsing/PropertiesTokenTypes.java)
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
An important feature which can be implemented at lexer level is mixing languages within a file, for example, embedding fragments of Java code in some template language.

View File

@ -33,14 +33,14 @@ method.
**Example**:
[ParserDefinition](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertiesParserDefinition.java)
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
The lifecycle of the PSI is described in more detail in
[Architectural Overview](/basics/architectural_overview.md).
The base classes for the PSI implementation, including
[PsiFileBase](https://github.com/JetBrains/intellij-community/blob/master/core-impl/src/com/intellij/extapi/psi/PsiFileBase.java),
[PsiFileBase](https://github.com/JetBrains/intellij-community/blob/master/platform/core-impl/src/com/intellij/extapi/psi/PsiFileBase.java),
the base implementation of
[PsiFile](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/PsiFile.java),
and
@ -72,7 +72,7 @@ returns `null`, even if the tokens are not valid according to the language synta
**Example**:
[PsiParser](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertiesParser.java)
implementation for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/).
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
The parser works by setting pairs of markers (
[PsiBuilder.Marker](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/lang/PsiBuilder.java)

View File

@ -27,12 +27,12 @@ The latter method can be implemented by calling ```resolve()``` and comparing th
**Example**:
[Reference](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/lang/properties/ResourceBundleReference.java)
to a ResourceBundle in the
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
to a ResourceBundle in
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
There's a set of interfaces which can be used as a base for implementing resolve support, namely the
[PsiScopeProcessor interface](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/scope/PsiScopeProcessor.java) and the
[PsiScopeProcessor](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/scope/PsiScopeProcessor.java) interface and the
[PsiElement.processDeclarations()](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/PsiElement.java)
method.
These interfaces have a number of extra complexities which are not necessary for most custom languages (like support for substituting Java generics types), but they are required if the custom language can have references to Java code.

View File

@ -18,7 +18,7 @@ interface, which is registered via the ```com.intellij.fileTypeFactory```
**Example**:
[LanguageFileType](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java)
implementation in
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesFileType.java)
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties)
To verify that the file type is registered correctly, you can implement the
[LanguageFileType.getIcon()](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java)

View File

@ -16,9 +16,9 @@ Creating a fully correct AST node from scratch is quite difficult.
Thus, surprisingly, the easiest way to get the replacement node is to create a dummy file in the custom language so that it would contain the necessary node in its parse tree, build the parse tree and extract the necessary node from it.
**Example:**
[setName()](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyImpl.java#L58)
[setName()](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyImpl.java)
implementation for a
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
Another interface related to the Rename refactoring is
@ -32,7 +32,7 @@ are registered in the `com.intellij.lang.namesValidator` extension point.
**Example**:
[NamesValidator](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/lang/properties/PropertiesNamesValidator.java)
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
Further customization of the Rename refactoring processing is possible on multiple levels.
@ -44,7 +44,8 @@ at all.
**Example**:
[RenameHandler](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromEditorRenameHandler.java)
for renaming a resource bundle
for renaming a resource bundle in
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
If you're fine with the standard UI but need to extend the default logic of renaming, you can provide an implementation of the

View File

@ -11,7 +11,7 @@ In addition to that, in order to support ```Safe Delete```, a plugin needs to im
interface, registered in the `com.intellij.lang.refactoringSupport` extension point, and the `isSafeDeleteAvailable()` method, which checks if the ```Safe Delete``` refactoring is available for a specific PSI element
* The
[PsiElement.delete()](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/PsiElement.java#L371)
[PsiElement.delete()](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/PsiElement.java)
method for the
[PsiElement](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/PsiElement.java)
subclasses for which ```Safe Delete``` is available.
@ -19,7 +19,7 @@ In addition to that, in order to support ```Safe Delete```, a plugin needs to im
**Example:**
[delete()](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyImpl.java#L363)
[delete()](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyImpl.java)
implementation for a
[Property language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
@ -30,4 +30,5 @@ This is done by implementing the `SafeDeleteProcessorDelegate` interface.
**Example**:
[SafeDeleteProcessorDelegate](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/lang/properties/refactoring/PropertiesFilesSafeDeleteProcessor.java)
implementation for a .properties file
implementation for
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)

View File

@ -16,7 +16,8 @@ interface, which is registered in the `com.intellij.lang.psiStructureViewFactory
**Example:**
[PsiStructureViewFactory](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java)
for .properties files
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
To reuse the *IntelliJ Platform* implementation of the
@ -24,7 +25,7 @@ To reuse the *IntelliJ Platform* implementation of the
the plugin returns a
[TreeBasedStructureViewBuilder](https://github.com/JetBrains/intellij-community/blob/master/platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java)
from its
[PsiStructureViewFactory.getStructureViewBuilder()](https://github.com/JetBrains/intellij-community/blob/master/platform/structure-view-api/src/com/intellij/lang/PsiStructureViewFactory.java#L35)
[PsiStructureViewFactory.getStructureViewBuilder()](https://github.com/JetBrains/intellij-community/blob/master/platform/structure-view-api/src/com/intellij/lang/PsiStructureViewFactory.java)
method.
As the model for the builder, the plugin can specify a subclass of
[TextEditorBasedStructureViewModel](https://github.com/JetBrains/intellij-community/blob/master/platform/structure-view-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java),
@ -32,7 +33,8 @@ and by overriding methods of this subclass it customizes the structure view for
**Example**:
[StructureViewModel](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java)
for .properties files
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
The main method to override is `getRoot()`, which returns the instance of a class implementing the
@ -51,5 +53,5 @@ The latter method returns an array of `PsiElement`\-derived classes which can be
**Example:**
[StructureViewElement](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java)
for a
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)

View File

@ -12,8 +12,8 @@ objects, defining specific templates which can be used for surrounding the selec
When the ```Surround With...``` action is invoked, the IDE queries all surround descriptors for the language until it finds one that returns a non-empty array from its `getElementsToSurround()` method.
Then it calls the
[Surrounder.isApplicable()](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-api/src/com/intellij/lang/surroundWith/Surrounder.java#L46)
[Surrounder.isApplicable()](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-api/src/com/intellij/lang/surroundWith/Surrounder.java)
method for each surrounder in that descriptor to check if the specific template is applicable in the current context.
Once the user selects a specific surrounder from the popup menu, the
[Surrounder.surroundElements()](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-api/src/com/intellij/lang/surroundWith/Surrounder.java#L57)
[Surrounder.surroundElements()](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-api/src/com/intellij/lang/surroundWith/Surrounder.java)
method is used to execute the surround action.

View File

@ -40,7 +40,7 @@ can be used.
**Example:**
[SyntaxHighlighter](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesHighlighter.java)
implementation for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
### Parser
@ -75,7 +75,7 @@ to specify the text attributes key for the highlighting.
**Example:**
[Annotator](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesAnnotator.java)
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
### External tool
@ -100,6 +100,6 @@ and register it in the ```com.intellij.colorSettingsPage``` extension point.
**Example**:
[ColorSettingsPage](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/src/com/intellij/openapi/options/colors/pages/PropertiesColorsPage.java)
for
[Properties language plugin](https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/)
[Properties language plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/properties)
The ```Export to HTML``` feature uses the same syntax highlighting mechanism as the editor, so it will work automatically for custom languages which provide a syntax highlighter.