Record Class LspSymbol

java.lang.Object
java.lang.Record
smile.util.lsp.LspSymbol
Record Components:
name - the symbol name.
kind - the LSP symbol kind integer (1 = File, 2 = Module, 3 = Namespace, 5 = Class, 6 = Method, 7 = Property, 8 = Field, 12 = Function, 13 = Variable, etc.).
containerName - the name of the containing symbol, or null.
uri - the document URI that contains this symbol.
startLine - the 1-based start line.
startCharacter - the 1-based start character offset.
endLine - the 1-based end line.
endCharacter - the 1-based end character offset.

public record LspSymbol(String name, int kind, String containerName, String uri, int startLine, int startCharacter, int endLine, int endCharacter) extends Record
Represents a named symbol (class, method, field, variable, …) inside a document or workspace, as returned by the documentSymbol and workspaceSymbol operations.

All position values are 1-based (as shown in editors).

  • Constructor Details

    • LspSymbol

      public LspSymbol(String name, int kind, String containerName, String uri, int startLine, int startCharacter, int endLine, int endCharacter)
      Creates an instance of a LspSymbol record class.
      Parameters:
      name - the value for the name record component
      kind - the value for the kind record component
      containerName - the value for the containerName record component
      uri - the value for the uri record component
      startLine - the value for the startLine record component
      startCharacter - the value for the startCharacter record component
      endLine - the value for the endLine record component
      endCharacter - the value for the endCharacter record component
  • Method Details

    • fromSymbolInformation

      public static LspSymbol fromSymbolInformation(org.eclipse.lsp4j.SymbolInformation si)
      Creates an LspSymbol from an LSP4J SymbolInformation.
      Parameters:
      si - the LSP4J symbol information.
      Returns:
      the equivalent editor-friendly symbol.
    • fromDocumentSymbol

      public static LspSymbol fromDocumentSymbol(org.eclipse.lsp4j.DocumentSymbol ds, String uri)
      Creates an LspSymbol from an LSP4J DocumentSymbol and its parent document URI.
      Parameters:
      ds - the LSP4J document symbol.
      uri - the document URI that contains this symbol.
      Returns:
      the equivalent editor-friendly symbol.
    • location

      public LspLocation location()
      Returns the location of this symbol.
      Returns:
      the LspLocation.
    • kindName

      public static String kindName(int kind)
      Returns a human-readable name for the given LSP symbol kind integer.
      Parameters:
      kind - the LSP symbol kind value.
      Returns:
      a short descriptive string.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • kind

      public int kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • containerName

      public String containerName()
      Returns the value of the containerName record component.
      Returns:
      the value of the containerName record component
    • uri

      public String uri()
      Returns the value of the uri record component.
      Returns:
      the value of the uri record component
    • startLine

      public int startLine()
      Returns the value of the startLine record component.
      Returns:
      the value of the startLine record component
    • startCharacter

      public int startCharacter()
      Returns the value of the startCharacter record component.
      Returns:
      the value of the startCharacter record component
    • endLine

      public int endLine()
      Returns the value of the endLine record component.
      Returns:
      the value of the endLine record component
    • endCharacter

      public int endCharacter()
      Returns the value of the endCharacter record component.
      Returns:
      the value of the endCharacter record component