mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-13 02:05:40 +08:00
feat(checkers): add lint_exclude_filetype
option
close https://github.com/SpaceVim/SpaceVim/issues/4553
This commit is contained in:
parent
3dccacb0d8
commit
db7dee960f
@ -21,6 +21,8 @@
|
||||
" - `lint_on_the_fly`: Syntax checking on the fly feature, disabled by default.
|
||||
" - `lint_on_save`: Run syntax checking when saving a file.
|
||||
" - `show_cursor_error`: Enable/Disable displaying error below current line.
|
||||
" - `lint_exclude_filetype`: Set the filetypes which does not enable syntax
|
||||
" checking.
|
||||
|
||||
|
||||
if exists('s:show_cursor_error')
|
||||
@ -33,6 +35,8 @@ else
|
||||
let s:show_cursor_error = 0
|
||||
endif
|
||||
|
||||
let s:lint_exclude_filetype = []
|
||||
|
||||
let s:SIG = SpaceVim#api#import('vim#signatures')
|
||||
let s:STRING = SpaceVim#api#import('data#string')
|
||||
|
||||
@ -59,6 +63,7 @@ function! SpaceVim#layers#checkers#set_variable(var) abort
|
||||
|
||||
let s:show_cursor_error = get(a:var, 'show_cursor_error', 1)
|
||||
let s:lint_on_the_fly = get(a:var, 'lint_on_the_fly', 1)
|
||||
let s:lint_exclude_filetype = get(a:var, 'lint_exclude_filetype', [])
|
||||
|
||||
if s:show_cursor_error && !has('timers')
|
||||
call SpaceVim#logger#warn('show_cursor_error in checkers layer needs timers feature')
|
||||
@ -80,6 +85,11 @@ function! SpaceVim#layers#checkers#config() abort
|
||||
let g:neomake_cursormoved_delay = get(g:, 'neomake_cursormoved_delay', 300)
|
||||
let g:neomake_virtualtext_current_error = get(g:, 'neomake_virtualtext_current_error', !s:show_cursor_error)
|
||||
|
||||
" exclude filetypes:
|
||||
for ft in s:lint_exclude_filetype
|
||||
let g:neomake_{ft}_enabled_makers = []
|
||||
endfor
|
||||
|
||||
elseif g:spacevim_lint_engine ==# 'ale'
|
||||
let g:ale_echo_delay = get(g:, 'ale_echo_delay', 300)
|
||||
endif
|
||||
|
@ -1655,6 +1655,8 @@ OPTIONS
|
||||
`lint_on_the_fly`: Syntax checking on the fly feature, disabled by default.
|
||||
`lint_on_save`: Run syntax checking when saving a file.
|
||||
`show_cursor_error`: Enable/Disable displaying error below current line.
|
||||
`lint_exclude_filetype`: Set the filetypes which does not enable syntax
|
||||
checking.
|
||||
|
||||
==============================================================================
|
||||
COLORSCHEME *SpaceVim-layers-colorscheme*
|
||||
|
@ -51,11 +51,12 @@ you can use vim script. For all the info about neomake configuration, please che
|
||||
By default, the error will be displayed below the current line, if you want to disabled this
|
||||
feature, you may need to load this layer with `show_cursor_error` to `false`.
|
||||
|
||||
| Name | default value | description |
|
||||
| ------------------- | ------------- | -------------------------------------------------------- |
|
||||
| `lint_on_the_fly` | `false` | Syntax checking on the fly feature, disabled by default. |
|
||||
| `lint_on_save` | `true` | Run syntax checking when saving a file. |
|
||||
| `show_cursor_error` | `true` | Enable/Disable displaying error below current line. |
|
||||
| Name | default value | description |
|
||||
| ----------------------- | ------------- | -------------------------------------------------------- |
|
||||
| `lint_on_the_fly` | `false` | Syntax checking on the fly feature, disabled by default. |
|
||||
| `lint_on_save` | `true` | Run syntax checking when saving a file. |
|
||||
| `show_cursor_error` | `true` | Enable/Disable displaying error below current line. |
|
||||
| `lint_exclude_filetype` | `[]` | Set the filetypes which does not enable syntax checking. |
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user