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 variables to "VARIABLES" panel automatically. #168

Open
senhui2intel opened this issue Jul 19, 2022 · 14 comments
Open

Add variables to "VARIABLES" panel automatically. #168

senhui2intel opened this issue Jul 19, 2022 · 14 comments

Comments

@senhui2intel
Copy link

There are only two variables in the "VARIABLES" Panel for now: $PWD and $?. The variable HELLO declared by last line is not added to "VARIABLES" Panel automatically. I have to add it to watch manually.

When I debug other language such python, variables are usually add to "VARIABLES" panel automatically. If this feature could be implemented, the user experience will be greatly improved.

Thanks!

image

image

@Makeshift
Copy link

I was hoping this could be worked around by adding a hack to the Watch list, eg $(printenv), but sadly that doesn't work due to #144

@Makeshift
Copy link

I think it might be possible to add them automatically to the watch list, if not the variables panel, with something along the lines of:

await vscode.commands.executeCommand<vscode.Location[]>('workbench.debug.viewlet.action.addWatchExpression', `${variables[0].name}`);

I tried to code this into the extension but unfortunately can't test it as my extension development host starts then exits the extension immediately in development mode :(

@amlamarra
Copy link

+1 for this. Would be great to get it fixed.

@nixomose
Copy link

+1 from me too, but this is so awesome to begin with, I'm happy enough. I can see where this is hard because how do you distinguish existing environment variables from ones set by the script?

@ioogithub
Copy link

ioogithub commented Oct 4, 2023

This would be the number one reason for using this extension and the first thing I looked for after installing it. Is there no work around for this, the functionality simply does not exist?

@nixomose
Copy link

nixomose commented Oct 4, 2023

add watches for the ones you want to look at.
consider the alternative, there's no way to tell one environment variable from the other being local or not, so if you put all the environment variables in the locals list, it would be unreadable and nearly useless anyway.

@ioogithub
Copy link

add watches for the ones you want to look at.

Thanks for replying. I would like to try this but I don't know how to do this. Do any of the videos here show how to add watchers: https://github.com/rogalmic/vscode-bash-debug and where to see their status?

@ioogithub
Copy link

In this video: https://raw.githubusercontent.com/rogalmic/vscode-bash-debug/gif/images/bash-debug-samp-watch-advanced.gif he adds a watcher: ${PWD -4 and that returns the last 4 characters of the file path? I have no idea what this means, how is this a watcher?

@nixomose
Copy link

nixomose commented Oct 5, 2023

not sure what you mean by "watcher" but you see the panel he's putting that ${PWD - 4} in, that's the 'watch window' or watch panel. all it means is that it the debugger will evaluate the expression in the watch window when the debugger stops to let you step through the next line. It's just like the local variables window except instead of trying to evaluate all local variables it only evaluates what you've specifically listed as wanting to watch.
The particular watch expression ${PWD - 4} is bash string manipulation... https://tldp.org/LDP/abs/html/string-manipulation.html
see the bit about "substring extraction", it takes the value of $PWD and strips off everything but the last 4 characters.

So anyway, all the watch window is doing is evaluating ${PWD - 4} every time you step through a line in the debugger.

@pgeng-nv
Copy link

This is a duplicate of #98. It's an unknown issue and hasn't been fixed unfortunately.

@Chealer
Copy link

Chealer commented Jul 22, 2024

@pgeng-nv : Thanks, but ticket #98 is a question (indeed related).

@Chealer
Copy link

Chealer commented Jul 22, 2024

@senhui2intel : This is an issue tracker. Please retitle this ticket as an issue report. For example:

Most variables not added to "VARIABLES" panel automatically

Also, please clarify your description adding text to make it obvious that the second screenshot is a screenshot of a different script. For example, you could add a "Screenshot of the Python debugger on an equivalent script" caption to the image. Or, you could modify the screenshot highlighting the word "Python".

@Chealer
Copy link

Chealer commented Jul 22, 2024

there's no way to tell one environment variable from the other being local or not, so if you put all the environment variables in the locals list, it would be unreadable and nearly useless anyway.

That depends on how the list is sorted, and on whether it can be filtered.

@Chealer
Copy link

Chealer commented Jul 22, 2024

Can someone with the necessary privileges please:

  1. "pin" this ticket
  2. link to this ticket from the Overview tab's Limitations and known problems section (unless this can be fixed in the very short term)

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

No branches or pull requests

7 participants