public class IReparseableElementType extends ILazyParseableElementType implements IReparseableElementTypeBase
isParsable(ASTNode, CharSequence, Language, Project)
is invoked, and if it's successful,
only the contents inside this element are reparsed instead of the whole file. This can speed up reparse dramatically.IElementType.Predicate
LANGUAGE_KEY
ARRAY_FACTORY, EMPTY_ARRAY, FIRST_TOKEN_INDEX, TRUE
Constructor and Description |
---|
IReparseableElementType(java.lang.String debugName) |
IReparseableElementType(java.lang.String debugName,
Language language) |
IReparseableElementType(java.lang.String debugName,
Language language,
boolean register)
Allows to construct element types without registering them, as in
IElementType(String, Language, boolean) . |
Modifier and Type | Method and Description |
---|---|
boolean |
isParsable(ASTNode parent,
java.lang.CharSequence buffer,
Language fileLanguage,
Project project)
The same as
this#isParsable(CharSequence, Language, Project)
but with parent ASTNode of the old node. |
boolean |
isParsable(java.lang.CharSequence buffer,
Language fileLanguage,
Project project)
Checks if the specified character sequence can be parsed as a valid content of the
chameleon node.
|
boolean |
isValidReparse(ASTNode oldNode,
ASTNode newNode) |
createNode, doParseContents, getLanguageForParser, parseContents, parseLight, reuseCollapsedTokens
enumerate, find, getIndex, getLanguage, hashCode, isLeftBound, toString, unregisterElementTypes, unregisterElementTypes
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
parseContents, reuseCollapsedTokens
public IReparseableElementType(java.lang.String debugName)
public IReparseableElementType(java.lang.String debugName, Language language)
public IReparseableElementType(java.lang.String debugName, Language language, boolean register)
IElementType(String, Language, boolean)
.public boolean isParsable(java.lang.CharSequence buffer, Language fileLanguage, Project project)
buffer
- the content to parse.fileLanguage
- language of the fileproject
- the project containing the content.public boolean isParsable(ASTNode parent, java.lang.CharSequence buffer, Language fileLanguage, Project project)
this#isParsable(CharSequence, Language, Project)
but with parent ASTNode of the old node.
Override this method only if you really understand what are doing.
In other cases override this#isParsable(CharSequence, Language, Project)
Known valid use-case:
Indent-based languages. You should know about parent indent in order to decide if block is reparseable with given text.
Because if indent of some line became equals to parent indent then the block should have another parent or block is not block anymore.
So it cannot be reparsed and whole file or parent block should be reparsed.isParsable
in interface IReparseableElementTypeBase
parent
- parent node of old (or collapsed) reparseable node.buffer
- the content to parse.fileLanguage
- language of the fileproject
- the project containing the content.public boolean isValidReparse(ASTNode oldNode, ASTNode newNode)
isValidReparse
in interface IReparseableElementTypeBase