Skip to content

Commit 21bec7b

Browse files
committed
Fix findReferences for modules
For modules we sometimes get the module class instead of the module val as symbol. In that case we should not filter references by the module class name but by the module name.
1 parent ae66277 commit 21bec7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class DottyLanguageServer extends LanguageServer
243243
// FIXME: this will search for references in all trees on the classpath, but we really
244244
// only need to look for trees in the target directory if the symbol is defined in the
245245
// current project
246-
val trees = driver.allTreesContaining(sym.name.toString)
246+
val trees = driver.allTreesContaining(sym.name.sourceModuleName.toString)
247247
val refs = Interactive.namedTrees(trees, includeReferences = true, (tree: tpd.NameTree) =>
248248
(includeDeclaration || !Interactive.isDefinition(tree))
249249
&& Interactive.matchSymbol(tree, sym, includeOverridden = true))
@@ -262,7 +262,7 @@ class DottyLanguageServer extends LanguageServer
262262

263263
if (sym == NoSymbol) new WorkspaceEdit()
264264
else {
265-
val trees = driver.allTreesContaining(sym.name.toString)
265+
val trees = driver.allTreesContaining(sym.name.sourceModuleName.toString)
266266
val linkedSym = sym.linkedClass
267267
val newName = params.getNewName
268268

0 commit comments

Comments
 (0)