Verified Owner
Top Description Constructors Methods
org.jabref.languageserver.util

public Class LspRangeUtil

extends Object
Class Inheritance
Imports
org.jabref.logic.importer.ParserResult, org.eclipse.lsp4j.Position, .Range

Because only postions are supported by the lsp https://github.com/microsoft/language-server-protocol/issues/96 we need to convert back and forth

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int
public static Position
convertToLspPosition(String content, int index)

public static Range
public static Range
convertToLspRange(int
line starting at 1
line
,
int
column starting at 1
colStart
,
int
column starting at 1
colEnd
)

Returns: the LSP4J Range of the line and columns

public static Range
convertToLspRange(String content, int startIndex, int endIndex)

public static boolean
isPositionInRange(Position position, Range range)

public static boolean
isRangeInRange(Range outer, Range inner)

public static int
toOffset(String content, Position pos)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LspRangeUtilback to summary
public LspRangeUtil()

Method Detail

comparePositionsback to summary
public static int comparePositions(Position p1, Position p2)
convertToLspPositionback to summary
public static Position convertToLspPosition(String content, int index)
convertToLspRangeback to summary
public static Range convertToLspRange(Range range)
convertToLspRangeback to summary
public static Range convertToLspRange(int line, int colStart, int colEnd)
Parameters
line:int

line starting at 1

colStart:int

column starting at 1

colEnd:int

column starting at 1

Returns:Range

the LSP4J Range of the line and columns

convertToLspRangeback to summary
public static Range convertToLspRange(String content, int startIndex, int endIndex)
isPositionInRangeback to summary
public static boolean isPositionInRange(Position position, Range range)
isRangeInRangeback to summary
public static boolean isRangeInRange(Range outer, Range inner)
toOffsetback to summary
public static int toOffset(String content, Position pos)