Skip to content

Commit 6429b4b

Browse files
committed
backport: use uri from params in pc for location
1 parent aee3230 commit 6429b4b

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

Diff for: presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ class PcDefinitionProvider(
131131
otherDefs.headOption.orElse(exportedDefs.headOption) match
132132
case Some(srcTree) =>
133133
val pos = srcTree.namePos
134-
pos.toLocation match
135-
case None => DefinitionResultImpl.empty
136-
case Some(loc) =>
134+
if pos.exists then
135+
val loc = new Location(params.uri().toString(), pos.toLsp)
137136
DefinitionResultImpl(
138137
SemanticdbSymbols.symbolName(sym),
139-
List(loc).asJava
138+
List(loc).asJava,
140139
)
140+
else DefinitionResultImpl.empty
141141
case None =>
142142
DefinitionResultImpl.empty
143143
else

Diff for: presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala

-6
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ object InteractiveEnrichments extends CommonMtagsEnrichments:
9999
def focusAt(point: Int): SourcePosition =
100100
pos.withSpan(pos.span.withPoint(point).focus)
101101

102-
def toLocation: Option[l.Location] =
103-
for
104-
uri <- InteractiveDriver.toUriOption(pos.source)
105-
range <- if pos.exists then Some(pos.toLsp) else None
106-
yield new l.Location(uri.toString(), range)
107-
108102
def encloses(other: SourcePosition): Boolean =
109103
pos.start <= other.start && pos.end >= other.end
110104

0 commit comments

Comments
 (0)