How to highlight current line number in Visual Studio Code / VS Code - visual-studio-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",
}
},

Related

Change style of VS Code Markdown `code` syntax highlighting

I just installed VS Code 1.70.0 on a new machine, and imported settings by copying settings.json from the old machine. I opened a Markdown (.md) file, and oddly the code segments marked with backtick characters are very hard to see. For example, both "foo" and "bar" below appear to be the same style.
foo `bar`
I zoomed in with the magnifier, but even then the style looks almost identical to the other text—the red color is very faint. This is the same monitor as before, so maybe it is related to the video driver on the new computer.
Is there some way to tweak the syntax highlighting just for inline code formatting for Markdown in VS Code?
Yes, you can tweak the color by:
Go to Command Palette and find "Preferences: Open User Settings (JSON)"
In the settings.json that it opened, add the following field:
"editor.tokenColorCustomizations": {
"[YOUR COLOR SCHEME]": {
"textMateRules": [
{
"scope": "markup.inline.raw.string.markdown",
"settings": {
"foreground": "#aaff00", // <-- Change your color here
}
}
]
}
}
In the 2nd line of the above code, change YOUR COLOR SCHEME to the name of the color scheme you are using. For example, my color scheme is called "Monokai Pro" so the 2nd line would be:
"[Monokai Pro]" : {
Change the color to whatever you like in the "foreground" field. For example, I'm using #aaff00 (lime color) and this is how it looks like:
Tip
You may wonder how do I know that the "scope" field should be "markup.inline.raw.string.markdown". To see which TextMate scope that the markup inline code belongs to:
Open Command Palette and search for "Developer: Inspect Editor Tokens and Scopes"
Place your mouse caret inside the markdown inline code

How do i stop full line highlight in vs code versions control?

Is there any way to stop the full line highlight in versions control?
It is very confusing when the vscode is highlighting the full line and not only the changed piece of code especially when there is a lot of changes.
vscode vs sublime merge line highlight
Some related issues: https://github.com/microsoft/vscode/issues/116413
https://github.com/microsoft/vscode/issues/103207
https://github.com/microsoft/vscode/issues/66223
Upvote these - especially the first which is in the candidate phase.
You can play around with these colorCustomizations in your settings.jsonwhich might help a "little":
{
"workbench.colorCustomizations": {
"diffEditor.insertedTextBorder": "#0f0",
"diffEditor.insertedTextBackground": "#0000", // set to transparent
"diffEditor.removedTextBackground": "#0000", // set to transparent
"diffEditor.removedTextBorder": "#f00"
}
But these changes don't help much in my opinion. Upvoting is probably your best bet.

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

Better highlighting for current selection in diff viewer

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?

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.