microsoft / microsoft/monaco-editor

[Bug] RegExp d Modifier

Open
#5,216 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

chrome version: 79
monaco-editor version:0.52.2

execute:
const markRegex = new RegExp('\bMARK:\s*(.*)$', 'd');
output:
Uncaught SyntaxError: Invalid flags supplied to RegExp constructor 'd'
at RegExp ()

Monaco Editor Playground Code
dev/vs/base/worker/workerMain.js:
 /*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
define(__m[67/*vs/editor/common/services/findSectionHeaders*/], __M([0/*require*/,1/*exports*/]), function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.findSectionHeaders = findSectionHeaders;
    const markRegex = new RegExp('\\bMARK:\\s*(.*)$', 'd');
    const trimDashesRegex = /^-+|-+$/g;
Reproduction Steps

No response

Actual (Problematic) Behavior

No response

Expected Behavior

No response

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with dev/vs/base/worker/workerMain.js and reproduce the RegExp constructor in the Monaco Editor Playground using monaco-editor 0.52.2 and Chrome 79. Investigate the reported SyntaxError for the d flag; done means the documented reproduction behaves as intended without that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.