How can I make a custom GUI button for a specific keyboad command in vscode? - visual-studio-code

I want to make a custom GUI button for a specific keyboad command in vscode. I have read a related question's answer here. But it didn't answer about making a separate GUI button.
Suppose, I want to make a GUI button to run tasks.json whose keyboard shortcut is Ctrl+Shift+B.
How can I achieve this?

Related

How to add a shortcut for "Launch the selected target in terminal window" button?

I use Visual Studio Code and the CMake extension (twxs.cmake). The extension integrates CMake to vscode. There is a button which allows us to run a target in terminal window. It looks like a play button. .
My question is, how can I add a keyboard shortcut for this button? I cannot find the action name so I cannot link it. I wish to use keyboard shortcut instead of clicking that button every time.
I tried googling the action name of this button so I could bind it with any keyboard shortcut, but I couldn't find anything.
Any help will be appreciated.
Thank you in advance!
Shift+F5 appears to do the same thing as clicking that button.
I found the following here:
Running Targets Without a Debugger
Sometimes one will want to just run a target and see its output. This
can be done with the CMake: Execute the current target without a
debugger command, or the associated keybinding (the default is
Shift+F5).
The output of the target will be shown in an integrated terminal.

How to get command activation source on VS Code extension?

I have a myExtension.doSomething command.
I have set it to be callable from right click, Command Palette, Activity Bar, Keyboard Shortcuts or clicking on the WebView button.
Now, I've been asked to identify the call source.
I'd prefer to not create myExtension.doSomething.rightClick, myExtension.doSomething.webview, etc.
I've checked and this does not come in the default args when the command handler is called.

Is it possible to go back one level of breadcrumbs using hotkey in VS Code?

VSCode has breadcrumbs feature that looks like this:
Is it possible to go back one level in these breadcrumbs using a hotkey? So in the case above, I am inside propTypes. I press hotkey and I go to BatchTypesTable.
I can achieve this already by clicking on the breadcrumb itself but I want to have a hotkey to do this.
On MacOS, my keyboard workflow is:
open breadcrmb with shiftcommand.
then navigate the top level with option← and option→
use plain arrows to navigate inside the drop-down list
So, I guess on windows top-level navigation would be alt←?
Relevant VSC documentation here. Although it seems to be incomplete and partially incorrect?

How to make GraphicalEditorWithFlyoutPalette's PaletteView visible on first start

My GEF editor (extending GraphicalEditorWithFlyoutPalette) always opens the editor with the palette hidden on first start of the application / first opening of the editor (after a build for example).
As this will potentially bewilder users who'll need to go in search of the flyout icon first, I'd like to have the palette view shown whenever the editor is opened. The user can then choose to close it on his/her preferences.
How can I achieve this? The API doesn't seem to give any clues, or I'm unable to find them...
The state of the palette defines if it is open or closed. This state is accessible using the getPalettePreferences().setPaletteState() method that is accessible in the GraphicalEditorWithFlyoutPalette. To open the palette, you must set it to the FlyoutPaletteComposite.STATE_PINNED_OPEN, like this:
getPalettePreferences().setPaletteState(FlyoutPaletteComposite.STATE_PINNED_OPEN);
If you want to ALWAYS override the state so that the palette is always opened with the editor, you have to add the line to the constructor of your editor. If you only want to do this once, and then leave the state as it was last selected by the user... No idea how to do this :-(

How do I move shortcut buttons into the GUI

Is there anyway of moving common tasks like uncommenting code (I see I can only do it for a limited selection of things like refactoring etc) onto the main GUI as a button - much like visual studio's buttons?
Commenting and uncommenting code is cmd-/.
The general answer to this question is no.
Shortcut is handy. Hit cmd-shift-? to bring down the help menu and put focus in the search field. Type something like "comment" and it'll find matching menu items.
You can customize with prebuilt actions by right/option-clicking on the toolbar and ->customize.
As for anything real custom, you have to learn the keyboard shortcuts for them.