Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript inline regex #717

Closed
dna2github opened this issue Feb 6, 2019 · 2 comments
Closed

javascript inline regex #717

dna2github opened this issue Feb 6, 2019 · 2 comments
Assignees

Comments

@dna2github
Copy link

  • VSCode Version: 1.30.2
  • OS Version: MacOSX 10.12.6

Seem a fix before: microsoft/vscode#15692
But maybe a little different.

Steps to Reproduce:

  • write a js file:
/* regex? */
function test() {
   return /"/.test('xxx"xxx');
}

console.log(test());
a = 3 /*test*/ / parseInt(/.+/.exec('3f23fg')[0]);
console.log(a);

b = 1
a = () => b
2 + (b=2), 3
b = 6
console.log(a(),b);
(b)

if (a === 1) {
   b = 2
} else if (a === 2) b = 3
else b = 4
c = 1
x = a/b/gi; y = /b/gi;

if want to run in node, add a line to define b and gi, e.g. b = 1; gi = 1;

  • open the file in vscode; colored in red and orange:

screen shot 2019-02-07 at 1 42 58 am

Monarch Tokens:

   {
      "start_offset": 101,
      "end_offset": 111,
      "type": "regexp.js",
      "value": "/ parseInt"
   },
   {
      "start_offset": 111,
      "end_offset": 112,
      "type": "regexp.escape.control.js",
      "value": "("
   },
   {
      "start_offset": 112,
      "end_offset": 113,
      "type": "regexp.js",
      "value": "/"
   },
   {
      "start_offset": 113,
      "end_offset": 114,
      "type": "delimiter.js",
      "value": "."
   },
   {
      "start_offset": 116,
      "end_offset": 117,
      "type": "delimiter.js",
      "value": "."
   },
   {
      "start_offset": 117,
      "end_offset": 121,
      "type": "identifier.js",
      "value": "exec"
   },
@mjbvz mjbvz assigned mjbvz and unassigned weinand Feb 6, 2019
@mjbvz mjbvz transferred this issue from microsoft/vscode Feb 6, 2019
@microsoft microsoft deleted a comment from vscodebot bot Feb 6, 2019
@sheetalkamat
Copy link
Member

This might not be easy to fix because of the way tmLanguage lookup works. We already had issue #3 because of which anything after comment is treated as regexp if it can match completely. Will look into what best action can be taken

@dna2github
Copy link
Author

thx, i will track the #3 then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants