summaryrefslogtreecommitdiff
path: root/vim/pack/downloads/opt/lsp/syntax/lspgfm.vim
blob: 9e7101093b3e9acd0bf499e8a61d89e21fb67e1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
vim9script

if get(b:, 'markdown_fallback', v:false)
  runtime! syntax/markdown.vim
  finish
endif

var group: dict<string> = {}
for region in get(b:, 'lsp_syntax', [])
  if !group->has_key(region.lang)
    group[region.lang] = region.lang->substitute('\(^.\|_\a\)', '\u&', 'g')
    try
      exe $'syntax include @{group[region.lang]} syntax/{region.lang}.vim'
    catch /.*/
      group[region.lang] = ''
    endtry
  endif
  if !group[region.lang]->empty()
    exe $'syntax region lspCodeBlock start="{region.start}" end="{region.end}" contains=@{group[region.lang]}'
  endif
endfor

# vim: tabstop=8 shiftwidth=2 softtabstop=2