Skip to content

Conversation

@jbdoderlein
Copy link
Contributor

This PR fix an error on import command inside the debug console of DAP.

The command import module at REPL level, and reload the module if it is already imported.

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 46%. Comparing base (3ba2f34) to head (07774b1).

Files with missing lines Patch % Lines
src/org/rascalmpl/debug/DebugHandler.java 0% 13 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              main   #2596   +/-   ##
=======================================
- Coverage       46%     46%   -1%     
- Complexity    6623    6625    +2     
=======================================
  Files          793     793           
  Lines        65638   65650   +12     
  Branches      9831    9833    +2     
=======================================
- Hits         30480   30476    -4     
- Misses       32804   32813    +9     
- Partials      2354    2361    +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@jurgenvinju jurgenvinju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good feature! For a future refactoring we could use the command parser instead of the regex. That way we keep the Rascal syntax in one place (Rascal.rsc)

Copy link
Member

@DavyLandman DavyLandman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we continue using the regex (which as @jurgenvinju has some maintainability challenges) we should make sure it matches closer to what the rascal syntax allows for. Such as escapes of module names if they overlap with a keyword of the language.

@jbdoderlein
Copy link
Contributor Author

Fixed, the import now use RascalParser

Comment on lines +285 to +295
IActionExecutor<ITree> actionExecutor = new NoActionExecutor();
ITree tree = new RascalParser().parse(Parser.START_COMMAND, DEBUGGER_PROMPT_LOCATION.getURI(), command.toCharArray(), INodeFlattener.UNLIMITED_AMB_DEPTH, actionExecutor, new DefaultNodeFlattener<IConstructor, ITree, ISourceLocation>(), new UPTRNodeFactory(false));
Command stat = new ASTBuilder().buildCommand(tree);
if (!stat.isImport()) {
return null;
}
Environment oldEnvironment = evaluator.getCurrentEnvt();
evaluator.setCurrentEnvt(evaluator.__getRootScope()); // For import we set the current module to the root to reload modules properly
Result<IValue> result = evaluator.eval(evaluator.getMonitor(), command, DEBUGGER_PROMPT_LOCATION);
evaluator.setCurrentEnvt(oldEnvironment);
return result;
Copy link
Member

@DavyLandman DavyLandman Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make sure that ParseError exceptions are caught, so that if something is not a command, it doesn't bubble up as an exception?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants