Disable annoying source code modification indication - visual-studio-code

I don't know what the correct name is for the issue I am having, or whether it is related to my VSCode, or some of its extensions.
Here is a screenshot depicting the problem:
Linux, VSCode 1.19.2

"gitlens.blame.line.enabled": false,// was working in previous versions
"gitlens.currentLine.enabled": false,// in modern version
"gitlens.codeLens.authors.enabled": false,
"gitlens.codeLens.recentChange.enabled": false,

Answer for 2019
Ctrl+Shift+P => "Open Settings"
Ctrl+F for "Show the authorship code lenses"
Deselect the line.

November 2021 review:
(GitLens v10.0.0-11.7.1, VSCode v1.62.0)
Ctrl+Shift+P -> GitLens: Open Settings. Then find "Current Line Blame" and "Git Code Lens" headers. Just deselect big checkboxes located at them:

One can now simply add "gitlens.mode.active": "zen" to settings.json with Gitlens version 9.5.1 to disable the annoying in-line features.
Tested with VScode 1.31.1 on Windows and Mac.

As of 1st Jan, 2022:
Go to settings and search for "current line blame". Then uncheck the option that says Gitlens>Current Line>Enabled

The name of the setting that you're looking for is called, Git Code Lens.
As mentioned in previous replies, there are several options available in the User or Workspace Settings Configuration. In more recent versions of VS Code, you can more easily access those settings from the menu.
On Windows/Linux - File > Preferences > Settings
On macOS - Code > Preferences > Settings
To update this setting for all projects, Navigate under User Settings > Extensions > GitLens. I chose to disable Git Code Lens entirely by deselecting the checkbox for Code Lens: Enabled; however, you may only want to disable certain features or only at the workspace level. I have included a screenshot including some of the settings below.
For additional information on User and Workspace Settings within VS Code:
https://code.visualstudio.com/docs/getstarted/settings

As of version 8.5.6 you can turn it off with:
"gitlens.codeLens.enabled": false

Answer for 2022
Ctrl + Shift + P and write Open Setting then Ctrl + F search for Current Line Blame turn it off.

2021 recent Visual Code. "Current Line Blame" is the one you should be looking for.

Windows 10
VSCode 1.63.2
2022 Git> Decorations: Enabled Solves the problem
Image of vscode settings

I think this is what most people want to achieve. Add these settings to the vscode user preferences:
{
"gitlens.currentLine.enabled": false,
"gitlens.codeLens.authors.enabled": false,
"gitlens.codeLens.recentChange.enabled": false
}
Before:
After:

If you are not using GitLens and you are using GitHistoryDiff it has a setting, "Show git blame information for each line". Uncheck that option.

Related

How do I get around the verified bug in Windows 1903 and launch the VSCode integrated terminal?

I just did a fresh install of Windows 10 Pro version 1903 build 18362.116 and Visual Studio Code. Now the integrated terminal only launches externally.
Pressing Ctrl + ~ results in this.
What am I missing? How do I get it to open integrated again?
EDIT
After working with VSCode team it is a verified bug. See the Github issue here. I posted the workaround as an answer here.
OK, worked through this one in VSCode repo issues.
For now, until it's fixed, turn off ConPTY integration in the User Settings.
💥💥💥
The issue now says use legacy console. To change the setting open a cmd prompt. Right click the title to bring up properties.
Then Uncheck 'Use legacy console'
To change the integrated terminal on Windows, you just need to change the terminal.integrated.shell.windows line:
Open VS User Settings (Preferences > User Settings). This will open two side-by-side documents.
Check if "terminal.integrated.shell.windows" has value "C:\\Bin\\Cmder\\Cmder.exe" setting to the User Settings document on the right.
Remove this line.
Ctrl + ~ will now open integrated terminal of VSCode.
If the above solution doesn't work then can you try below values and check if it works for you:
// Command Prompt
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
// PowerShell
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
From the Command Palette (Ctrl+Shift+P), use the View: Toggle Integrated Terminal command.
Try custom shortcut:
[
{
"key": "ctrl+`",
"command": "workbench.action.terminal.toggleTerminal"
}
]
Had this problem fixed. Found the solution from the VS Code support.
for error:
Terminal exits with code 3221225786 (or similar)#
"This can happen when you have legacy console mode enabled in conhost's properties. To change this, open cmd.exe from the start menu, right-click the title bar, go to Properties and under the Options tab, uncheck Use legacy console."
source: VS Code docs

