You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am asking it here because I can't seem to find an answer in the docs or elsewhere. The posts that I find (e.g., this StackOverflow question) don't help.
I now realize that the issue I am experiencing is not due to auto-formatting. The issue is that when there is a syntax error in the code (e.g., missing )) then the code folding (i.e., including #region ...) stops working. Sometimes it happens that the syntax error is already in a folded region, but I cannot unfold to get to it (i.e., unless I disable the extension and reenable it after fixing the error).
Do you know by any chance what is causing this? I thought it was the auto-format.
Activity
renkun-ken commentedon May 2, 2022
See https://code.visualstudio.com/docs/editor/codebasics#_formatting.
If you want to disable format on save only for R, add the following in the vscode
settings.json:mihaiconstantin commentedon May 2, 2022
Thanks, I was not aware it was this obvious!
I now realize that the issue I am experiencing is not due to auto-formatting. The issue is that when there is a syntax error in the code (e.g., missing
)) then the code folding (i.e., including#region ...) stops working. Sometimes it happens that the syntax error is already in a folded region, but I cannot unfold to get to it (i.e., unless I disable the extension and reenable it after fixing the error).Do you know by any chance what is causing this? I thought it was the auto-format.
renkun-ken commentedon May 2, 2022
It has the same cause with #501. The folding provider is based on parsed data, which assumes that the code could be fully parsed.
mihaiconstantin commentedon May 2, 2022
Oh, I see. This answers my question, thank you! Will close this one.
mihaiconstantin commentedon May 3, 2022
I am sorry to comment again on this, but even with
I am still facing the auto-format:
auto_format_issue.mov
Is this related to the linter? If so do you have any ideas on how to disable this behavior?
renkun-ken commentedon May 4, 2022
You could tweak styler's
tidyverse_styleby putting the following in your~/.Rprofile:mihaiconstantin commentedon May 4, 2022
Thank you @renkun-ken. This did it!