Skip to content

Conversation

@dkearns
Copy link
Contributor

@dkearns dkearns commented Sep 4, 2021

This also enables folding of multiple consecutive line comments as a
single block.

This also enables folding of multiple consecutive line comments as a
single block.
@dkearns dkearns force-pushed the add-folding-to-block-comments branch from 7445bb2 to b2a0b11 Compare December 10, 2021 09:34
benknoble added a commit to benknoble/vim-racket that referenced this pull request Sep 10, 2025
By Doug Kearns:
* Add syntax based folding for block comments

Conflicts:
  - syntax/racket.vim has undergone many changes since this patch was
    first sent in 2021. Notably, we expanded "syn" to "syntax", added a
    "FormComment", converted "racketNormal" to "racketTop", and ripped
    out "HiLink". See relevant commits:
      - 25386d9 (syntax: greatly simplify quoting and nesting, 2020-12-28)
      - c75129d (syntax: add simple form-level comment (#;), 2020-12-28)
      - af2980a (syntax: remove special handling of Vim 5, 2022-01-26)
      - 9f9a3ae (Use unabbreviated 'syntax' command name, 2022-08-11)

PR: wlangstroth#69
@benknoble
Copy link
Contributor

benknoble commented Sep 10, 2025

@dkearns I've attempted to merge this to https://github.com/benknoble/vim-racket (see results in https://github.com/benknoble/vim-racket/tree/merge-69). Can you let me know if that merge looks correct to you? I'll test drive it a bit, too.

In particular, look at 32d4343 (Merge syntax based folding for block comments, 2025-09-10).

@benknoble
Copy link
Contributor

From a quick drive, it looks like it works to me for folding. I didn't try the "no_fold" override.

benknoble added a commit to benknoble/vim-racket that referenced this pull request Sep 19, 2025
By Doug Kearns:
* Add syntax based folding for block comments

Conflicts:
  - syntax/racket.vim has undergone many changes since this patch was
    first sent in 2021. Notably, we expanded "syn" to "syntax", added a
    "FormComment", converted "racketNormal" to "racketTop", and ripped
    out "HiLink". See relevant commits:
      - 25386d9 (syntax: greatly simplify quoting and nesting, 2020-12-28)
      - c75129d (syntax: add simple form-level comment (#;), 2020-12-28)
      - af2980a (syntax: remove special handling of Vim 5, 2022-01-26)
      - 9f9a3ae (Use unabbreviated 'syntax' command name, 2022-08-11)

PR: wlangstroth#69
Best-viewed-with: --diff-merges=1
@benknoble
Copy link
Contributor

I did have to push one fix to the merge-69 temporary branch for multiline comments:

range-diff: re-include form comments in racketTop
1:  b2a0b11 = 1:  b2a0b11 Add syntax based folding for block comments
2:  32d4343 ! 2:  f251a43 Merge syntax based folding for block comments
    @@ Commit message
               - 9f9a3ae (Use unabbreviated 'syntax' command name, 2022-08-11)
     
         PR: https://github.com/wlangstroth/vim-racket/pull/69
    +    Best-viewed-with: --diff-merges=1
     
      ## syntax/racket.vim ##
     @@ syntax/racket.vim: syntax match racketUnquote ",@"
    @@ syntax/racket.vim: syntax match racketUnquote ",@"
      syntax match racketComment /;.*$/ contains=racketTodo,racketNote,@Spell
     -syntax region racketMultilineComment start=/#|/ end=/|#/ contains=racketMultilineComment,racketTodo,racketNote,@Spell
      syntax match racketFormComment "#;" nextgroup=@racketTop
    - 
    ++syntax cluster racketTop add=racketFormComment
    ++
     +if exists("racket_no_comment_fold")
     +  syntax region racketBlockComment start=/#|/ end=/|#/ contains=racketBlockComment,racketTodo,racketNote,@Spell
     +else
     +  syntax region racketBlockComment start=/#|/ end=/|#/ contains=racketBlockComment,racketTodo,racketNote,@Spell fold
     +  syntax region racketMultilineComment start="^\s*;" end="^\%(\s*;\)\@!" contains=racketComment transparent keepend fold
     +endif
    -+
    + 
      syntax match racketTodo /\C\<\(FIXME\|TODO\|XXX\)\ze:\?\>/ contained
      syntax match racketNote /\CNOTE\ze:\?/ contained
      

@benknoble
Copy link
Contributor

I've gone ahead and pushed my merge of this to benknoble/vim-racket's master branch.

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.

2 participants