Better highlighting for current selection in diff viewer - visual-studio-code

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?

Related

How to highlight current line number in Visual Studio Code / VS Code

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",
}
},

Change (or add) background color in VS Code when renaming from Explorer

In the image below I'm actually in "rename" and I'm highlighting something but there's no highlight. You'll notice there's no cursor as well because it's highlighting. This is driving me a bit bonkers because I'm either counting how many left/right arrow keys I'm moving and such to know where I am. I tried the following colors but none of these seem to do anything (in the Explorer):
"workbench.colorCustomizations": {
"editorRuler.foreground": "#fc199a22",
"editor.selectionBackground": "#ab3beb3f",
"editor.selectionHighlightBackground": "#136460e3",
"editor.findMatchBackground": "#00cc44a8",
"editor.findMatchHighlightBackground": "#d0ff004d",
"scrollbarSlider.background": "#FC199A2c"
},
I tried inspecting the element in the developer console in VS Code but the rename closes when it blurs out of the field which I need to do to select the element to know what the CSS class is to style it.
I didn't see a "rename" or highlight color for the explorer here either: https://code.visualstudio.com/api/references/theme-color#editor-colors
Any help would be super appreciated.
You can use the following property:
"selection.background" : "#FF0"
The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor.
A caveat to this approach is that it is applied globally, not just the explorer view

how to disable word-wrap in VS Code for a specific file?

I am using windows and VS Code, I have few files that I do not need to wrap them wherever I press Alt+Shift+F, is there a way to disable auto format wrapping for specific files?
Explained here Language-specific editor settings but specifically:
CTRL+SHIFT+P and type "Preferences: Configure Language Specific Settings"
Select the language or add section in the file (start typing [ to see list of suggestions) or edit if already there.
If wrapping, depending on columns available in your editor you might want to update editor.wordWrapColumn. Lines will wrap at the minimum of viewport and editor.wordWrapColumn
Example:
...
"editor.wordWrapColumn": 200,
"[typescript]": {
"editor.tabSize": 2,
"editor.wordWrap": "off",
},
"[plaintext]": {
"editor.wordWrap": "bounded",
},
...
Looks like VSCode allows for this. You can tweak it as you prefer for each file type.
However note that there have been reports of it not working for markdown files.
I guess it is something still being tweaked.
Looks like this person made an extension that might be useful for you.
https://marketplace.visualstudio.com/items?itemName=Ho-Wan.setting-toggle
Looks like you can setup a few quick easy setting toggles. would at least make it quicker as you're bouncing from file to file.

How to disable error squiggles in visual studio code

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

Change bracket highlight weight in VS Code to be more visible

I'm just getting VS Code set up to use, one of the things I like to have is highlighting that's visible so I don't have to really look for it. I have the editor.matchBrackets setting set to true, so my brackets are highlighted when one is selected. However, the highlighting is so faint (very thin lines) that it's hard to see (I'm using the Dark+ theme, one of the default themes). Is there a way to affect the bracket highlighting, such as the color, line size, etc, so that it's easy to see?
Thanks.
You can try this extension Subtle Brackets by modifying the following the default values in the .json settings of VS Code:
I changed it like this:
"subtleBrackets.bracketPairs": [
"{}",
"[]",
"()",
"<>"
],
"subtleBrackets.styles": {
"global": {
"color": "yellow",
"borderWidth": "1px",
"borderStyle": "none none solid none"
}
}
Don't forget to set to "false" the value of .matchbrackets of VS Code.
"editor.matchBrackets": false
you can add this setting to your settings.json file to apply lighter color brackets. You can just customize these colors of your interest. Bracket pair colorization should be enabled in settings
"workbench.colorCustomizations": {
"editorBracketHighlight.foreground1": "#ffffff",
"editorBracketHighlight.foreground2": "#ffb534",
"editorBracketHighlight.foreground3": "#d549ff",
"editorBracketHighlight.foreground4": "#44ecff",
"editorBracketHighlight.foreground5": "#9eff3e",
"editorBracketHighlight.foreground6": "#2e74ff",
"editorBracketHighlight.unexpectedBracket.foreground": "#db6165"
}
If you want to have the same color for all nested brackets, you can disable "independent color pool per bracket type" in the settings.
Unfortunately, you can't do that.
You should look for another Theme that fit your needs, or maybe upvote this issue in VS Code repo which seems similar to your needs. This issue also suggest install an extension that colorize brackets. It's not a solution, but might help.