From 39ead4b5d117d2387d966048b8eac4e464b2f2a1 Mon Sep 17 00:00:00 2001 From: Toine Hartman Date: Tue, 24 Dec 2024 17:40:36 +0100 Subject: [PATCH 1/2] Interact with type checker using module names. --- .../src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 b7e11922..3a1257d2 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 @@ -458,10 +458,11 @@ private bool rascalContainsName(loc l, str name) { private set[TModel] rascalTModels(set[loc] fs, PathConfig pcfg) { RascalCompilerConfig ccfg = rascalCompilerConfig(pcfg)[verbose = false] [logPathConfig = false]; - ms = rascalTModelForLocs(toList(fs), ccfg, dummy_compile1); + list[str] moduleNames = [getModuleName(mloc, pcfg) | mloc <- fs]; + ms = rascalTModelForNames(moduleNames, ccfg, dummy_compile1); set[TModel] tmodels = {}; - for (modName <- ms.moduleLocs) { + for (str modName <- moduleNames) { = getTModelForModule(modName, ms); if (!found) throw unexpectedFailure("Cannot read TModel for module \'\'\n"); tmodels += convertTModel2PhysicalLocs(tm); From 9b923ea5e128b364e1371717b6fac6b57e9786b7 Mon Sep 17 00:00:00 2001 From: Toine Hartman Date: Wed, 8 Jan 2025 10:15:17 +0100 Subject: [PATCH 2/2] Load all required TModels, not only for top modules. --- .../src/main/rascal/lang/rascal/lsp/refactor/Rename.rsc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 3a1257d2..e9fd2a3a 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 @@ -458,11 +458,11 @@ private bool rascalContainsName(loc l, str name) { private set[TModel] rascalTModels(set[loc] fs, PathConfig pcfg) { RascalCompilerConfig ccfg = rascalCompilerConfig(pcfg)[verbose = false] [logPathConfig = false]; - list[str] moduleNames = [getModuleName(mloc, pcfg) | mloc <- fs]; - ms = rascalTModelForNames(moduleNames, ccfg, dummy_compile1); + list[str] topModuleNames = [getModuleName(mloc, pcfg) | mloc <- fs]; + ms = rascalTModelForNames(topModuleNames, ccfg, dummy_compile1); set[TModel] tmodels = {}; - for (str modName <- moduleNames) { + for (str modName <- ms.moduleLocs) { = getTModelForModule(modName, ms); if (!found) throw unexpectedFailure("Cannot read TModel for module \'\'\n"); tmodels += convertTModel2PhysicalLocs(tm);