Class TextDocument

  • Direct Known Subclasses:
    ModelTextDocument

    public class TextDocument
    extends org.eclipse.lsp4j.TextDocumentItem
    Text document extends LSP4j TextDocumentItem to provide methods to retrieve position.
    • Constructor Detail

      • TextDocument

        public TextDocument​(org.eclipse.lsp4j.TextDocumentItem document)
      • TextDocument

        public TextDocument​(String text,
                            String uri)
    • Method Detail

      • setIncremental

        public void setIncremental​(boolean incremental)
      • isIncremental

        public boolean isIncremental()
      • lineAt

        public int lineAt​(int position)
                   throws BadLocationException
        Returns the line number the character at the given offset belongs to.
        Parameters:
        position - the offset whose line number to be determined
        Returns:
        the number of the line the offset is on
        Throws:
        BadLocationException - if the offset is invalid in this tracker
      • getWordRangeAt

        public org.eclipse.lsp4j.Range getWordRangeAt​(int textOffset,
                                                      Pattern wordDefinition)
      • update

        public void update​(List<org.eclipse.lsp4j.TextDocumentContentChangeEvent> changes)
        Update text of the document by using the changes and according the incremental support.
        Parameters:
        changes - the text document changes.