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

Add custom view for easy access to the Rascal debugger #564

Merged
merged 26 commits into from
Jan 30, 2025
Merged

Conversation

rodinaarssen
Copy link
Member

@rodinaarssen rodinaarssen commented Jan 28, 2025

This PR adds a custom view to the "Run and Debug" view container in VS Code. This view provides users with a list of running Rascal REPLs within VS Code, with a button to start a debugging session for REPLs that have been initialized and are not already actively being debugged. The active Rascal terminal (if any) is highlighted for convenience.

For a visual impression, see the attached screenshot.

image

Each line represents a single active Rascal terminal. The highlighted line represents the terminal that is currently visible in the UI. The bug button to the right starts a debug session for the associated terminal. The bug icon to the left indicates that a debug session is already active for that terminal.

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.

Nice and compact set of changes to get a great UX feature 👍

rascal-vscode-extension/package.json Show resolved Hide resolved
rascal-vscode-extension/package.json Show resolved Hide resolved
rascal-vscode-extension/src/RascalExtension.ts Outdated Show resolved Hide resolved
rascal-vscode-extension/src/dap/RascalDebugClient.ts Outdated Show resolved Hide resolved
rascal-vscode-extension/src/dap/RascalDebugView.ts Outdated Show resolved Hide resolved
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.

yes, looks very nice.

2 small nits, but 1 point where I think we should be a bit more mindfull of the fact we're running in the UI and shouldn't have a hot loop full of promises.

rascal-vscode-extension/package.json Show resolved Hide resolved
rascal-vscode-extension/src/dap/RascalDebugClient.ts Outdated Show resolved Hide resolved
rascal-vscode-extension/src/dap/RascalDebugView.ts Outdated Show resolved Hide resolved
rascal-vscode-extension/src/dap/RascalDebugView.ts Outdated Show resolved Hide resolved
rascal-vscode-extension/src/dap/RascalDebugView.ts Outdated Show resolved Hide resolved
@rodinaarssen
Copy link
Member Author

For a visual impression, see the attached screenshot.

image

Each line represents a single active Rascal terminal. The highlighted line represents the terminal that is currently visible in the UI. The bug button to the right starts a debug session for the associated terminal. The bug icon to the left indicates that a debug session is already active for that terminal.

@rodinaarssen rodinaarssen merged commit 32b0a8c into main Jan 30, 2025
14 checks passed
@rodinaarssen rodinaarssen deleted the debugger-ux branch January 30, 2025 16:00
return item;
}

makeLabel(label: string, isActiveTerminal : boolean) : string | vscode.TreeItemLabel {
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend using a FileDecoratorProvider to highlight the active terminal instead of "abusing" the highlights concept.

Each of the RascalReplNode will need a unique Uri and the decorator will

  • compare the Uri to the vscode.window.activeTerminal
  • subscribe to the onDidChangeActiveTerminal event to refresh the decoration on the previous and newly active Uris

Decorations can give the active node a badge like "🎯" and give currently-debug-enabled nodes a badge like "🐞"

Copy link
Member

Choose a reason for hiding this comment

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

That is a nice trick indeed :) but in a way, "abusing" a different concept. As a terminal is not a file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, FileDecoratorProvider is an awkward name. It can decorate anything with a Uri. The decorations are most visible in a TreeView, but they also appear on editor tabs.

@urbanfly
Copy link
Contributor

I know this is late feedback, but there may be a simpler way to achieve a similar level of discoverability for the debugging feature without introducing new UI.

Custom commands can be added to the Terminal view. Custom state would need to be maintained when the activeTerminal changes.

"view/title": [
  {
    "command": "rascalmpl.startDebuggerForRepl",
    "when": "view == terminal && rascalTerminalActive && !rascalTerminalDebugging"
    "group": "navigation@1"
  },
  {
    "command": "rascalmpl.stopDebuggerForRepl",
    "when": "view == terminal && rascalTerminalActive && rascalTerminalDebugging"
    "group": "navigation@1"
  }
]

@DavyLandman
Copy link
Member

I know this is late feedback, but there may be a simpler way to achieve a similar level of discoverability for the debugging feature without introducing new UI.

Custom commands can be added to the Terminal view. Custom state would need to be maintained when the activeTerminal changes.

Hmm, this is a nice addition, those small icons are a bit less discoverable, the current view fits better with how other programs that are running can be debugged. But I do think adding such an icon can be a parallel path to discover the debugger. I'll make it into a new issue to track this idea.

@urbanfly please let me know if you would like to turn that into a small PR?

@urbanfly
Copy link
Contributor

I'll consider it.

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.

Improving the interaction with the Rascal debugger
3 participants