-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
…the Rascal debugger and started hooking things up
There was a problem hiding this 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 👍
… correspondingly" This reverts commit 3a41a23.
There was a problem hiding this 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.
For a visual impression, see the attached screenshot. 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. |
Quality Gate passedIssues Measures |
return item; | ||
} | ||
|
||
makeLabel(label: string, isActiveTerminal : boolean) : string | vscode.TreeItemLabel { |
There was a problem hiding this comment.
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 "🐞"
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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"
}
] |
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? |
I'll consider it. |
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.
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.