-
-
Notifications
You must be signed in to change notification settings - Fork 36
Long lines cause slow syntax highlighting and VS Code to hang #309
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
Comments
Which version number introduced the issue? |
From what I can tell, v2.6.2 (I started to experience such a problem last week when it updated, but I might not have opened the incriminated file till earlier). |
I would suspect that the issue is related to the 2k+ columns some lines have which could result into the regex of the language grammar to fail. v2.6.2 did not alter the grammar files. Can you try and provide a more minimal example where the bug is encountered, ~950 lines is a bit too big. |
Yeah so commenting out the long |
Specifically the bug shows up when you have a line with +1k columns MWEUn/commenting the last line will cause VSCode to crash. program bug
implicit none
res = (CF*(28*nf + CA*(-202 + 189*Zeta3)))/27./(one-x) + & ! this is the regular part of the plus distribution 1/(1-x)_+
! now add the regular terms
& (CF*(-344 + 24*Pi**2 + 974*x - 1600*CA*x + 1188*CF*x - 432*CA*HPL30*x + 1080*CF*HPL30*x + 148*nf*x - 60*Pi**2*x + 54*CA*Pi**2*x - 54*CF*Pi**2*x - 1188*x**2 + 1584*CA*x**2 - 2376*CF*x**2 - 72*nf*x**2 + 72*Pi**2*x**2 - 108*CA*Pi**2*x**2 + 108*CF*Pi**2*x**2 + 830*x**3 + 16*CA*x**3 + 1188*CF*x**3 - 432*CA*HPL30*x**3 + 1080*CF*HPL30*x**3 - 76*nf*x**3 - 60*Pi**2*x**3 + 54*CA*Pi**2*x**3 - 54*CF*Pi**2*x**3 - 272*x**4 + 24*Pi**2*x**4 + 216*(CA - CF)*HPL31*x*(1 + x**2) + 1188*CA*x*zeta3 - 1080*CF*x*zeta3 - 324*CA*x**3*zeta3 - 1080*CF*x**3*zeta3 - 36*CA*Pi**2*x*log(1 - x) + 36*CF*Pi**2*x*log(1 - x) - 108*CA*x**2*log(1 - x) + 108*CF*x**2*log(1 - x) + 108*CA*x**3*log(1 - x) - 108*CF*x**3*log(1 - x) - 36*CA*Pi**2*x**3*log(1 - x) + 36*CF*Pi**2*x**3*log(1 - x) - 252*x*log(x) + 348*CA*x*log(x) - 540*CF*x*log(x) - 60*nf*x*log(x) + 612*x**2*log(x) - 432*CA*x**2*log(x) + 1404*CF*x**2*log(x) - 744*x**3*log(x) + 996*CA*x**3*log(x) - &
1728*CF*x**3*log(x) - 60*nf*x**3*log(x) + 384*x**4*log(x) - 144*log(1 - x)*log(x) + 360*x*log(1 - x)*log(x)))
end program bug Additional infoIntroduced in vesion v2.4.0 |
Thanks - I imagined it could be related to that. Do you suggest to try editing the files and break the lines, or do you plan to address the regex issue for such files? |
I will have a go at trying to locate the bug in the syntax highlighting. I have also noticed that for large files our syntax highlighting is slower than what it used to. If I had to make a guess I would say that the issue stems from the highlighting rules for nested statements |
I noted in the past that long/large files could cause slowdowns, but personally I only noticed in files with long columns (even before the update which cause VS code to hang completely) |
To be honest that is expected behaviour after a point. Complex regular expressions are rarely scalable with a large number of characters. The tools that we use/develop assume reasonably written code. That is one reason why formatting standards exist. |
I agree and in my codes I respect formatting standards - though code that I use/develop on top might not be always written reasonably. Long mathematical expression are anyway tricky to format properly (without inserting mistakes) if they come from outputs of other codes. |
I understand, but I am afraid that there is not much that can be done. I will try and see what change in the highlighting introduced the bug and if there is anything that can be done to limit the problem. |
Hey, I am experiencing the same thing. |
I still haven't found time to work on this but the simplest fix that I've thought would be to keep the old syntax and any users experiencing issues would revert to that. The old highlighting would be noticeably less complete but it would not freeze at least. If anyone is interested to troubleshoot the PR that introduced the bug is #244 and the file that needs inspection is |
For anyone struggling with this: I notice significant improvement on this issue in the pre-release version (3.0). |
That is interesting, thanks for the heads up. TBH the horrible performance is because of how VSCode evaluates recursive REGEX patterns when it comes to highlighting, e.g. I am seriously considering removing support for such syntax patterns, since it is causing so much grief. I really don't see another (reasonable) way out of this. |
Hi @lucarottoli @thijssteel @thijssteel this has now been fixed and will be in the upcoming release of 3.0. |
The last version of Modern Fortan seems to have issues with some files. VScode becomes unresponsive and several minutes are needed to be able to navigate the file. I am experiencing issues on MacOS.
Attached a .f90 file which triggers such a behaviour.
coefficient_functions.f90.zip
.
The text was updated successfully, but these errors were encountered: