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

infinite loop in MonarchLexer's getloadstatus #76753

Closed
corrieann opened this issue Jul 6, 2019 · 2 comments
Closed

infinite loop in MonarchLexer's getloadstatus #76753

corrieann opened this issue Jul 6, 2019 · 2 comments
Assignees
Labels
verified Verification succeeded
Milestone

Comments

@corrieann
Copy link

  • VSCode Version: n/a -- Using Monaco
  • OS Version: MacOS Mojave

Steps to Reproduce:

  1. Create a language syntax that references itself as an embedded mode.
  2. Call colorizeElement using that language for syntax highlighting.

Does this issue occur when all extensions are disabled?: Yes

Code in question is:
https://github.com/microsoft/vscode/blob/master/src/vs/editor/standalone/common/monarch/monarchLexer.ts#L423

Proposed fix is:

if (tokenizationSupport instanceof MonarchTokenizer) {
  const nestedModeStatus = tokenizationSupport.getLoadStatus();
  ...

become:

if (tokenizationSupport == this) continue;
if (tokenizationSupport instanceof MonarchTokenizer) {
  const nestedModeStatus = tokenizationSupport.getLoadStatus();
  ...
@fabiospampinato
Copy link
Contributor

fabiospampinato commented Jul 29, 2019

I just stumbled upon this too.

In case it's useful I've noticed that the call to colorize/colorizeElement works at first if I'm just viewing the rendered Markdown, which is the language that references itself as an embedded mode for me, but then if I fire up a monaco editor instance with that same Markdown content and switch back to rendering and syntax highlighting it than the bug occurs. It doesn't happen if I start editing some Markdown which doesn't embed a markdown code block inside itself and then switch back to the Markdown I was rendering initially.

@alexdima alexdima added this to the July 2019 milestone Jul 29, 2019
@fabiospampinato
Copy link
Contributor

I can confirm that e4b4c17 resolved the issue 👍

@alexdima alexdima added the verified Verification succeeded label Jul 29, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants