I am using Visual Studio Code to program in C++ but it keeps giving me error squiggles. I tried disabling them in the settings by changing C_Cpp error squiggles to disabled but they still appear. Is there anything else I need to do to disable them as I find them very annoying?
The straightforward thing works
What you said you did works for me in VSCode 1.37.1.
Before, with defaults:
Changing the setting:
After:
Excerpt of settings.json:
{
....
"C_Cpp.errorSquiggles": "Disabled"
}
Hypotheses about why it did not work for you
There is another settings.json attribute called C_Cpp.default.enableConfigurationSquiggles. Might you have accidentally changed that one?
Is "C_Cpp: Intelli Sense Engine" set to "Default"? It should be (rather than "Tag Parser") in order to disable squiggles.
Maybe the syntax error you have is different somehow?
For ease of reproduction, it would help to see your settings.json, c_cpp_properties.json, and an example of erroneous syntax with squiggles.
Currently, there is no settings to turn the error decorations off but some language extensions implement their own solutions.
If you are looking for a language agnostic solution, you can make the squiggly lines transparent by adding following setting to general settings or workspace settings file.
"workbench.colorCustomizations": {
// ↓↓
"editorError.foreground": "#00000000"
}
For a specific language:
"workbench.colorCustomizations": {
"[jsonc]": {
// ↓↓
"editorError.foreground": "#00000000"
}
}
Please note that we use 8-digit hex value, the first six is not important but last two should be zero to make the color transparent.
Here is how you can do it programmatically in an extension:
workspace.getConfiguration('workbench').update( 'colorCustomizations', {
"editorError.foreground": "#00000000",
});
just go to command palette (ctrl + shift + P) and then search C/C++ enable error squiggles and select that. Done
Related
In the VS code editor, the default setting is to replace tabs by spaces, which is what I want. However, this is disastrous in a make file. I have written a make file (named Makefile) but VS code insists on changing tabs to spaces so I get a "Missing Separator" error when I run make.
If I go to File > Preferences > Settings and type #id:editor.insertSpaces in the menu, I see this:
When I click on Modified elsewhere I see this:
The second screenshot seems to says that the editor won't insert spaces in a Makefile, but it certainly is. What am I doing wrong, or what have I failed to do?
Try modifing settings.json
VScode Settings
There are 3 levels (by higher priority)
Worspace Settings JSON
User Settings JSON
Default Settings JSON
This should fix most inconveniences:
"[markdown]": {
"files.trimTrailingWhitespace": false,
"editor.insertSpaces": false
},
What worked for me was adding the following to settings.json:
"[makefile]": {
"editor.insertSpaces": false
},
I am in the process of migrating from Atom to VS Code, as it seems to be what all the cool kids use these days.
In atom I was able to highlight the current line number as pictured (the blue highlight in the gutter).
Is there a way to do this in VS Code? With a setting or extension? Can't find a way to do it, and really missing that obvious at-a-glance indication of where I'm working.
(I know that I can add a background to the current line itself, but this is too intrusive to the code, especially working with a variety of languages in different colours.)
Thanks!
You could try
"editor.renderLineHighlight": "gutter"
UPDATE
In an ideal world I'd want both the gutter and the line itself highlighted, but in 2 very different colours - sadly that one doesn't seem possible, but this option is better than nothing!
Well, you may try something like settings below, liner number in different color as well as box for the line
"editor.renderLineHighlight": "all",
"workbench.colorCustomizations": {
"editor.lineHighlightBackground": "#00000000",
"editor.lineHighlightBorder": "#0000ff"
}
To address dark and light themes
In the settings.json file add something like:
"workbench.colorCustomizations": {
"[Default Dark+]": {
"editor.lineHighlightBackground": "#00000071",
},
"[Default Light+]": {
"editor.lineHighlightBackground": "#0000003f",
}
},
I'm used to check all my changes before committing anything. Therefore I mainly use the keyboard this way:
Open the files diff-viewer
Use shortcut for command workbench.action.compareEditor.nextChange to navigate through all changes (Alt+Down in my case)
Unfortunately the currently "selected" change is very hard to distinguish from all others, which makes this workflow a little cumbersome:
I just realized that I could customize this by changing editor.lineHighlightBackground or editor.lineHighlightBorder but this would change the highlighting of the currently active line in all views which is not what I want.
Can I somehow customize editor.lineHighlightBorder only for the diff view?
Something like:
"workbench.colorCustomizations": {
"editorCursor.foreground": "#f9ae58",
"[diff]": {
"editor.lineHighlightBorder": "#fff",
}
},
In your colorCustomizations just type "diff" (without the quotes) and you will see various options like:
"diffEditor.removedTextBorder": "#ff0000",
"diffEditor.removedTextBackground": "#ff0000",
"diffEditor.insertedTextBackground": "#ff0000",
"diffEditor.insertedTextBorder": "#ff0000",
So no I don't think you can change the currently selected line only in the diffEditor. There is no such option. Also, the colorCustomizations do not support the language-specific settings like the other settings do. But maybe playing with the four options above will help?
After installing ESLint in VSCode, I'm receiving some warnings like:
'variable' is assigned a value but never used
The underline color is red, but how do I change that color? I have tried:
"workbench.colorCustomizations": {
"editorWarning.foreground": "#00FF00",
"editorError.foreground": "#00FF00",
"editorWarning.border": "#00FF00",
"editorError.border": "#00FF00"
}
but they change the color of the underlined border, which is not the squiggly one as shown here:
How do I change that red color into #00FF00 instead?
The answers here talk about changing the color for all kind of errors (not just from the eslint).
I'm not sure this is what intended (at least I didn't want it to behave like that).
I wanted to show all JS errors in red but all ESLint errors in orange (as warnings).
The way to do it is by editing eslint.rules.customizations at the settings:
"eslint.rules.customizations": [
{ "rule": "*", "severity": "warn" },
]
See more info at the ESLint plugin homepage
You probably want to customize your eslint config to set these as warnings instead of errors. But if you want to change the color of all error squigglies in the app, this works for me:
"workbench.colorCustomizations": {
"editorError.foreground": "#00ff00"
}
VSCode v1.17 added the ability to set the color of warnings ("squiggles") and info:
Modify warning and info squiggles.
"workbench.colorCustomizations": {
"editorWarning.foreground": "#ff0",
"editorInfo.foreground": "#00f"
}
[This answer Also added to squiggles for TSLint]
For me after many try to change "workbench.colorCustomizations" from VSC settings but not satisified result .
I found out that TsLint Extention i use is (deprecated)
and their is another one from microsoft not egamma
but after i install this one every thing back to normal
My configurations currently show the same red squiggly line for Typescript errors and TSLint warnings.
I am using TSLint extension for Visual Studio Code but the configuration I believe is a general VS Code configuration.
This is what it should look like:
I found this feature request to take it further than just Squiggly lines.
It's not a duplicate of "How to change error styles in VS Code" because I need to change the color of Lint's warnings only. NOT every error.
There is a setting to have the tslint extension return warnings (green) instead of errors (red): "tslint.alwaysShowRuleFailuresAsWarnings": true
Also, you can change your tslint config to determine which issues are errors, and which are warnings.
VSCode v1.17 added the ability to set the color of warnings ("squiggles") and info:
Modify warning and info squiggles.
"workbench.colorCustomizations": {
"editorWarning.foreground": "#ff0",
"editorInfo.foreground": "#00f"
}
For eslint I was able to just set specific rules to warning, which I think is a better way to do it rather than trying to set all to one level. The unused vars was the one that really annoyed me, so:
in the .eslintrc file...
{
"rules" : {
"no-unused-vars": "warn"
}
This will fix your problem.
Add "defaultSeverity": "warning"in tslint.json.
Reference: Change underline color to avoid confusion with compiler errors
For the ESLint plugin:
"eslint.rules.customizations": [
{ "rule": "*", "severity": "warn" }
]
Setting was found in the GitHub PR.