Interface NewHighlighting
-
- All Known Implementing Classes:
DefaultHighlighting
public interface NewHighlightingThis builder is used to define syntax highlighting (aka code coloration) on files. Example:sensorContext.newHighlighting().onFile(inputFile) .highlight(1, 10, 1, 15, KEYWORD) .highlight(1, 16, 1, 18, STRING) // Add more highlight if needed .save();- Since:
- 5.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description NewHighlightinghighlight(int startLine, int startLineOffset, int endLine, int endLineOffset, TypeOfText typeOfText)Shortcut to avoid callingInputFile.newRange(int, int, int, int)NewHighlightinghighlight(int startOffset, int endOffset, TypeOfText typeOfText)Deprecated.since 5.6 Only supported to ease migration from old API.NewHighlightinghighlight(TextRange range, TypeOfText typeOfText)Call this method to indicate the type of text in a range.NewHighlightingonFile(InputFile inputFile)The file the highlighting belongs to.voidsave()Call this method only once when your are done with defining highlighting of the file.
-
-
-
Method Detail
-
onFile
NewHighlighting onFile(InputFile inputFile)
The file the highlighting belongs to.
-
highlight
@Deprecated NewHighlighting highlight(int startOffset, int endOffset, TypeOfText typeOfText)
Deprecated.since 5.6 Only supported to ease migration from old API. Please prefer otherhighlight()methods.Call this method to indicate the type of text in a range.- Parameters:
startOffset- Starting position in file for this type of text. Beginning of a file starts with offset '0'.endOffset- End position in file for this type of text.typeOfText- seeTypeOfTextvalues.
-
highlight
NewHighlighting highlight(TextRange range, TypeOfText typeOfText)
Call this method to indicate the type of text in a range.- Parameters:
range- Range of text to highlight. See for exampleInputFile.newRange(int, int, int, int).typeOfText- seeTypeOfTextvalues.- Since:
- 5.6
-
highlight
NewHighlighting highlight(int startLine, int startLineOffset, int endLine, int endLineOffset, TypeOfText typeOfText)
Shortcut to avoid callingInputFile.newRange(int, int, int, int)- Parameters:
typeOfText- seeTypeOfTextvalues.- Since:
- 5.6
-
save
void save()
Call this method only once when your are done with defining highlighting of the file. It is not supported to save highlighting twice for the same file.- Throws:
java.lang.IllegalStateException- if you have defined overlapping highlighting
-
-