How to disable Format Document in VSCode, to excluding one line - powershell

I have this:
--addons=HorizontalPodAutoscaling,HttpLoadBalancing `
Format Document changes to this - adding a space between ","
--addons=HorizontalPodAutoscaling, HttpLoadBalancing `
Is there some [AnalyserIgnoreTheFollowing line...]?

VSCode is highly customizable, and as with all products, it has defaults, but they can be altered using the WOrkspace and user settings.
Visual Studio Code Tips and Tricks
https://code.visualstudio.com/docs/getstarted/tips-and-tricks
Visual Studio Code Formatting Setup
https://medium.com/#hamxiaoz/visual-studio-code-formatting-setup-9f40a95699ce
User and Workspace Settings It is easy to configure VS Code to your
liking through settings. Nearly every part of VS Code's editor, user
interface, and functional behavior has options you can modify.
VS Code provides two different scopes for settings:
User These settings apply globally to any instance of VS Code you open
Workspace These settings are stored inside your workspace in a .vscode
folder and only apply when the workspace is opened. Settings defined
on this scope override the user scope.
Creating User and Workspace Settings
The menu command File > Preferences > Settings (Code > Preferences >
Settings on Mac) provides entry to configure user and workspace
settings. You are provided with a list of Default Settings. Copy any
setting that you want to change to the appropriate settings.json file.
The tabs on the right let you switch quickly between the user and
workspace settings files.
https://vscode.readthedocs.io/en/latest/getstarted/settings
https://code.visualstudio.com/docs/getstarted/settings
You can also configure language based settings by directly opening
settings.json. You can scope them to the workspace by placing them in
the workspace settings just like other settings. If you have settings
defined for a language in both user and workspace scopes, then they
are merged by giving precedence to the ones defined in the workspace.
The following examples customize editor settings for language modes
typescript and markdown.
{
"[typescript]": {
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"[markdown]": {
"editor.formatOnSave": true,
"editor.wordWrap": "on",
"editor.renderWhitespace": "all",
"editor.acceptSuggestionOnEnter": "off"
}
}
You can use IntelliSense in Settings editor to help you find allowed
language based settings. All editor settings and some non-editor
settings are supported
If you find you can't do it there, nothing prevents you from writing your own formatter.
Creating a Formatter Extension
https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices

Related

Is it possible to enable and disable extensions for certain workspace with .vscode

I added some extensions to vscode, including python, c++, flutter, etc. I'm trying to disable some extensions in a specific repo, such as the flutter extension in my frontend repo. I want to save this setting in .vscode so that when I move the repo, vscode will remember the setting.
In order to enable and disable the extensions for a certain workspace in visual studio code.
Go to the extensions on the sidebar and disable/enable for the current workspace. Adding screenshot.
To do this step by step:
On the Extensions sidebar.
Select the extension, then select the 'Disable' button. This will disable the extension for all workspace.
Then select "Enable (workspace)" to enable it for the current workspace.

VSCode Missing settings in settings.json file

I can access the (JSON) file by simply:
Open the command palette (either with F1 or Ctrl+Shift+P)
Type "open settings"
And then choose Open Settings (JSON)
The thing is that when i open those settings all the options presented are these:
"workbench.colorTheme": "Default Dark+",
"python.defaultInterpreterPath": "------------",
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"workbench.editor.enablePreview": false,
Nothing more, I want to change my option through the (JSON) settings.
I even installed the VIM extension and I would love to be able to customize it in the (JSON) file.
Any suggestions?
settings.json is empty by default. It only contains settings that you've modified.
You can show the full list of JSON settings using Ctrl+Shift+P -> Preferences: Open Default Settings (JSON). Or just modify them from the GUI.
Does the json file not just override what is the default setting? so anything you put in there becomes the new default?
(Also, settings can be for a project workspace or global, so is that file in your project?)

No workspace settings in VSCode json settings editor

I created a VSCode workspace
I then saved it as golang.code-workspace file (say) on my Desktop
When double clicking the file, VSCode opens with the expected files on the explorer sidebar.
I now want to edit the particular Workspace's settings, so I hit Command + , on my keyboard.
I am then presented with the following json file(s)
What troubles me is that according to the breadcrump (Users > pantelis > Library > Application Support > Code > User {} settings.json), it seems as if are some kind of global, and not workspace-specific settings.
How can I edit the settings for just the particular workspace I created?
In the UI, the distinction is more clear as you can see in the image below.
Also, in the UI, why do I get (apart from the User settings tab), 2 additional tabs (Workspace and the name of the workspace (golang) I just created?) what is the difference between these two?
There's the command "Preferences: Open Workspace Settings (JSON)" (workbench.action.openWorkspaceSettingsFile) which opens the workspace-specific settings (optionally creating the file ./.vscode/settings.json relative to the workspace root if it doesn't exist yet). The order in which settings are overridden is as follows (from more important to less important):
Workspace settings
Global settings
Default settings
... i.e. if you have a certain setting in your workspace settings, it will override the same setting in your global settings; in the same manner your global settings override the defaults (and the defaults are just what VSCode ships with and what's in force if you don't change anything).

VS Code: What is the difference in settings between User and Workspace

I would like to know what is the difference between changing Visual Studio Code settings in the User and the Workspace tab.
From vscode settings:
VS Code provides two different scopes for settings:
User Settings - Settings that apply globally to any instance of VS Code you open.
Workspace Settings - Settings stored inside your workspace and only apply when the workspace is opened.
Workspace settings override user settings. Workspace settings are
specific to a project and can be shared across developers on a
project.
Note: A VS Code "workspace" is usually just your project root folder.
Workspace settings as well as debugging and task configurations are
stored at the root in a .vscode folder. You can also have more than
one root folder in a VS Code workspace through a feature called
Multi-root workspaces. You can learn more in the What is a VS Code
"workspace"? article.

Separate Visual Studio Code workspace with different extensions for different programming languages

Is it possible to create different Visual Studio Code workspaces separately with extensions? For example, workspace_1 with a C++ extension and workspace_2 with a Python extension.
You can install extensions and then enable/disable them on specific workspaces.
Open a workspace
From the Extensions panel, click on the gear icon of each extension
If it's enabled, you can disable it on this workspace
If it's disabled, you can enable it for this workspace
Click on the three dots at the top-right to list either all enabled or disabled
There is unfortunately no way to configure this from settings.json file (user, workspace, or folder), as the extensions information does not seem to be stored there:
Enabled/Disabled extensions are not stored in workspace settings. Instead it is stored in local storage cache. You can manage them from the extensions view.
More information on Managing Extensions can be found in the Visual Studio Code documentation.
If you want to create a shareable list of extensions for specific workspaces (for example, perhaps to commit to source control or sharing with teammates), you can specify a list of recommended extensions per workspace.
Open the command palette
Enter Extensions: Configure Recommended Extensions (Workspace)
Enter a list of extensions IDs
For example, you want to recommend the "Visual Studio Code Ruby" extension
"extensions": {
"recommendations": [
"wingrunr21.vscode-ruby"
]
}
The format is {publisherName}.{extensionName}
You can get this from the extension's page in Visual Studio Code
When the user opens the workspace for the first time, they will be notified of recommended extensions to install.