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

Some comments cause vscode to hang since 1.11.6 #260

Closed
scriptxotic opened this issue Jun 26, 2019 · 9 comments
Closed

Some comments cause vscode to hang since 1.11.6 #260

scriptxotic opened this issue Jun 26, 2019 · 9 comments
Labels
High Priority Common or breaks highlighting of more than just itself

Comments

@scriptxotic
Copy link

scriptxotic commented Jun 26, 2019

All in the title.
Small repro:

// OK:
/********************* DATA *************************/
// Crash:
  /********************* DATA *************************/
@matter123 matter123 added High Priority Common or breaks highlighting of more than just itself 🔍 investigating More information is being gathered labels Jun 26, 2019
@jeff-hykin
Copy link
Owner

jeff-hykin commented Jun 26, 2019

I'll look into this today as well, @scriptxotic thanks for reporting this and thanks for narrowing it down.

@matter123
Copy link
Collaborator

After modifying perf to print the line before it tries that pattern it seems that the grammar gets stuck at 3943 or meta.function.definition

@jeff-hykin
Copy link
Owner

my guess is that this has to do with std_space being infront of so many patterns. Every inline comment in std_space involves backtracking, and with so many patterns starting with std_space its probably causing a backtracking explosion. I'm going to work on a fix related to that

@matter123
Copy link
Collaborator

matter123 commented Jun 26, 2019

The simplest fix would be to move the comment pattern near the top, right? And modify it to consume leading spaces.

@jeff-hykin
Copy link
Owner

Yeah, I'm hoping that will solve the problem. I'm also going to try to make the inline comment pattern more efficient

@jeff-hykin
Copy link
Owner

jeff-hykin commented Jun 26, 2019

@scriptxotic it should be fixed now in v1.12.2

@matter123 I started adding the leading spaces but it didn't seem to be doing much and in some cases it was making the code incorrect. What I did instead that seems to have fixed it, is update the legacy comment patterns and have the block comment consume the leading spaces. This makes the block comment take precedence over the other patterns that are trying to match an inline block comment. I also made the inline comment really efficient (no backtracking at all) but it actually didn't affect much either.

matter123 added a commit that referenced this issue Jun 26, 2019
@matter123
Copy link
Collaborator

@jeff-hykin I rewrote the comment pattern in the branch Fix/#260. In particular I removed the nested pattern ranges and made the banner patterns more generic. You might want to merge some of that in

@matter123 matter123 removed the 🔍 investigating More information is being gathered label Jun 27, 2019
@jeff-hykin
Copy link
Owner

Yup 👍 I'll do that

@scriptxotic
Copy link
Author

Thank you! You two are doing a great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Priority Common or breaks highlighting of more than just itself
Projects
None yet
Development

No branches or pull requests

3 participants