34

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!

line number highlight in Atom

2
  • 1
    For more info, see stackoverflow.com/questions/64756591/… Commented Nov 17, 2020 at 17:51
  • 1
    in case anyone wants to un-highlight the line number part, "workbench.colorCustomizations": { "editorLineNumber.activeForeground": "#fff"}, Instead of #fff, you might want to put whatever color makes it work depending on the theme Commented Dec 12, 2020 at 11:41

2 Answers 2

91

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" } 
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, that's a setting I hadn't come across which helps! 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!
@PrimalAnomaly Glad to hear. If you're satisfied with the answer, please accept it.
Thank you, I couldn't get it exactly how I wanted using built in settings, but have used the gutter highlight you suggested along with a plugin called "Highlight Line" to set the code line highlight, and now it is perfect! Your tips let me set the gutter highlight colour I want. The plugin lets me set the code highlight background colour I want (I also had to set the plugin highlight line thickness to the line-height of my font). The plugin can be found here: marketplace.visualstudio.com/…
16

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

If you are using a different theme, simply change the name after Default. Example:

 "workbench.colorCustomizations": { "[Default Dark Modern]": { "editor.lineHighlightBackground": "#46492d", }, "[Default Light Modern]": { "editor.lineHighlightBackground": "#f4ff93", } }, 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.