Skip to content

Commit

Permalink
backport: use uri from params in pc for location
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Oct 11, 2024
1 parent aee3230 commit 6429b4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ class PcDefinitionProvider(
otherDefs.headOption.orElse(exportedDefs.headOption) match
case Some(srcTree) =>
val pos = srcTree.namePos
pos.toLocation match
case None => DefinitionResultImpl.empty
case Some(loc) =>
if pos.exists then
val loc = new Location(params.uri().toString(), pos.toLsp)
DefinitionResultImpl(
SemanticdbSymbols.symbolName(sym),
List(loc).asJava
List(loc).asJava,
)
else DefinitionResultImpl.empty
case None =>
DefinitionResultImpl.empty
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ object InteractiveEnrichments extends CommonMtagsEnrichments:
def focusAt(point: Int): SourcePosition =
pos.withSpan(pos.span.withPoint(point).focus)

def toLocation: Option[l.Location] =
for
uri <- InteractiveDriver.toUriOption(pos.source)
range <- if pos.exists then Some(pos.toLsp) else None
yield new l.Location(uri.toString(), range)

def encloses(other: SourcePosition): Boolean =
pos.start <= other.start && pos.end >= other.end

Expand Down

0 comments on commit 6429b4b

Please sign in to comment.