Interface NewHighlighting


  • public interface NewHighlighting
    This 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 Detail

      • highlight

        @Deprecated
        NewHighlighting highlight​(int startOffset,
                                  int endOffset,
                                  TypeOfText typeOfText)
        Deprecated.
        since 5.6 Only supported to ease migration from old API. Please prefer other highlight() 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 - see TypeOfText values.
      • 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