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

Improve folding #317

Merged
merged 3 commits into from
Aug 1, 2020
Merged

Conversation

renkun-ken
Copy link
Member

@renkun-ken renkun-ken commented Aug 1, 2020

Close #316

This PR make folding range provider only create folding ranges for multi-line expressions with (), [] and {}, and the folding range end is a line above the closing bracket so when the range is folded the closing bracket could be seen. Now the folding ranges are consistent with behavior of most other language servers.

if (x > 0) {
  # hello
  # hello2
  x + 1
} else if (x < -1) {
  x - 1
} else {
  x
}

Before:

image

After:

image

And multi-line expressions not enclosed in a pair of brackets are no longer foldable. For example, a pipeline expression could no longer be folded as it is not enclosed in brackets.

kable(dt, format = "html", caption = "Demo Table") %>%
  kable_styling(bootstrap_options = "striped",
    full_width = FALSE) %>%
  add_header_above(c(" ", "Group 1" = 2, "Group 2[note]" = 2)) %>%
  add_footnote(c("table footnote"))

@randy3k
Copy link
Member

randy3k commented Aug 1, 2020

Please just merge it once you feel good about it. :)

@renkun-ken renkun-ken merged commit 52181ca into REditorSupport:master Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overlapping folding ranges
2 participants