-
Notifications
You must be signed in to change notification settings - Fork 94
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
styler too slow for large script and blocks lsp #141
Comments
Related: r-lib/styler#558 |
I think |
Also we hope that we can cache on an expression level in r-lib/styler#570 which will speed up things when a file was partly edited after we implemented caching on the whole input (r-lib/styler#538) in v1.2.0. |
If this causes a real headache and many upvote r-lib/styler#570, chances are that it is implemented more quickly. |
We have now implemented r-lib/styler#570 in the devel version of styler, meaning:
Just wanted to let you know if you want to test and provide feedback. Also, we removed a bug in in the caching feature that could be detrimental (changing tokens, see r-lib/styler#584), so if you use the GitHub version, make sure to get the latest version of styler with |
@lorenzwalthert I'm using the latest styler master branch to test the caching. Is there anything I should do to enable it? I've tried styling the 1500+ line file which took more than 40 seconds. But styling it again without any modification still took nearly the same amount of time. |
What does |
Thanks! It is caused by I didn't install I notice that the first time use of |
Unfortunately, languageserver does not use |
Ok, good to know. |
@lorenzwalthert Thanks for the information. It works quite well for me now. |
I don't mean you personally, but |
Yes, languageserver formatting works with styler caching. The only limitation when styling for my script is that it only caches top-level expressions. Some of my scripts contain large chunks of |
Ok. Yes, these are known limitations. So it's an encouragement to program functions with narrow scope 😄. But the main problem I worry is that with the current version of languageserver and styler, 99% of users will never benefit from caching because they won't read this issue and realise they need to install {R.cache} manually. See also r-lib/styler#586. |
Maybe we should add some documentation for this. |
Ok, so with r-lib/styler#586, |
@lorenzwalthert The README has been updated to reflect your work on styler caching. Closing this. |
Cool, thanks. A detail: The permanent cache will only be created with a command like |
Thanks for your detailed information. 8f4d281 makes it clear as you suggest. |
Perfect, thanks. Also note that we are experiencing some problematic behavior with caching and we suggest to use v1.3.1 or even the current GitHub version for now. This will be fixed by end of February with v1.3.2 because the CRAN team has requested a maintenance update that is unrelated to the caching feature. I don't think this needs to be mentioned in the README. |
I'm editing a script of more than 1500 lines of code. I timed the formatting by
syste.time(styler::style_file(file))
:If I execute command
Format document
, then languageserver totally is stuck at formatting the file and stops providing other functionalities, looks like the formatting task completely blocks the langaugeserver.I also enable
formatOnPaste
, if I copy/paste a large chunk of code (hundreds of lines) to the current document, then range formatting is triggered, which also blocks languageserver.The text was updated successfully, but these errors were encountered: