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 possibility of DebugVariables navigation #10165

Conversation

federicobozzini
Copy link
Contributor

What it does

In some cases it might be useful to allow navigating DebugVariables, making it possible to understand things like what is their parent in the Debug panel or in which scope they are defined.

An example might be the theia-cpp-extension where the context of a variable is important. Another example is adding different menus on C modules if they are shown as sub-elements of a scope.

How to test

To test this some new code needs to be defined. It would be possible to just add a new command that as an example prints the name of the scope of a variable in debug-frontend-contribution:

        registry.registerCommand(DebugCommands.PRINT_SCOPE, {
            execute: () => {
                if (this.selectedVariable) {
                    let v: ExpressionContainer = this.selectedVariable;
                    while (v instanceof DebugVariable) {
                        v = v.parent;
                    }
                    if (v instanceof DebugScope) {
                        console.log(v.name);
                    }
                }
            },
            isEnabled: () => true,
            isVisible: () => true,
        });

with the necessary code on top of it. If a local variable is selected and the command PRINT_SCOPE is executed Local will be printed.

Review checklist

Reminder for reviewers

@msujew msujew added the debug issues that related to debug functionality label Sep 27, 2021
@colin-grant-work colin-grant-work self-requested a review September 27, 2021 22:15
Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

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

This looks good to me. Since these are effectively tree items, it makes sense that they should satisfy more of the TreeItem interface, including a public parent field.

packages/debug/src/browser/console/debug-console-items.tsx Outdated Show resolved Hide resolved
@federicobozzini federicobozzini force-pushed the debugvariables-navigation branch from d15c344 to 44912d7 Compare September 28, 2021 09:07
@colin-grant-work colin-grant-work merged commit 564a3c7 into eclipse-theia:master Sep 28, 2021
@vince-fugnitto vince-fugnitto added this to the 1.18.0 milestone Sep 30, 2021
@federicobozzini federicobozzini deleted the debugvariables-navigation branch October 28, 2021 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug issues that related to debug functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants