diff --git a/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc b/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc index 11234044..2f5b2d1f 100644 --- a/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc +++ b/rascal-lsp/src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc @@ -408,22 +408,13 @@ Cursor rascalGetCursor(TModel ws, Tree cursorT) { return cursor(kind, min(locsContainingCursor.l), cursorName); } -private set[Tree] rascalNameToEquivalentNames(str name) { - set[Tree] equivs = {t - | T <- {#Name, #Nonterminal, #NonterminalLabel} - , just(Tree t) := tryParseAs(T, name) - }; - - if (!startsWith(name, "\\") && just(en) := tryParseAs(#Name, "\\")) equivs += en; - - return equivs; -} +private set[str] rascalNameToEquivalentNames(str name) = + {name, startsWith(name, "\\") ? name : "\\"}; private bool rascalContainsName(loc l, str name) { - m = parseModuleWithSpacesCached(l); - for (n <- rascalNameToEquivalentNames(name)) { - if (/n := m) return true; - } + start[Module] m = parseModuleWithSpacesCached(l); + set[str] names = rascalNameToEquivalentNames(name); + if (/Tree t := m, "" in names) return true; return false; }