public interface ILineTracker
In order to provide backward compatibility for clients of ILineTracker
, extension
interfaces are used to provide a means of evolution. The following extension interfaces
exist:
org.eclipse.jface.text.ILineTrackerExtension
since version 3.1 introducing the concept
of rewrite sessions.Clients may implement this interface or use the standard implementation
org.eclipse.jface.text.DefaultLineTracker
or
org.eclipse.jface.text.ConfigurableLineTracker
.Modifier and Type | Method and Description |
---|---|
int |
computeNumberOfLines(String text)
Computes the number of lines in the given text.
|
String |
getLineDelimiter(int line)
Returns the line delimiter of the specified line.
|
org.eclipse.lemminx.commons.Line |
getLineInformation(int line)
Returns a line description of the given line.
|
org.eclipse.lemminx.commons.Line |
getLineInformationOfOffset(int offset)
Returns a line description of the line at the given offset.
|
int |
getLineLength(int line)
Returns length of the specified line including the line's delimiter.
|
int |
getLineNumberOfOffset(int offset)
Returns the line number the character at the given offset belongs to.
|
int |
getLineOffset(int line)
Returns the position of the first character of the specified line.
|
int |
getNumberOfLines()
Returns the number of lines.
|
int |
getNumberOfLines(int offset,
int length)
Returns the number of lines which are occupied by a given text range.
|
int |
getOffsetAt(org.eclipse.lsp4j.Position position) |
org.eclipse.lsp4j.Position |
getPositionAt(int position) |
void |
replace(int offset,
int length,
String text)
Informs the line tracker about the specified change in the tracked text.
|
void |
set(String text)
Sets the tracked text to the specified text.
|
String getLineDelimiter(int line) throws BadLocationException
null
if the
line is not closed with a line delimiter.line
- the line whose line delimiter is queriednull
if line does not have a delimiterBadLocationException
- if the line number is invalid in this tracker's line structureint computeNumberOfLines(String text)
text
- the text whose number of lines should be computedint getNumberOfLines()
Note that a document always has at least one line.
int getNumberOfLines(int offset, int length) throws BadLocationException
offset
- the offset of the specified text rangelength
- the length of the specified text rangeBadLocationException
- if specified range is unknown to this trackerint getLineOffset(int line) throws BadLocationException
line
- the line of interestBadLocationException
- if the line is unknown to this trackerint getLineLength(int line) throws BadLocationException
line
- the line of interestBadLocationException
- if line is unknown to this trackerint getLineNumberOfOffset(int offset) throws BadLocationException
offset
- the offset whose line number to be determinedBadLocationException
- if the offset is invalid in this trackerorg.eclipse.lemminx.commons.Line getLineInformationOfOffset(int offset) throws BadLocationException
offset
- the offset whose line should be describedBadLocationException
- if offset is invalid in this trackerorg.eclipse.lemminx.commons.Line getLineInformation(int line) throws BadLocationException
line
- the line that should be describedBadLocationException
- if line is unknown to this trackervoid replace(int offset, int length, String text) throws BadLocationException
offset
- the offset of the replaced textlength
- the length of the replaced texttext
- the substitution textBadLocationException
- if specified range is unknown to this trackervoid set(String text)
text
- the new tracked textorg.eclipse.lsp4j.Position getPositionAt(int position) throws BadLocationException
BadLocationException
int getOffsetAt(org.eclipse.lsp4j.Position position) throws BadLocationException
BadLocationException
Copyright © 2021. All rights reserved.