Open QuantumCoded opened 5 years ago
I got this to work kinda by adding this above the while loop in decorate.js
noCommentText.toString().split('').forEach((c, i) => {
let matchIndex = 0;
let rainbowIndex = Math.abs((i + offset) % colors.length);
let startIndex = matchIndex + i;
let endIndex = matchIndex + i + 1;
let start = editor.document.positionAt(startIndex);
let end = editor.document.positionAt(endIndex);
decorators[rainbowIndex].push(new vscode.Range(start, end));
});
and commenting out the while loop
/* while ((match = regex.exec(noCommentText))) {
let chars = [...(match[1] || match[2])];
offset--;
let startWord = match.index + 1;
let endWord = startWord + chars.length;
chars.forEach((_, i) => {
var matchIndex = match.index + 1;
let rainbowIndex = Math.abs((i + offset) % colors.length);
let startIndex = matchIndex + i;
let endIndex = matchIndex + i + 1;
let start = editor.document.positionAt(startIndex);
let end = editor.document.positionAt(endIndex);
decorators[rainbowIndex].push(new vscode.Range(start, end));
});
} */
However, it seems to be really reluctant to re-colorize whenever you add code to an already colorized document (the new text is in color but it's not colored according to the pattern). I'm not sure if this is due to a restriction with VS Code not taking kindly to me adding a decoration to every character in a file, or if it's some other black magic I'm not aware of. Although, this does work and I thought you would be interested in seeing it.
I'm going to leave this issue open, just in case you have a better idea on how to do this more consistently, but for all intents and purposes this did what I wanted it to.
Coloring strings is cool and all, but I wasn't able to find an extension that would do this for an entire file. I looked at decorate.js for the entirety of 15 minutes and messed around with
and changed it to
as well as some other things trying to get this to work. I couldn't and figured it's just my ignorance as to how vs code handled it. I concluded this because i tried changing it to
and that DID work, but only in decorate.js and only if you short out pins one and two on the USB type C connector while tilting the laptop at a 27 degree angle above the sink.
I couldn't get it to act stable in the slightest and don't know enough about what you're doing here too really fiddle with it. I figured all of you probably have a pretty good sense of humor and would be amused by my attempt to make something on par with the hot dog stand theme when it comes to readability. I also assumed this really wouldn't be that hard to fix if you knew what you were doing and thought that it'd just be easier to post an issue about it rather than trying to figure it out. However, if you decline my clearly irrefutable offer, I'll resort to trying to fix it myself and will make sure to leave a correction to your clearly inferior code.
All jokes aside, this would be appreciated.
Thanks!