How to add a new menu item to the File menu in Visual Studio Code? - visual-studio-code

Is it possible to create an add a custom menu to the main menu bar (preferably the File menu) in Visual Studio with an extension? I want to add a new project type.
Related question as this but for Visual Studio Code instead of Visual Studio:
Adding a Menu to the Visual Studio Menu Bar within an Add-In

I've been looking for the same thing, but currently, I don't think it's possible. This link describes how an extension can create menu items, but the only "contribution points" are in context menus. There is no contribution point for the top-level File menu. I have also been unsuccessful finding a configuration file for editing the existing menus.
Additionally, this other SO post seems to confirm this: VSCode: hiding some default menu items
opened https://github.com/microsoft/vscode/issues/74013

Related

How to get rid of these underlined things in Visual Studio Code?

Whenever I type any HTML code in Visual Studio Code these items underline automatically which make code very illegible. I was looking for some solution but I haven't find anything useful.
Here's the example:
go to Files > Preferences > Settings in your VSCode
then search for editor.links in your settings search bar, uncheck the option Editor: links and thats it

What is that component on the top-right of VS Code called? How can I change the setting of it?

I'm using VS Code on Mac and I was curious about one component.
Every time I open a new python file, this component will show up on the top right of the current window? But I can't find the name of it.
That's not just "one component", but actually multiple buttons added to the editor actions toolbar from multiple extensions installed on your VS Code.
In order from left to right:
Open Changes (built-in with VS Code as part of their Version Control functions)
Run Python File in Terminal (added by Microsoft's own Python extension)
Open Changes in previous revision (added by the GitLens extension)
Show Revision Details (added by the GitLens extension)
Open Changes in next revision (added by the GitLens extension)
Toggle File Blame Annotations (added by the GitLens extension)
Split Editor (built-in with VS Code)
For GitLens, they are automatically added when it detects the currently opened file is part of a git repository. You can configure them by accessing the command palette (CMD+Shift+P on a Mac), then entering "GitLens: Open Settings". Find the "Menus & Toolbars" section:
For example, if you want to remove buttons 3., 4., and 5., uncheck "Add commands to the editor group toolbar" > "Add comparison commands". Then reload VS Code. You can configure all the other settings there.
For the green Play button, it automatically appears when you the currently active file is a Python file. AFAIK, there is no way to configure or hide/remove it other than disabling the Python extension completely (which you certainly don't want to do). There are requests on VS Code's Github page to hide it, like this: Add setting to disable icon for "Run Python File In Terminal".
For the "Open Changes" and "Split Editor" buttons, AFAIK there is no built-in way to hide/remove them. You can only control the behavior from the VS Code settings:
As mentioned in the comments, there is a feature request for VS Code to Allow hiding the buttons in the tab bar line and in the panel title bar, which includes the "Open Changes" and "Split Editor" buttons. There are users who provided workarounds at hiding the buttons using extensions. You may want to follow that thread and/or try out some of those extensions.

How do I remove a section from the Visual Studio Code left side bar?

I've recently re-downloaded Visual Studio Code, but I'm having troubles trying to remove a section in the left side bar. That section is called WWW and it's from the ftp-simple extension. If you don't know what it is, it's a simple extension that allows you to connect to a remove server and manage the files from your editor.
I've uninstalled the extension but the section is still there.
Is there a way to remove it permanently?
Go to the View menu and select Open View. A panel opens and you can select what is displayed in sidebar. If you don't want anything displayed you can hide the sidebar by going to View/Appearance/Toggle Sidebar.

How to open files in new tabs in Visual Studio Code

I recently started using Visual Studio Code and I would like to know, is a way to open files in a new tab? Currently whenever I open a new file the files I currently have open disappear. I say new tab, but any option that will let me open a new file in the same window as the old one works.
I have tried disabling Preview Mode through the workbench settings as shown in this answer: How to config vscode to open files always in a new tab?. However, when I choose Open or Open Recent the new file still replaces my old file.
Thanks.
Once you have to open your settings file, add the "workbench.editor.enablePreview" property and set value to false.
For 1.21.1 version.
In user settings =>
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen"
the best way i found.
Starting with VSCode 1.52 (Nov. 2020), you should not have any more issue: all files will open in new tabs, even in preview mode.
Better handling of preview editors:
Preview editors are now better handled with numerous improvements based on feedback and making this feature work more consistent.
The setting workbench.editor.enablePreviewFromQuickOpen is now disabled by default so that editors opening from quick open will not appear in preview mode anymore.
When you start a navigation (e.g. go to definition), the editor you start from will move out of preview mode to keep it open while the new editor will be in preview mode until you navigate further.
We changed all of our custom trees (the ones used from extensions or Git changes view for example) to work more consistently like our built-in trees (like the explorer).
This means, the following interactions now apply to all of them:
double-click or mouse-middle-click to open non-preview
Enter to open non-preview (Space to open in preview-mode)
Note: if you are the author of an extension that is leveraging our custom tree API, you can benefit from this change as well.
Make sure to use vscode.open or vscode.diff commands for the TreeItem.command and you are in!
A new menu item in the editor overflow menu allows to quickly turn off preview editors altogether:
You need to double click on the name of the file. Also, it needs to be done swiftly elsewhere you will be opening in the same tab.
You can drag and drop file near to the opened tab and the file will open in new tab.
Thanks everyone. Double clicking and dragging was useful, but it still didn't solve my problem when opening files from different projects with the "Open File" menu command. I found that Multi-root Workspaces is what I was looking for. https://code.visualstudio.com/docs/editor/multi-root-workspaces
This is likely due to Visual Studio Code opening file in what's called "Preview Mode", which allows you to quickly view files, ideally if a tab is in Preview Mode then its title in the tab bar, will be italic.
To disable Preview Mode set "workbench.editor.enablePreview": false in your settings file or use the "workbench.editor.enablePreviewFromQuickOpen" option to disable it only from the quick open menu.
Alternatively, use command palette CTL+Shift+P (to get all settings) VScode settings then in User => Workbench => Editor Management you can uncheck Enable Preview and Enable Preview from Quick Open to get the same results described above

Customize interface for Visual Studio Code?

Is it possible to change the user interface for Visual Studio Code? Specifically, is it possible to remove the "Git" and "Debugger" panes? Also, how can you edit the menus in the main menu bar?
You can't change the menu in VSCode. The menu items are fix.
For now (speaking for version 1.2.1) you can change the color theme only to customize the user interface.