vscode-indent-rainbow

by oderwat

Extension which shows indentation with a faint rainbow colored background to make them more readable

155 Stars 26 Forks Last release: Not found MIT License 34 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Indent-Rainbow

A simple extension to make indentation more readable


This extension colorizes the indentation in front of your text alternating four different colors on each step. Some may find it helpful in writing code for Nim or Python.

Example

Get it here: Visual Studio Code Marketplace

It uses the current editor window tab size and can handle mixed tab + spaces but that is not recommended. In addition it visibly marks lines where the indentation is not a multiple of the tab size. This should help to find problems with indentation in some situations.

Configuration

Although you can just use it as it is there is the possibility to configure some aspects of the extension:

  // For which languages indent-rainbow should be activated (if empty it means all).
  "indentRainbow.includedLanguages": [] // for example ["nim", "nims", "python"]

// For which languages indent-rainbow should be deactivated (if empty it means none). "indentRainbow.excludedLanguages": ["plaintext"]

// The delay in ms until the editor gets updated. "indentRainbow.updateDelay": 100 // 10 makes it super fast but may cost more resources

Notice: Defining both

includedLanguages
and
excludedLanguages
does not make much sense. Use one of both!

You can configure your own colors by adding and tampering with the following code:

  // Defining custom colors instead of default "Rainbow" for dark backgrounds.
  // (Sorry: Changing them needs an editor restart for now!)
  "indentRainbow.colors": [
    "rgba(255,255,64,0.07)",
    "rgba(127,255,127,0.07)",
    "rgba(255,127,255,0.07)",
    "rgba(79,236,236,0.07)"
  ]

// The indent color if the number of spaces is not a multiple of "tabSize". "indentRainbow.errorColor": "rgba(128,32,32,0.6)"

// The indent color when there is a mix between spaces and tabs. // To be disabled this coloring set this to an empty string. "indentRainbow.tabmixColor": "rgba(128,32,96,0.6)"

Notice:

errorColor
was renamed from
error_color
in earlier versions.

Skip error highlighting for RegEx patterns. For example, you may want to turn off the indent errors for JSDoc's valid additional space (disabled by default), or comment lines beginning with

//
  // Example of regular expression in JSON (note double backslash to escape characters)
  "indentRainbow.ignoreLinePatterns" : [
    "/[ \t]* [*]/g", // lines begining with *
    "/[ \t]+[/]{2}/g" // lines begininning with //
  ]

Skip error highlighting for some or all languages. For example, you may want to turn off the indent errors for

markdown
and
haskell
(which is the default)
  "indentRainbow.ignoreErrorLanguages" : [
    "markdown",
    "haskell"
  ]

Build with:

npm install
npm run vscode:prepublish

Running

npm run compile
makes the compiler recompile on file change.

The current version is my "first try" on a VSCode extension. I am sure stuff could be more optimized :)

If you like this plugin, please consider a small donation!

Donate with PayPal

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.