public abstract class AbstractCodeBlockSupportHandler extends java.lang.Object implements CodeBlockSupportHandler
EP| Constructor and Description |
|---|
AbstractCodeBlockSupportHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract TokenSet |
getBlockElementTypes() |
java.util.List<TextRange> |
getCodeBlockMarkerRanges(PsiElement elementAtCursor)
Checks if code block marker (or keyword) is under cursor and collects related markers: e.g.
|
TextRange |
getCodeBlockRange(PsiElement elementAtCursor)
Checks if cursor is inside the block supported by this handler.
|
protected abstract TokenSet |
getDirectChildrenElementTypes(IElementType parentElementType)
The method defines a highlighting tree.
|
protected abstract TokenSet |
getKeywordElementTypes() |
protected abstract TokenSet |
getTopLevelElementTypes() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindCodeBlockRange, findMarkersRanges, findMarkersRangesprotected abstract TokenSet getTopLevelElementTypes()
IF_STATEMENT.
getDirectChildrenElementTypes(com.intellij.psi.tree.IElementType) should never return these element typesprotected abstract TokenSet getKeywordElementTypes()
getDirectChildrenElementTypes(com.intellij.psi.tree.IElementType) should return an empty TokenSet for an element type if it is a keyword.protected abstract TokenSet getBlockElementTypes()
protected abstract TokenSet getDirectChildrenElementTypes(IElementType parentElementType)
getDirectChildrenElementTypes(getElementType(A)).contains(getElementType(B))getTopLevelElementTypes() and getKeywordElementTypes().
For example, for the given if statement:
if expr elsif expr else endthe children should be defined as follows:
IF_STATEMENT => {kIF, ELSIF_BLOCK, ELSE_BLOCK, kEND}
ELSIF_BLOCK => {kELSEIF}
ELSE_BLOCK => {kELSE}
public java.util.List<TextRange> getCodeBlockMarkerRanges(PsiElement elementAtCursor)
CodeBlockSupportHandlerif/elsif/else
if cursor is on the else from this compound statement.getCodeBlockMarkerRanges in interface CodeBlockSupportHandlerpublic TextRange getCodeBlockRange(PsiElement elementAtCursor)
CodeBlockSupportHandlergetCodeBlockRange in interface CodeBlockSupportHandler