public interface IReparseableElementTypeBase extends ILazyParseableElementTypeBase
IElementType
instances for tokens, which allows for incremental reparse.
When the infrastructure detects that all the document's changes are inside an AST node with reparseable type,
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.
Implementers of this interface (except IReparseableElementType
) must also implement ICustomParsingType
.Modifier and Type | Method and Description |
---|---|
default boolean |
isParsable(ASTNode parent,
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.
|
default boolean |
isValidReparse(ASTNode oldNode,
ASTNode newNode) |
parseContents, reuseCollapsedTokens
default boolean isParsable(ASTNode parent, java.lang.CharSequence buffer, Language fileLanguage, Project project)
parent
- parent node of old (or collapsed) reparseable node.
Use this parameter only if you really understand what are doing.
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.buffer
- the content to parse.fileLanguage
- language of the fileproject
- the project containing the content.