aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2022-07-15 17:13:16 +0200
committerGitHub <noreply@github.com>2022-07-15 08:13:16 -0700
commit9370e1c5111ee90f64260398b0623da4759f8f16 (patch)
treed036ddd6bc893010fd95cf590f9cd95da8166947
parent1c9f487f0edc3e6a10a53dc83a3d779980dc3a26 (diff)
downloadrneovim-9370e1c5111ee90f64260398b0623da4759f8f16.tar.gz
rneovim-9370e1c5111ee90f64260398b0623da4759f8f16.tar.bz2
rneovim-9370e1c5111ee90f64260398b0623da4759f8f16.zip
feat(lsp): hide backticks in LSP docstrings #19377
Also clear `markdownError`: don't want to highlight invalid markdown syntax in LSP docstrings. fix #16114
-rw-r--r--runtime/syntax/lsp_markdown.vim27
1 files changed, 19 insertions, 8 deletions
diff --git a/runtime/syntax/lsp_markdown.vim b/runtime/syntax/lsp_markdown.vim
index 90d3185673..4be7595807 100644
--- a/runtime/syntax/lsp_markdown.vim
+++ b/runtime/syntax/lsp_markdown.vim
@@ -1,23 +1,34 @@
" Vim syntax file
-" Language: lsp_markdown
-" Maintainer: Michael Lingelbach <m.j.lbach@gmail.com
-" URL: http://neovim.io
-" Remark: Uses markdown syntax file
+" Language: Markdown-like LSP docstrings
+" Maintainer: https://github.com/neovim/neovim
+" URL: http://neovim.io
+" Remark: Uses markdown syntax file
-" always source the system included markdown instead of any other installed
-" markdown.vim syntax files
+" Source the default Nvim markdown syntax, not other random ones.
execute 'source' expand('<sfile>:p:h') .. '/markdown.vim'
syn cluster mkdNonListItem add=mkdEscape,mkdNbsp
+" Don't highlight invalid markdown syntax in LSP docstrings.
+syn clear markdownError
+
syn clear markdownEscape
syntax region markdownEscape matchgroup=markdownEscape start=/\\\ze[\\\x60*{}\[\]()#+\-,.!_>~|"$%&'\/:;<=?@^ ]/ end=/./ containedin=ALL keepend oneline concealends
-" conceal html entities
+" Conceal backticks (which delimit code fragments).
+" We ignore g:markdown_syntax_conceal here.
+syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart concealends
+syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart concealends
+syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*````*.*$" end="^\s*````*\ze\s*$" keepend concealends
+
+" Highlight code fragments.
+hi def link markdownCode Special
+
+" Conceal HTML entities.
syntax match mkdNbsp /&nbsp;/ conceal cchar=
syntax match mkdLt /&lt;/ conceal cchar=<
syntax match mkdGt /&gt;/ conceal cchar=>
syntax match mkdAmp /&amp;/ conceal cchar=&
syntax match mkdQuot /&quot;/ conceal cchar="
-hi def link mkdEscape special
+hi def link mkdEscape Special