Gruntfuggly / todo-tree

Use ripgrep to find TODO tags and display the results in a tree view
Other
1.43k stars 139 forks source link

Extension breaks other extensions due to using Regexp shim #853

Open j-fulbright opened 3 months ago

j-fulbright commented 3 months ago

After reviewing an error for a different extension, it was determined that the extension was broken due to TODO Tree.

From the other extension author:

gruntfuggly is using a package called [regexp-match-indices](https://www.npmjs.com/package/regexp-match-indices) which replaces the javascript RegExp object globally and causes unexpected behaviour in RegExp.exec().

Versionlens uses a RegExp with the flags /gd which are valid [RegExp flags](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions#regex_flags)
but the shim gruntfuggly uses doesn't support them....

its very bad that this extension replaces the RegExp object globally. 
This will potentially cause many problems in vscode.

This particular usage here: https://github.com/Gruntfuggly/todo-tree/blob/a6f60e0ce830c4649ac34fc05e5a1799ec91d151/src/highlights.js#L2

sa2taka commented 3 months ago

I'm also seeing.

Release-Candidate commented 3 months ago

It breaks my extension too: https://github.com/Release-Candidate/vscode-scheme-repl/issues/20

The problem for me are the valid flagsdsu.

The stack-trace from "OUTPUT" of "Extension Host":

[error] SyntaxError: Invalid flags: dsu
    at k (/home/roland/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:114:74341)
    at Array.d (/home/roland/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:114:3580)
    at Object.parse (/home/roland/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:114:71938)
    at r.parse (/home/roland/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:1:12692)
    at Object.parse (/home/roland/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:114:415)
    at l (/home/roland/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:52:165)
    at Array.get [as indices] (/home/roland/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:52:2895)
    at Re (/home/roland/tmp/vscode-scheme-repl/out/extension.js:16:2643)
    at zr (/home/roland/tmp/vscode-scheme-repl/out/extension.js:16:210)
    at g (/home/roland/tmp/vscode-scheme-repl/out/extension.js:12:1237)
    at Y (/home/roland/tmp/vscode-scheme-repl/out/extension.js:16:2259)
    at vr (/home/roland/tmp/vscode-scheme-repl/out/extension.js:12:1338)
    at g (/home/roland/tmp/vscode-scheme-repl/out/extension.js:12:1070)
    at U (/home/roland/tmp/vscode-scheme-repl/out/extension.js:12:956)
    at Ne (/home/roland/tmp/vscode-scheme-repl/out/extension.js:25:918)
    at /home/roland/tmp/vscode-scheme-repl/out/extension.js:830:29871
boltex commented 1 month ago

Also happens for my extensions "LeoJS" https://github.com/boltex/leojs .

Specifically, I'm getting the "Invalid flags: dgm" error messages, which renders my extension somehow unresponsive!

pedrohenrique-ql commented 2 weeks ago

This also happens in my extension Regex Match, which uses the /d flag to get the match indexes.

Reported in https://github.com/pedrohenrique-ql/vscode-regex-match/issues/95.

The error:

2024-09-11 20:05:50.222 [error] SyntaxError: Invalid flags: dg
    at k (/home/pedrohql/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:114:74341)
    at Array.d (/home/pedrohql/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:114:3580)
    at Object.parse (/home/pedrohql/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:114:71938)
    at Object.r.parse (/home/pedrohql/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:1:12692)
    at Object.parse (/home/pedrohql/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:114:415)
    at l (/home/pedrohql/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:52:165)
    at Array.get [as indices] (/home/pedrohql/.vscode/extensions/gruntfuggly.todo-tree-0.0.226/dist/extension.js:52:2895)
    at RegexTest.processMatch (/home/pedrohql/projects/regex-match/src/services/regex-match/RegexTest.ts:92:15)
    at RegexTest.test (/home/pedrohql/projects/regex-match/src/services/regex-match/RegexTest.ts:47:37)
    at /home/pedrohql/projects/regex-match/src/decorations/TextDecorationApplier.ts:19:72
    at Array.flatMap (<anonymous>)
    at Function.updateDecorations (/home/pedrohql/projects/regex-match/src/decorations/TextDecorationApplier.ts:19:39)
    at RegexMatchService.updateRegexTest (/home/pedrohql/projects/regex-match/src/services/regex-match/RegexMatchService.ts:79:27)
    at RegexMatchService.openRegexTestWindow (/home/pedrohql/projects/regex-match/src/services/regex-match/RegexMatchService.ts:74:10)
    at d.h (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:154:206473) regex-match.openRegexMatchWindow {"value":"pedrohenrique-ql.regex-match","_lower":"pedrohenrique-ql.regex-match"}