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

ECMAScript syntax: Comment affecting semantics of RegExp #750

Closed
SMotaal opened this issue May 12, 2019 · 1 comment
Closed

ECMAScript syntax: Comment affecting semantics of RegExp #750

SMotaal opened this issue May 12, 2019 · 1 comment
Assignees

Comments

@SMotaal
Copy link

SMotaal commented May 12, 2019

  • VSCode Version: Version 1.33.1 (1.33.1)
  • OS Version: macOS 10.14.4 (18E226)

Steps to Reproduce:

The following is contrived to show this particular case.

/* prettier-ignore */
const dummy  = (div, g) => {
  ( []              /([(div)])/g / [] );
  ( ([])            /([(div)])/g / [] );
  ( [] /* */        /([(div)])/g / [] );
};
  1. Paste this code into a new javascript file
  2. Ignore any type-specific errors (because it is still valid ES syntax)
  3. Note the last statement highlights as RegExp but still tokenizes correctly by tsserver.

Does this issue occur when all extensions are disabled?: Not tested

@mjbvz mjbvz transferred this issue from microsoft/vscode May 13, 2019
@SMotaal
Copy link
Author

SMotaal commented Jul 23, 2019

So, I too am playing this game apparently, it's whac-a-mole… the missing ingredient is ASI logic. The good thing is your highlighter logic is doing far better than github's especially with it all being client-side — the problem I am seeing is more of two tokenizers overlapping on a single source text, it is an anti-pattern to vscode's project structure itself (ie you can maybe summarize TypeScript's tokenizer in a few expressions, until they make change, you need a few weeks to dwell) to be fair to the amazing effort you are doing.

So more best shown in:

Screen Shot 2019-07-23 at 6 22 40 am

Feel free to use the dummy code to test.

Note: a false (div) token is followed by a #66b2b2-ish g

cc/ @mjbvz @sheetalkamat

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

2 participants