VS Code : how do I disable copy on selection

I'm using VS Code 1.32 on ubuntu, which i access as a remote client app through ssh on windows.
Whenever I select text using the mouse or the clipboard, it is automatically copied in the clipboard. The only plugins i have are prettier and eslint.
How can i disable that behavior ?
Settings: Editor: Selection Clipboard - uncheck
In the Files/Preferences/Settings search for "Editor: Copy With Syntax Highlighting" and disable it. That worked in my case with VS Code 1.42
Happened to me while using VNC Viewer - The solution was disabling "Send primary selection to viewers" in VNC config window.
Go to File > Preferences > Settings and search for "Right Click Behaviour".
Change the option of Terminal > Integrated: Right Click Behaviour from copyPaste to 'default`.

Remove Parameter Hints Box in Visual Studio Code

Someone know's how to remove this box:
"help" box
It's better showed here
Open the menu, chose the command File > Preferences > Settings to open or create a settings.json file where you can modify the behaviour of Visual Studio Code.
In this file, add the following line at an appropriate place:
"editor.parameterHints": false,
In newer version of Visual Studio Code you have to use this instead:
"editor.parameterHints.enabled": false,
Reference:
Intellisense in Visual Studio Code
Visual Studio Code User and Workspace Settings
I went to File->Preferences->Settings and a tab opened with Commonly Used at the top. Did Ctrl-F to search parameter, then uncheck the box which is saved automatically it will say. Done.
For me it didn't work but someone on github mention that once you start typing, if the parameter hints show up, just press **ctrl + space** and it won't show up again. It was simple and easy!

Turn off auto formatting for json files in Visual Studio Code

