Skip to content

"Show in AST viewer" command #707

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

Closed
p0 opened this issue Dec 15, 2020 · 5 comments · Fixed by #712
Closed

"Show in AST viewer" command #707

p0 opened this issue Dec 15, 2020 · 5 comments · Fixed by #712
Labels
enhancement New feature or request VSCode

Comments

@p0
Copy link

p0 commented Dec 15, 2020

Is your feature request related to a problem? Please describe.
I'd like an easy way to view the AST of a particular construct. One workflow I keep trying is right-clicking in a source archive file, and looking for a "show in AST viewer" option.

Describe the solution you'd like
A new command for showing the current file in the AST viewer (if it isn't already there) and navigating to the node whose location is at the cursor.

Describe alternatives you've considered
The current workaround is to navigate to the AST viewer pane, clear the current AST, show the AST for the current file, and then click once more on the construct I want the tree view to navigate to. This could be condensed into a single command invocation.

@p0 p0 added the enhancement New feature or request label Dec 15, 2020
@aeisenberg
Copy link
Contributor

Hmmm...it should be the case that you can invoke "CodeQL: View AST" from the command palette (if the active editor is in a source archive) or from the file explorer by right clicking on a file in a source archive. Is this not working for you?

It would be a nice feature to automatically select the AST node corresponding to the current position of the caret.

The first part is potentially a bug and the second part is a feature enhancement.

@p0
Copy link
Author

p0 commented Dec 16, 2020

Huh, somehow I didn't realise I could use the command palette to trigger AST view on the current file, and that it would replace any currently displayed AST -- my workflow was around clicking the 'show AST' button in the viewer pane, preceded, if necessary, by a click on 'clear AST' in order to make the button visible again. I definitely do not have that option in my right-click context menu, and if it had been there I probably would have discovered it.

Running the command manually (and then clicking to focus on an element's location) is actually enough to unblock me here.

@aeisenberg
Copy link
Contributor

Hmmm...I just want to make sure that you're not seeing something like this:

_Extension_Development_Host__-_affix_js__read-only__—_vscode-codeql-starter__Workspace_

@p0
Copy link
Author

p0 commented Dec 17, 2020

I right-click in the actual source-code view, and I don't see it there.

@aeisenberg
Copy link
Contributor

Ah...yes. That's not implemented. It might be something easy to do. And if so, I'll slip it in right before the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request VSCode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants