Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export function activate(context: vscode.ExtensionContext) {

// Create a decorator types that we use to decorate indent levels
let decorationTypes = [];
let decorationTypesStore = [];

let doIt = false;
let clearMe = false;
Expand All @@ -26,18 +27,36 @@ export function activate(context: vscode.ExtensionContext) {
/.*\*.*/g
];

var active = false;
var colors = vscode.workspace.getConfiguration('indentRainbow')['colors'] || [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this changed from const to var?

"rgba(64,64,16,0.3)",
"rgba(32,64,32,0.3)",
"rgba(64,32,64,0.3)",
"rgba(16,48,48,0.3)"
];

context.subscriptions.push(vscode.commands.registerCommand("indent-rainbow.toggle", async () => {
active = !active;
if(active === true)
{
decorationTypes = decorationTypesStore;
triggerUpdateDecorations();
}
else
{
decorationTypes.forEach((decorationType, index) => {
activeEditor.setDecorations(decorationType, []);
});
decorationTypes = [];
}
}));


// Colors will cycle through, and can be any size that you want
const colors = vscode.workspace.getConfiguration('indentRainbow')['colors'] || [
"rgba(64,64,16,0.3)",
"rgba(32,64,32,0.3)",
"rgba(64,32,64,0.3)",
"rgba(16,48,48,0.3)"
];

// Loops through colors and creates decoration types for each one
colors.forEach((color, index) => {
decorationTypes[index] = vscode.window.createTextEditorDecorationType({
decorationTypesStore[index] = vscode.window.createTextEditorDecorationType({
backgroundColor: color
});
});
Expand Down
Binary file not shown.
Loading