final class DefinitionProvider extends AnyRef
Implements goto definition that works even in code that doesn't parse.
Uses token edit-distance to align identifiers in the current open buffer with symbol occurrences from the latest SemanticDB snapshot.
The implementation logic for converting positions between the latest SemanticDB snapshot and current open buffer is quite hairy. We need to convert positions in both the "source" (where definition request is made) and the "destination" (location of the symbol definition). This requires using token edit distance twice:
- source: dirty buffer -> snapshot - destination: snapshot -> dirty buffer
- Alphabetic
- By Inheritance
- DefinitionProvider
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new DefinitionProvider(workspace: io.AbsolutePath, mtags: Mtags, buffers: Buffers, index: GlobalSymbolIndex, semanticdbs: Semanticdbs, warnings: Warnings, compilers: () => Compilers, trees: Trees, buildTargets: BuildTargets, scalaVersionSelector: ScalaVersionSelector, saveDefFileToDisk: Boolean, sourceMapper: SourceMapper, workspaceSearch: WorkspaceSymbolProvider)(implicit ec: ExecutionContext, rc: ReportContext)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def definition(path: io.AbsolutePath, pos: Int): Future[DefinitionResult]
- def definition(path: io.AbsolutePath, params: TextDocumentPositionParams, token: CancelToken): Future[DefinitionResult]
- def definitionPathInputFromSymbol(sym: String, source: Option[io.AbsolutePath]): Option[VirtualFile]
Returns VirtualFile that contains the definition of the given symbol (of semanticdb).
- val destinationProvider: DestinationProvider
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fromSearch(path: io.AbsolutePath, pos: org.eclipse.lsp4j.Position, token: CancelToken): Option[DefinitionResult]
Tries to find an identifier token at the current position to use it for symbol search.
Tries to find an identifier token at the current position to use it for symbol search. This is the last possibility for finding the definition.
- path
path of the current file
- pos
position we are searching for
- returns
possible definition locations based on exact symbol search
- def fromSymbol(sym: String, targets: List[BuildTargetIdentifier]): java.util.List[Location]
- def fromSymbol(sym: String, source: Option[io.AbsolutePath]): java.util.List[Location]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def positionOccurrence(source: io.AbsolutePath, dirtyPosition: org.eclipse.lsp4j.Position, snapshot: TextDocument): ResolvedSymbolOccurrence
- def positionOccurrences(source: io.AbsolutePath, dirtyPosition: org.eclipse.lsp4j.Position, snapshot: TextDocument): List[ResolvedSymbolOccurrence]
Find all SymbolOccurrences for the given position.
Find all SymbolOccurrences for the given position. Multiple symbols might be attached, for example extension parameter. see: https://github.com/scalameta/metals/issues/3133
- val scaladocDefinitionProvider: ScaladocDefinitionProvider
- def symbolOccurrence(source: io.AbsolutePath, dirtyPosition: org.eclipse.lsp4j.Position): Option[(SymbolOccurrence, TextDocument)]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)