google / google/vimdoc

Don't split backtick-quoted strings in paragraphs

Open
#116 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
306
Forks
30
PR merge metrics
No merged PRs in 30d

Description

Vim help syntax recognizes backtick-quoted strings as short code snippets. It doesn't show the backticks, and applies a highlight group. However, it appears to only recognize these quotes if they appear on a single line. Vimdoc's paragraph algorithm will reflow comment text without regard to backtick placement, which can lead a snippet to be awkwardly split across two lines, losing the special treatment in the help buffer.

Example:
```vim
""
" @public
" @dict Lexer
" Attempts to read an identifier at the current position, returning a
" @dict(Token) with `type = 'identifier'` if successful and an empty dict
" otherwise. By default, this calls
" `self.ReadPatternAs('\v^\k+', 'identifier')` Language-specific lexers may
" set a different ReadIdentifier function property.
function! foo#ReadIdentifier() abort dict
" ...
endfunction
```
Vimdoc turns this into
```
Lexer.ReadIdentifier() *Lexer.ReadIdentifier()*
Attempts to read an identifier at the current position, returning a
|foo.Token| with `type = 'identifier'` if successful and an empty dict
otherwise. By default, this calls `self.ReadPatternAs('\v^\k+',
'identifier')` Language-specific lexers may set a different ReadIdentifier
function property.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.