zimonitrome / vscode-color-blocks

VSCode extension for coloring ranges of comments.
https://marketplace.visualstudio.com/items?itemName=zimonitrome.color-blocks
MIT License
7 stars 1 forks source link

conflicts with todo-tree plugin #6

Open Avannit opened 2 years ago

Avannit commented 2 years ago

Hi, I don't know what happened, but versions 2.0.0 and 2.1.0 do not work, put it on 1.0.6 and everything worked

I have the usual code of the latest version, not an insider

zimonitrome commented 2 years ago

Okay I will look into this. Thanks for reporting!

On the top of my head it could be the new setting to toggle color blocks on/off that has a bad default vaule.

I also found that the latest release is a little laggy (as in it slows down the editor) so there are a few hotfixes that needs to be done ASAP.

zimonitrome commented 2 years ago

On a second note, could you provide some example of code that does not work?

I have not been able to reproduce the bug yet.

Avannit commented 2 years ago

@zimonitrome

And so, after your post, I realized that perhaps the problem lies elsewhere

I went through all my plugins that do my code coloring and found that after turning on todo-tree plugin vscode-color-blocks loses functionality

Сan you confirm my version?

zimonitrome commented 2 years ago

@Avannit Yes I tried downloading this extension too and I have the same problem...

I will try to look into the code of todo-tree and see if I can find anything that is incompatible.

Avannit commented 2 years ago

@zimonitrome Can you make the coloring from version 1.0.6 and the functionality from version 2.1.0?

zimonitrome commented 2 years ago

I will look into it. Otherwise I will try to bisect or rollback some commits in the next few days to find when this issue becamr a problem.

zimonitrome commented 2 years ago

It is pretty odd... I am using some new features from ES2022, more specifically RegExp match indices using the flag d. This works fine when TODO tree is not installed but otherwise vscode complains:

stack trace: SyntaxError: Invalid flags: d
    at _ (...\.vscode\extensions\gruntfuggly.todo-tree-0.0.215\dist\extension.js:114:74341)
    at Array.<anonymous> (...\.vscode\extensions\gruntfuggly.todo-tree-0.0.215\dist\extension.js:114:3580)
    at Object.parse (...\.vscode\extensions\gruntfuggly.todo-tree-0.0.215\dist\extension.js:114:71938)
    at Object.parse (...\.vscode\extensions\gruntfuggly.todo-tree-0.0.215\dist\extension.js:1:12529)
    at Object.parse (...\.vscode\extensions\gruntfuggly.todo-tree-0.0.215\dist\extension.js:114:415)
    at i (...\.vscode\extensions\gruntfuggly.todo-tree-0.0.215\dist\extension.js:52:165)
    at Array.get [as indices] (...\.vscode\extensions\gruntfuggly.todo-tree-0.0.215\dist\extension.js:52:2895)
    at DecorationRangeHandler.addNewDecorationRanges (...\vscode-color-blocks\dist\extension.js:1735:95)

I think I will need to learn some more about TS/JS target versions to realize how this error occurs. Ideally I would want to keep the current behavior because it is very convenient, but I will also look into what a refactor would entail.

zimonitrome commented 2 years ago

The error seems to be that Todo Tree uses a polyfill for RegExp Match Indices and this polyfill has an error that is only present when it is "compiled" to javascript (see issue).

It is odd as why this error is not triggered until vscode-color-blocks is loaded. Perhaps because Todo Tree never uses the d flag explicitly? I am not sure if I want to implement RegExp Match Indices in the same way that Todo Tree does since that may cause the same error to another plugin.