Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing workaround in REPL for the watch function #455

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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());
Expand Down
Loading