Record Class LspLocation
java.lang.Object
java.lang.Record
smile.util.lsp.LspLocation
- Record Components:
uri- the document URI (e.g.file:///home/user/Foo.java).startLine- the 1-based start line of the range.startCharacter- the 1-based start character offset of the range.endLine- the 1-based end line of the range.endCharacter- the 1-based end character offset of the range.
public record LspLocation(String uri, int startLine, int startCharacter, int endLine, int endCharacter)
extends Record
A source location returned by LSP operations — a file URI together with
the start and end positions of the relevant text range.
All position values are 1-based (as shown in editors).
-
Constructor Summary
ConstructorsConstructorDescriptionLspLocation(String uri, int startLine, int startCharacter, int endLine, int endCharacter) Creates an instance of aLspLocationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionend()Returns the end position of this location.intReturns the value of theendCharacterrecord component.intendLine()Returns the value of theendLinerecord component.final booleanIndicates whether some other object is "equal to" this one.static LspLocationfromProtocol(org.eclipse.lsp4j.Location loc) Builds anLspLocationfrom an LSP4JLocation.final inthashCode()Returns a hash code value for this object.start()Returns the start position of this location.intReturns the value of thestartCharacterrecord component.intReturns the value of thestartLinerecord component.toString()Returns a string representation of this record class.uri()Returns the value of theurirecord component.
-
Constructor Details
-
LspLocation
Creates an instance of aLspLocationrecord class.- Parameters:
uri- the value for theurirecord componentstartLine- the value for thestartLinerecord componentstartCharacter- the value for thestartCharacterrecord componentendLine- the value for theendLinerecord componentendCharacter- the value for theendCharacterrecord component
-
-
Method Details
-
fromProtocol
Builds anLspLocationfrom an LSP4JLocation. Converts 0-based LSP coordinates to 1-based editor coordinates.- Parameters:
loc- the LSP4J location.- Returns:
- the equivalent editor-friendly location.
-
start
Returns the start position of this location.- Returns:
- the 1-based start
LspPosition.
-
end
Returns the end position of this location.- Returns:
- the 1-based end
LspPosition.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
uri
-
startLine
-
startCharacter
public int startCharacter()Returns the value of thestartCharacterrecord component.- Returns:
- the value of the
startCharacterrecord component
-
endLine
-
endCharacter
public int endCharacter()Returns the value of theendCharacterrecord component.- Returns:
- the value of the
endCharacterrecord component
-