From 468681284d77ad474ba215fc9f5cf67b77d3c502 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 25 Mar 2023 19:56:07 +0800 Subject: [PATCH] feat(checkers): add `open_error_list` option close https://github.com/SpaceVim/SpaceVim/issues/4796 --- autoload/SpaceVim/layers/checkers.vim | 8 ++++++++ config/plugins/neomake.vim | 2 -- doc/SpaceVim.txt | 2 ++ docs/cn/layers/checkers.md | 1 + docs/layers/checkers.md | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/checkers.vim b/autoload/SpaceVim/layers/checkers.vim index 5b3d6f0a4..f964302d9 100644 --- a/autoload/SpaceVim/layers/checkers.vim +++ b/autoload/SpaceVim/layers/checkers.vim @@ -23,6 +23,8 @@ " - `show_cursor_error`: Enable/Disable displaying error below current line. " - `lint_exclude_filetype`: Set the filetypes which does not enable syntax " checking. +" - `open_error_list`: Open the language checking windows. when set to 0, the +" windows will not be opened automatically. Defaults to 2. if exists('s:show_cursor_error') @@ -38,6 +40,7 @@ endif let s:lint_exclude_filetype = [] let s:lint_on_the_fly = 0 let s:lint_on_save = 1 +let s:open_error_list = 0 let s:SIG = SpaceVim#api#import('vim#signatures') let s:STRING = SpaceVim#api#import('data#string') @@ -72,6 +75,9 @@ function! SpaceVim#layers#checkers#set_variable(var) abort call SpaceVim#logger#warn('show_cursor_error in checkers layer needs timers feature') let s:show_cursor_error = 0 endif + + + let s:open_error_list = get(a:var, 'open_error_list', s:open_error_list) endfunction function! SpaceVim#layers#checkers#get_options() abort @@ -102,6 +108,8 @@ function! SpaceVim#layers#checkers#config() abort let g:neomake_{ft}_enabled_makers = [] endfor + let g:neomake_open_list = s:open_error_list + elseif g:spacevim_lint_engine ==# 'ale' let g:ale_echo_delay = get(g:, 'ale_echo_delay', 300) diff --git a/config/plugins/neomake.vim b/config/plugins/neomake.vim index 43e119a40..e2ef44b87 100644 --- a/config/plugins/neomake.vim +++ b/config/plugins/neomake.vim @@ -1,5 +1,4 @@ scriptencoding utf-8 -" 1 open list and move cursor 2 open list without move cursor let s:lint_option = SpaceVim#layers#checkers#get_lint_option() let s:neomake_automake_events = {} @@ -16,7 +15,6 @@ if !empty(s:neomake_automake_events) catch /^Vim\%((\a\+)\)\=:E117/ endtry endif -let g:neomake_open_list = get(g:, 'neomake_open_list', 2) let g:neomake_verbose = get(g:, 'neomake_verbose', 0) let g:neomake_java_javac_delete_output = get(g:, 'neomake_java_javac_delete_output', 0) let g:neomake_error_sign = get(g:, 'neomake_error_sign', { diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 48a136b41..2e8088055 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -1792,6 +1792,8 @@ OPTIONS `show_cursor_error`: Enable/Disable displaying error below current line. `lint_exclude_filetype`: Set the filetypes which does not enable syntax checking. +`open_error_list`: Open the language checking windows. when set to 0, the + windows will not be opened automatically. Defaults to 2. ============================================================================== COLORSCHEME *SpaceVim-layers-colorscheme* diff --git a/docs/cn/layers/checkers.md b/docs/cn/layers/checkers.md index cfa39942b..1dda20175 100644 --- a/docs/cn/layers/checkers.md +++ b/docs/cn/layers/checkers.md @@ -55,6 +55,7 @@ lang: zh | `lint_on_save` | `true` | 设置保存文件时进行语法检查,默认已启用 | | `show_cursor_error` | `true` | 设置在当前行下方展示语法错误,默认已启用 | | `lint_exclude_filetype` | `[]` | 设置禁用语法检查的文件类型列表 | +| `open_error_list` | `1/2/0` | 设置语法检查结果窗口打开方式,默认为 2 | ```toml [[layers]] diff --git a/docs/layers/checkers.md b/docs/layers/checkers.md index c5aef7ff5..a2e0d3987 100644 --- a/docs/layers/checkers.md +++ b/docs/layers/checkers.md @@ -57,6 +57,7 @@ feature, you may need to load this layer with `show_cursor_error` to `false`. | `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. | +| `open_error_list` | `1/2/0` | Open the language checking windows. Defaults to 2 | ```toml [[layers]]