Package org.eclipse.lemminx.commons
Class TextDocument
- java.lang.Object
-
- org.eclipse.lsp4j.TextDocumentItem
-
- org.eclipse.lemminx.commons.TextDocument
-
- Direct Known Subclasses:
ModelTextDocument
public class TextDocument extends org.eclipse.lsp4j.TextDocumentItemText document extends LSP4jTextDocumentItemto provide methods to retrieve position.
-
-
Constructor Summary
Constructors Constructor Description TextDocument(String text, String uri)TextDocument(org.eclipse.lsp4j.TextDocumentItem document)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.lsp4j.RangegetWordRangeAt(int textOffset, Pattern wordDefinition)booleanisIncremental()intlineAt(int position)Returns the line number the character at the given offset belongs to.StringlineDelimiter(int lineNumber)intlineOffsetAt(int position)StringlineText(int lineNumber)intoffsetAt(org.eclipse.lsp4j.Position position)org.eclipse.lsp4j.PositionpositionAt(int position)voidsetIncremental(boolean incremental)voidupdate(List<org.eclipse.lsp4j.TextDocumentContentChangeEvent> changes)Update text of the document by using the changes and according the incremental support.
-
-
-
Method Detail
-
setIncremental
public void setIncremental(boolean incremental)
-
isIncremental
public boolean isIncremental()
-
positionAt
public org.eclipse.lsp4j.Position positionAt(int position) throws BadLocationException- Throws:
BadLocationException
-
offsetAt
public int offsetAt(org.eclipse.lsp4j.Position position) throws BadLocationException- Throws:
BadLocationException
-
lineText
public String lineText(int lineNumber) throws BadLocationException
- Throws:
BadLocationException
-
lineOffsetAt
public int lineOffsetAt(int position) throws BadLocationException- Throws:
BadLocationException
-
lineAt
public int lineAt(int position) throws BadLocationExceptionReturns 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
-
lineDelimiter
public String lineDelimiter(int lineNumber) throws BadLocationException
- Throws:
BadLocationException
-
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.
-
-