Change svelte provider, fixes #700

This commit is contained in:
Adam Stankiewicz
2021-04-14 12:11:13 +02:00
parent 5de7022bcb
commit 067e07e137
8 changed files with 870 additions and 267 deletions

View File

@@ -2,46 +2,24 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'svelte', 'ftplugin/svelte.vim
finish
endif
" Vim filetype plugin
" Language: Svelte 3 (HTML/JavaScript)
" Author: Evan Lecklider <evan@lecklider.com>
" Maintainer: Evan Lecklide <evan@lecklider.com>
" URL: https://github.com/evanleck/vim-svelte
if (exists('b:did_ftplugin'))
finish
endif
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
" Matchit support
if exists('loaded_matchit') && !exists('b:match_words')
let b:match_ignorecase = 0
if !has('nvim')
setlocal matchpairs+=<:>
endif
" In order:
"
" 1. Svelte control flow keywords.
" 2. Parens.
" 3-5. HTML tags pulled from Vim itself.
"
" https://github.com/vim/vim/blob/5259275347667a90fb88d8ea74331f88ad68edfc/runtime/ftplugin/html.vim#L29-L35
let b:match_words =
\ '#\%(if\|await\|each\)\>:\:\%(else\|catch\|then\)\>:\/\%(if\|await\|each\)\>,' .
\ '{:},' .
if exists("loaded_matchit")
let b:match_ignorecase = 1
let b:match_words = '<:>,' .
\ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
\ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>,' .
\ '{#\(if\|each\)[^}]*}:{\:else[^}]*}:{\/\(if\|each\)},' .
\ '{#await[^}]*}:{\:then[^}]*}:{\/await},'
endif
" ALE fixing and linting.
if exists('g:loaded_ale')
if !exists('b:ale_fixers')
let b:ale_fixers = ['eslint', 'prettier', 'prettier_standard']
endif
if !exists('b:ale_linter_aliases')
let b:ale_linter_aliases = ['css', 'javascript']
endif
if !exists('b:ale_linters')
let b:ale_linters = ['stylelint', 'eslint']
endif
endif
" Indent correctly with template string for vim-javascript/builtin
" indentexpr
let b:syng_str = '^\%(.*template\)\@!.*string\|special'
let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'