Skip to content

Make identifier regular expression configurable #2391

Description

There are several places in the code where a regular expression is used to find identifiers in JavaScript code. As mentioned in the comment, this is a very approximate regular expression because it only considers Latin characters. As a result, if the code contains non-Latin identifiers, some debugger features do not work correctly.

Here is one example:

/** Very approximate regex for JS identifiers */
const identifierRe = /[$a-z_][$0-9A-Z_$]*/iy;

const match = identifierRe.exec(source);

Here, the regular expression is used to construct variable renames based on source maps. In my scenario, the generated JavaScript code contains non-Latin identifiers, so the renaming does not work and the Variables view displays the names from the generated code instead. This makes debugging inconvenient because the variable names in the source code do not match the names shown in the Variables view.

A possible solution would be to make the identifier regular expression configurable. An identifierRegex field could be added to IBaseConfiguration. If specified, it would be used instead of the default regular expression. This would allow users to provide a more appropriate regular expression.

Metadata

Metadata

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions