From f0dfab51c884a1cacec88c7e5b5255523088f4a6 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Thu, 26 Sep 2024 16:37:27 +0200 Subject: [PATCH] Removing work around in REPL for the watch function Fixes #436 --- .../vscode/lsp/terminal/LSPTerminalREPL.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/terminal/LSPTerminalREPL.java b/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/terminal/LSPTerminalREPL.java index fa079118..66cda73f 100644 --- a/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/terminal/LSPTerminalREPL.java +++ b/rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/terminal/LSPTerminalREPL.java @@ -176,11 +176,7 @@ protected Evaluator constructEvaluator(InputStream input, OutputStream stdout, O for (IValue srcPath : pcfg.getSrcs()) { ISourceLocation path = (ISourceLocation)srcPath; evaluator.addRascalSearchPath(path); - // since the watch function in rascal only works on resolved paths - // we have to resolve the path, until that issue is remedied. - // see issue: https://github.com/usethesource/rascal/issues/1884 - ISourceLocation resolvedPath = safeResolve(reg, path); - reg.watch(resolvedPath, true, d -> sourceLocationChanged(resolvedPath, d)); + reg.watch(path, true, d -> sourceLocationChanged(path, d)); } ClassLoader cl = new SourceLocationClassLoader( @@ -203,16 +199,6 @@ protected Evaluator constructEvaluator(InputStream input, OutputStream stdout, O return evaluator; } - private ISourceLocation safeResolve(URIResolverRegistry reg, ISourceLocation path) { - try { - ISourceLocation result = reg.logicalToPhysical(path); - return result == null ? path : result; - } - catch (Exception e) { - return path; - } - } - private void sourceLocationChanged(ISourceLocation srcPath, ISourceLocationChanged d) { if (URIUtil.isParentOf(srcPath, d.getLocation()) && d.getLocation().getPath().endsWith(".rsc")) { ISourceLocation relative = URIUtil.relativize(srcPath, d.getLocation());