I have checked my preference multiple times and ensured that all options related to format-on-save are set to false. And yet everytime I save a .json file I see my file getting formatted.
EDIT: Uninstall the extension, there are many other far better maintained formatters out there (e.g. Beautify)
OK, check if you have installed this extension: "JS-CSS-HTML formatter".
Now if you have, press CTRL+SHIFT+P, type "Formatter" and you should see an option that says Formatter Config.
After selecting that option, a file named formatter.json opens and all you do is edit the property (named onSave) from having true to being false.
Restart vs code and voilà!! It stopped auto formatting. (yay!!!!)
In Visual Studio Code, in order to stop autoformatting only for your json files add the following in settings.json file by opening User Settings - Preferences.
{
"[json]": {
"editor.formatOnSave": false
}
}
In VS Code by default Save without Formatting is done by -
on Windows :
STEP 1 : Press CTRL + K then
STEP 2 : Press CTRL + Shift + S
on MAC :
STEP 1 : Press CMD + K then
STEP 2 : Press S
I am using the below version of VS Code
Version: 1.28.2 (user setup)
Commit: 7f3ce96ff4729c91352ae6def877e59c561f4850
Date: 2018-10-17T00:23:51.859Z
Electron: 2.0.9
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64
And turned it off with the following steps:
CTRL+SHIFT+P
Type Settings
Select Preferences: Open User Settings
Now follow these image instructions:
Select Save All
Restart VS Code
look for Settings.json into "project/.vscode/settings.json"
{
"editor.formatOnSave": false
}
Worth to note
I like the json formatting that is enabled by default but only wanted to disable it when editing certain files (i.e. I didn't want some massive json files expanded after formatting).
To exclude those certain files from auto formatting, I made my changes and saved without formatting.
Go into your vs code keyboard shortcuts and see what Save without formatting is set to. In my case (mac user) it was CMD+K followed by S. If it's not set, create your own custom shortcut.
go to file -> preferences -> settings -> search for
Editor: Auto Indent and select none from drop down
also make this change in setting.json
"editor.formatOnSave": false,
yah this will work...
Solutions All In One
solution 1
config your settings.json file which in the .vscode folder, if not exists, just create one in the project root level directory.
1.1 disabled format on save for all files
{
"eslint.autoFixOnSave": false,
"editor.formatOnSave": false
}
1.2 only disabled format on save for .json file
{
"[json]": {
"editor.formatOnSave": false
}
}
solution 2
just using the VS Code GUI
To open your user and workspace settings, use the following VS Code menu command:
On Windows/Linux: File > Preferences > Settings
On macOS: Code > Preferences > Settings
2.1 open workspace settings
Command + Shift + P / Win + Shift + P
2.2 search the keyword (like, json) and set your config as you want
refs
https://code.visualstudio.com/docs/getstarted/settings
In addition to answers here, there are settings other than "editor.formatOnSave" that might be having a similar effect, which you might also want to disable - for example, I had enabled the following in my User Preferences (settings.json):
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
my format was set to CMD k + s by default for VS Code to save without formatting. you could try that out
Disable the checkbox to disable the code formattor.
If it's for lonefy.vscode-js-css-html-formatter-0.2.3\out\src\formatter.json,
try applying:
{
"onSave": false,
"javascript": {...
...
}

How to prevent Visual Studio Code from always reopening the previous files or folders?

Visual Studio Code always seems to remember my session and reopen the files and/or projects that were open the last time I used it. It obviously behaves correctly when running it from the command line with a file or folder supplied, but when opening from a taskbar shortcut, I'd like it to default to an empty environment.
Is there any way to change this behavior?
You can also go into your settings and use the following:
"window.reopenFolders": "none"
which will not reopen the folders you were working on when you closed the editor. The other options are one (the default) and all.
Edit 2017-11-09:
The option is now changed in latest versions.
"window.restoreWindows": "none"
See Mathieu DOMER's answer.
Edit 2018-09-12:
Another setting related to this is the hotExit setting. This has been discussed in this answer to a related question. To prevent reopening and remembering unsaved files, you can set this to:
"files.hotExit": "off"
But from the test I've made, when the window.restoreWindows setting is set to none, this is not needed. I haven't tested every possible combination, so YMMV.
And to answer a question in the comments, to edit the settings, you have to open the settings file. Some documentation can be found here (at least on the date I am writing this).
Edit 2022-03-16:
If you prefer using a GUI to change the settings, see D'Arcy Rittich's answer.
In VS Code:
for Windows/Linux Ctrl+, (or choose File/Preferences/Settings) to open the settings page.
for Mac ⌘+, (or choose Code -> Preferences -> Settings) to open the settings page.
then type restoreWindows in the Search settings input to filter for this setting. Set it to none and restart VS Code.
With latest update, it seems that the parameter has changed, now use:
"window.restoreWindows": "none"
You can add the -n option to the startup of VS Code and it will always start with an empty window, not restoring your previous session.
01 December 2018
This works for me. i.e. "C:\Users\Sampath\AppData\Local\Programs\Microsoft VS Code\Code.exe" -n
For me, none of above is working while I'm trying to close "dirty" unsaved files which I accidentally edited 1000 files and wanted to ignore saving all of them.
My fix was adding this line into settings.json:
"files.hotExit": "off"
Open up vscode, close vscode and just click the confirmation button to close all of the files without saving.
Then open back vscode and boom.. no more unsaved files being shown.
If "window.restoreWindows": "none" not solve the problem,then try to run code as root -> sudo code --user-data-dir code files and restart code normally without root.
Below worked for me
Right-click on Shortcut and add --disable-gpu to Target as per screen shot.
For me the only solution that worked was to go to the solution root and delete the .vs folder.
I reinstalled Visual Studio Code by downloading the latest update. I did not have to uninstall the previously installed Code. It work ok for me now.