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

Introduce an inline group to debug/callstack/context #95887

Closed
connor4312 opened this issue Apr 22, 2020 · 10 comments
Closed

Introduce an inline group to debug/callstack/context #95887

connor4312 opened this issue Apr 22, 2020 · 10 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@connor4312
Copy link
Member

Refs: #94812

Extensions should be able to contribute actions to be shown inline in items within the call stack view.

@connor4312 connor4312 added the debug Debug viewlet, configurations, breakpoints, adapter issues label Apr 22, 2020
@isidorn isidorn added the feature-request Request for new features or functionality label Apr 22, 2020
@isidorn isidorn added this to the April 2020 milestone Apr 22, 2020
@isidorn
Copy link
Contributor

isidorn commented Apr 22, 2020

As mentioned in the ref issue:

To start we will only support this on the debug session elements.

As the context when the contributed action is triggered on the session we would pass the session id to the extension. You can use the id to match the session, the only problem is that there is no API to get all sessions so you would have to store the session which you create, or to simply listen to our session creation events and store them.

@connor4312
Copy link
Member Author

That's fine for me, js-debug already tracks its sessions for a range of existing functionality.

@isidorn
Copy link
Contributor

isidorn commented Apr 24, 2020

I pushed a change to support this.
I tried out with a toy sample in Mock debug and this works nicely.
@connor4312 let me know how it goes once you try it out in js-debug. Also adding verification-needed so you can add verify if all is good.

Please note the following: all contributed actions will be shown at the start of the toolbar (as you designed in the original issue). If we want to support ordering we can do that but would require more refactoring.

@isidorn isidorn added the verification-needed Verification of issue is requested label Apr 24, 2020
@isidorn
Copy link
Contributor

isidorn commented Apr 24, 2020

We should not forget to mention this in the release notes as it is a new contribution point!

@connor4312
Copy link
Member Author

connor4312 commented Apr 24, 2020

@isidorn I tried this and the button was there but the icon was not show (I could see the tooltip when I hovered where I should have been, I was able to click it). Both using a codicon and a local svg.

These were the two commands I tried: https://github.com/microsoft/vscode-js-debug/blob/882634f32da2d7311bfb710f04eeded5638b011f/src/build/generate-contributions.ts#L963-L974

As:

{
  "command": "extension.NAMESPACE(node-debug).startProfile",
  "group": "inline",
  "when": " !jsDebugIsProfiling"
},
{
  "command": "extension.NAMESPACE(node-debug).stopProfile",
  "group": "inline",
  "when": " jsDebugIsProfiling"
}

(I will add extra parts to the when condition, just made it simple for testing)

Also, it looks like the menu items aren't updated when the context keys change, the same bug we had with the debug toolbar earlier.

@isidorn
Copy link
Contributor

isidorn commented Apr 24, 2020

@connor4312 thanks for trying it out!
I pushed a change that the menu updates on context keys change.
Looking into the icons not being rendered...

@isidorn
Copy link
Contributor

isidorn commented Apr 24, 2020

Ok I looked into it and could not figure it out.
@jrieken @bpasero is there some secret sauce that I am missing to allow extensions to contribute icons to a menu. Action nicely gets added with title text but there is no icon. Looking at the css, the rule to apply the image is not there.
When adding the actions to the actionBar I am using the add({icon: true
Code pointer

data.actionBar.push(primary, { icon: true, label: false });

@jrieken
Copy link
Member

jrieken commented Apr 27, 2020

needs more context. @connor4312 refers to commands defined inside code which puzzles me. This should only work when defining commands inside package.json. For the tweak Idk if there is anything special, check if SCM is doing anything different?

@isidorn
Copy link
Contributor

isidorn commented Apr 27, 2020

Ok I this required some hard core digging to Moria to figure out that I need to have a MenuEntryActionViewItem for my contributed icon to be rendered

So this should now work nicely. @connor4312 please try it out. Thanks
Screenshot 2020-04-27 at 15 10 49

@connor4312
Copy link
Member Author

refers to commands defined inside code which puzzles me

we automate some of the js-debug package.json generation. Saves repetition since many options are shared between debug types, and lets us type-check to contributions to ensure that e.g. all options are documented and all strings are localized.

So this should now work nicely

Validated out of sources, works beautifully, thanks!

@connor4312 connor4312 added the verified Verification succeeded label Apr 27, 2020
leilapearson pushed a commit to relmify/vscode that referenced this issue Apr 27, 2020
connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Apr 27, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants