-
Notifications
You must be signed in to change notification settings - Fork 48
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
v3.2.0 freezes when editing a datatype #161
Comments
Thanks for the bug report. I have noticed an issue which has to do with the regex engine in VS Code having some problems with recursive calls, which I reported here. Note also that a recent update of the regex engine (included with VS Code version 1.45, april 2020) has mitigated the problem on my end. |
The datatype definition was really what I shared above, in the context of a medium sized module. Typing the definition would cause a lockup. I am still using 1.44 here, perhaps it’s better with 1.45 |
I was able to reproduce with the following file: data BenchResult
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where
instance ( Aaaaaaaaaa x ) where Typing an equals sign just after I'm investigating the issue at the moment; I will let you know when I have more info. Thanks for your patience. |
It seems the regex for highlighting a data constructor was backtracking excessively (on top of the already slow performance of recursive calls in VS Code that I alluded to above). I've pushed a fix in 1bb6423, which on my end eliminates the slowness completely (at least for the above example). @JustusAdam I think we should cut a new release, as this can be very frustrating. |
@pepeiborra In case you don't want to wait for a new release, you can replace your Let me know if that fixes the problem on your end and we can go ahead with a new release. Thanks and sorry for the inconvenience. |
Thanks for the quick response! Will give it a go tomorrow and confirm here. |
I updated back to v3.2.0 today but was unable to reproduce the problem, so I have no useful info to report. Nothing else has changed, yesterday it was 100% reproducible, today it just doesn't happen. I am perplexed. |
I am glad to hear that it has gotten better for you. But just in case, I agree with you @sheaf, I'll publish a patch, just to be sure it doesn't affect more people. |
Hopefully the release fixed it for good |
Unfortunately I think my fix isn't right at all, here's another case that currently hangs the highlighting data A
xxxxxxxxxxxxxxxxx Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
( Dddddddddddddddddddddddddd ( Eeeeeeeeeeeeeeeeeeeeeeeee fffffffffffffffffffffffff )
( Eeeeeeeeeeeeeeeeeeeeeeeee Fffffffffffffffffffffffff |
( Gggggggggggggggggggggg ( Aaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccc )
( Dddddddddddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeeeeee |
( Hhhhhhhhhhhhhhhh iiiiiiiiiiiiiiiii )
)
)
)
)
xxxxxxxxxxxxxxxxx Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
( Dddddddddddddddddddddddddd ( Eeeeeeeeeeeeeeeeeeeeeeeee fffffffffffffffffffffffff )
( Eeeeeeeeeeeeeeeeeeeeeeeee Fffffffffffffffffffffffff |
( Gggggggggggggggggggggg ( Aaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccc )
( Dddddddddddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeeeeee |
( Hhhhhhhhhhhhhhhh iiiiiiiiiiiiiiiii )
)
)
)
)
xxxxxxxxxxxxxxxxx Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
( Dddddddddddddddddddddddddd ( Eeeeeeeeeeeeeeeeeeeeeeeee fffffffffffffffffffffffff )
( Eeeeeeeeeeeeeeeeeeeeeeeee Fffffffffffffffffffffffff |
( Gggggggggggggggggggggg ( Aaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccc )
( Dddddddddddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeeeeee |
( Hhhhhhhhhhhhhhhh iiiiiiiiiiiiiiiii )
)
)
)
)
xxxxxxxxxxxxxxxxx Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
( Dddddddddddddddddddddddddd ( Eeeeeeeeeeeeeeeeeeeeeeeee fffffffffffffffffffffffff )
( Eeeeeeeeeeeeeeeeeeeeeeeee Fffffffffffffffffffffffff |
( Gggggggggggggggggggggg ( Aaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccc )
( Dddddddddddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeeeeee |
( Hhhhhhhhhhhhhhhh iiiiiiiiiiiiiiiii )
)
)
)
) Adding an equals sign after I'm having some difficulties specifying the intended behaviour in the regex. I want to say "stop trying this regex once you are sure you won't be able to match even after extending the ending", but I am finding it difficult to do that while preserving other desirable properties (particularly multiline highlighting and allowing intervening comments). |
By the above comment I mean that we can add data A =
A B c and data A = {- ... -} A B c |
I went for a different approach: write an explicit failure condition, that says "no point in trying further, just give up now". That has at least fixed the issues reported above. I'm closing the ticket for now, please reopen if other issues manifest themselves. |
I think I've run across another instance of this. Running syntax highlighting for the line
hangs forever at
and a debugger indicates that it's hanging at |
@hexahedria Thanks for the bug report, for the simple reproducer, and for checking on |
* Fixes some problems with slow/frozen highlighting (see JustusAdam#161)
Turns out there was a silly typo in the regular expression for data constructors (see 05bfeff). |
Thanks for the quick fix! |
In my case the datatype is something like:
This was working fine with 3.0.3. I cannot seem to figure out how to rollback, since I'm also using ghcide and VSCode refuses to use an older version of language-haskell with ghcide.
The only special thing about my setup is that I'm using the VSCode remoting SSH plugin.
The text was updated successfully, but these errors were encountered: