Package org.eclipse.xtext.ide.server
Class Document
- java.lang.Object
-
- org.eclipse.xtext.ide.server.Document
-
public class Document extends java.lang.Object- Since:
- 2.11
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentapplyChanges(java.lang.Iterable<? extends org.eclipse.lsp4j.TextEdit> changes)Only use for testing.DocumentapplyTextDocumentChanges(java.lang.Iterable<? extends org.eclipse.lsp4j.TextDocumentContentChangeEvent> changes)As opposed toTextEdit[] the positions in the edits of aDidChangeTextDocumentParamsrefer to the state after applying the preceding edits.booleanequals(java.lang.Object obj)java.lang.StringgetContents()java.lang.StringgetLineContent(int lineNumber)Returns with the text for a certain line without the trailing end line marker.intgetLineCount()Get the number of lines in the document.intgetOffSet(org.eclipse.lsp4j.Position position)org.eclipse.lsp4j.PositiongetPosition(int offset)protected java.lang.StringgetSourceOnError()java.lang.StringgetSubstring(org.eclipse.lsp4j.Range range)java.lang.IntegergetVersion()inthashCode()booleanisPrintSourceOnError()java.lang.StringtoString()
-
-
-
Method Detail
-
getOffSet
public int getOffSet(org.eclipse.lsp4j.Position position) throws java.lang.IndexOutOfBoundsException- Throws:
java.lang.IndexOutOfBoundsException
-
getPosition
public org.eclipse.lsp4j.Position getPosition(int offset) throws java.lang.IndexOutOfBoundsException- Throws:
java.lang.IndexOutOfBoundsException
-
getLineContent
public java.lang.String getLineContent(int lineNumber) throws java.lang.IndexOutOfBoundsExceptionReturns with the text for a certain line without the trailing end line marker. Throws anIndexOutOfBoundsExceptionif the zero-basedlineNumberargument is negative or exceeds the number of lines in the document.- Throws:
java.lang.IndexOutOfBoundsException
-
getSourceOnError
protected java.lang.String getSourceOnError()
- Since:
- 2.22
-
getLineCount
public int getLineCount()
Get the number of lines in the document. Empty document has line count:1.
-
getSubstring
public java.lang.String getSubstring(org.eclipse.lsp4j.Range range)
-
applyTextDocumentChanges
public Document applyTextDocumentChanges(java.lang.Iterable<? extends org.eclipse.lsp4j.TextDocumentContentChangeEvent> changes)
As opposed toTextEdit[] the positions in the edits of aDidChangeTextDocumentParamsrefer to the state after applying the preceding edits. See https://microsoft.github.io/language-server-protocol/specification#textedit-1 and https://github.com/microsoft/vscode/issues/23173#issuecomment-289378160 for details.- Returns:
- a new document with an incremented version and the text document changes applied.
- Since:
- 2.18
-
applyChanges
public Document applyChanges(java.lang.Iterable<? extends org.eclipse.lsp4j.TextEdit> changes)
Only use for testing. All positions in theTextEdits refer to the same original document (this).
-
isPrintSourceOnError
public boolean isPrintSourceOnError()
- Since:
- 2.15
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getVersion
public java.lang.Integer getVersion()
-
getContents
public java.lang.String getContents()
-
-