REditorSupport / languageserver

An implementation of the Language Server Protocol for R
Other
564 stars 91 forks source link

Section collapsing issues #643

Closed kylebutts closed 6 months ago

kylebutts commented 7 months ago

The language server has preferences over the way sections collapse (namely, collapse up to a set of 2 blank lines: https://github.com/REditorSupport/languageserver/blob/7f7605b55a6cbe05e0033b40f21e87408c06e102/R/section.R#L19 and https://github.com/REditorSupport/languageserver/blob/7f7605b55a6cbe05e0033b40f21e87408c06e102/R/section.R#L319-L337

I'm wondering if changing this could be part of the available settings? I personally, like extra whitespace, so it would be nice to configure. I would be happy to open a PR. I think the steps would be:

  1. Add nline_to_break_succession option to S6 option Settings
  2. In section.R, use lsp_settings$get("nline_to_break_succession") here: https://github.com/REditorSupport/languageserver/blob/7f7605b55a6cbe05e0033b40f21e87408c06e102/R/section.R#L19
renkun-ken commented 7 months ago

It is perfectly okay to send a PR on this if you find it useful.