VSCode extension throws regex indices error only when other extension is enabled

138 Views Asked by At

Background

I am working on an extension (vscode-color-blocks) that uses RegExp match indices (new in ES2022). This means I am using a regex string with the d flag to get indices (relational positions) of each capture group in my regex (source):

export const colorBlockRegex = new RegExp(regexString, 'd');

This means that a successful regex match object will have a .indices attribute that I can then use (source):

const match = colorBlockRegex.exec(comment.content);
if (!match) continue;
console.log(match.indices);

Problem

All of this works fine when I am using the extension on it's own and even together with some other extensions. But VSCode behaves like this new regex feature is not available once I install an extension named Todo Tree. At that point my extension crashes and I get the following error:

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)

The stack trace is a little confusing as it steps from gruntfuggly.todo-tree-0.0.215 into my extension vscode-color-blocks.

Otherwise there must be something wrong with how these two extensions are running on different versions on Javascript?

0

There are 0 best solutions below