How to add an icon in Activity bar of Visual Studio Code that will trigger a keyboard shortcut - visual-studio-code

Is it possible to add an icon in Activity bar of Visual Studio Code that will trigger a keyboard shortcut like Ctrl+Shift+P. Or executing a command from Command Palette.

Only extensions can add an icon in the activity bar (officially called a "views container"). They cannot trigger a command, though. See the official documentation here:
https://code.visualstudio.com/api/extension-capabilities/extending-workbench
https://code.visualstudio.com/updates/v1_23#_custom-activity-bar-views
However, maybe these extensions might fit your needs, they allow creation of custom commands in the status bar or the editor menu bar:
https://marketplace.visualstudio.com/items?itemName=seunlanlege.action-buttons
https://marketplace.visualstudio.com/items?itemName=jerrygoyal.shortcut-menu-bar

Related

How Can I Remove the Visual Studio Code Top Bar?

How to hide the whole top bar?
I cannot find online how to hide/show it.
The top bar is called Command Center. To hide it:
Open VS Code settings with Ctrl+, (or ⌘+, for MacOS)
Search for "Window: Command Center" and turn the settings off

Custom command palette in VSCode Extension

I am developing a VSCode extension that adds a status bar item. I want that when clicked, it will open a custom command palette with special commands. The functionality I am looking for is very similar to the built in Git item on the left of the status bar, which when clicked open a palette that offer to do Git stuff.
The built-in Git item uses the QuickPick Capability.
Check out the API here, and a demo here.

Stop Auto complete with space bar

I am using Visual studio Code and when entering a new code a space bar triggers insertion of suggested auto complete. (which is the default behaviour). I still want auto complete just with tab or enter only. Note I have the C# extension. When I press a space bar I would like a space.
Is there a way to get this behaviour?
Have looked through all the Settings and see that the Tap is optional but not the space bar.
Go to file > preferences > keyboard shortcuts and look for acceptSelectedSuggestion to disable this shortcut.

How do you show what function you are in in Visual Studio Code?

How do I show what function I'm in? I'd like to be able to see where ever I place my cursor, to see what function I'm in preferably in the footer tray bar.
As mentioned in the comments, this can be achieved without any extension by opening command palette and selecting "View: Toggle Breadcrumbs"
There appears to be a functional extension for this mentioned in the GitHub issue:
Show the current function/method name in the toolbar:
https://github.com/Microsoft/vscode/issues/32869
Here is the extension:
https://marketplace.visualstudio.com/items?itemName=amos402.scope-bar

How to show frequently used commands in toolbars under the menu bar in VScode

How to show frequently used commands in toolbars under the menu bar in VScode?
In Visual Studio, frequently used commands are placed in some toolbars. We can click them easily with a mouse, not using keyboard shortcuts.
Is there a way to set up toolbars in VScode like Visual Studio?
No, this is currently not possible (VSCode doesn't have one built-in, and the extension API is rather limited when it comes to customizing UI). There was a feature request for this, but it was considered "out of scope":
Support a real toolbar below the window title with actions (#18042)
Note that the extension API does allow you to customize the buttons shown in the upper right of editors, so that could be a workaround in the meantime:
The contribution point is the editor/title mentioned here. This is how the built-in markdown extension adds the additional Open preview to the Side button for .md files:
The third-party Markdown Shortcuts extension takes this even further, adding controls for editing such as Toggle bold, Toggle italic etc:
I made the extension just for this purpose.. you can add buttons like beautify, list files, undo, redo, save all etc to the editor menu bar in the VSCode. checkout
Shortcut Menu Bar