mirror of
https://github.com/dense-analysis/ale
synced 2024-12-17 20:05:31 +00:00
Add an option to save hidden buffers
When commands are run, it can be useful to just save the hidden buffers so language servers immediately get updated with changes to files without you having to manually save each file. You can now enable this by setting `g:ale_save_hidden` to `1`.
This commit is contained in:
parent
8ba7ae818c
commit
551fbcfb09
@ -19,7 +19,7 @@ function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort
|
||||
\ },
|
||||
\ {
|
||||
\ 'conn_id': a:conn_id,
|
||||
\ 'should_save': !&hidden,
|
||||
\ 'should_save': g:ale_save_hidden || !&hidden,
|
||||
\ },
|
||||
\)
|
||||
endfunction
|
||||
|
@ -85,7 +85,7 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort
|
||||
\ },
|
||||
\ {
|
||||
\ 'conn_id': a:conn_id,
|
||||
\ 'should_save': !&hidden,
|
||||
\ 'should_save': g:ale_save_hidden || !&hidden,
|
||||
\ },
|
||||
\)
|
||||
endfunction
|
||||
@ -118,7 +118,7 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort
|
||||
\ },
|
||||
\ {
|
||||
\ 'conn_id': a:conn_id,
|
||||
\ 'should_save': !&hidden,
|
||||
\ 'should_save': g:ale_save_hidden || !&hidden,
|
||||
\ },
|
||||
\)
|
||||
endif
|
||||
|
18
doc/ale.txt
18
doc/ale.txt
@ -1260,7 +1260,6 @@ g:ale_floating_preview_popup_opts *g:ale_floating_preview_popup_opts*
|
||||
let g:ale_floating_preview_popup_opts = 'g:CustomOpts'
|
||||
<
|
||||
|
||||
|
||||
g:ale_floating_window_border *g:ale_floating_window_border*
|
||||
|
||||
Type: |List|
|
||||
@ -1974,6 +1973,16 @@ g:ale_root *g:ale_root*
|
||||
LSP linter, it will not run.
|
||||
|
||||
|
||||
g:ale_save_hidden *g:ale_save_hidden*
|
||||
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
When set to `1`, save buffers when 'hidden' is set when applying code
|
||||
actions or rename operations, such as through |ALERename| or
|
||||
|ALEOrganizeImports|.
|
||||
|
||||
|
||||
g:ale_set_balloons *g:ale_set_balloons*
|
||||
*b:ale_set_balloons*
|
||||
|
||||
@ -3646,14 +3655,15 @@ ALERename *ALERename*
|
||||
The symbol where the cursor is resting will be the symbol renamed, and a
|
||||
prompt will open to request a new name.
|
||||
|
||||
The rename operation will save all modified buffers when `set nohidden` is
|
||||
set, because that disables leaving unsaved buffers in the background. See
|
||||
`:help hidden` for more details.
|
||||
The rename operation will not save modified buffers when 'hidden' is on
|
||||
unless |g:ale_save_hidden| is `1`.
|
||||
|
||||
|
||||
ALEFileRename *ALEFileRename*
|
||||
|
||||
Rename a file and fix imports using `tsserver`.
|
||||
|
||||
|
||||
ALECodeAction *ALECodeAction*
|
||||
|
||||
Apply a code action via LSP servers or `tsserver`.
|
||||
|
@ -191,6 +191,9 @@ let g:ale_deno_executable = get(g:, 'ale_deno_executable', 'deno')
|
||||
" If 1, enable a popup menu for commands.
|
||||
let g:ale_popup_menu_enabled = get(g:, 'ale_popup_menu_enabled', has('gui_running'))
|
||||
|
||||
" If 0, save hidden files when code actions are applied.
|
||||
let g:ale_save_hidden = get(g:, 'ale_save_hidden', 0)
|
||||
|
||||
" If 1, disables ALE's built in error display. Instead, all errors are piped
|
||||
" to the diagnostics API.
|
||||
let g:ale_use_neovim_diagnostics_api = get(g:, 'ale_use_neovim_diagnostics_api', 0)
|
||||
|
@ -59,7 +59,7 @@ Before:
|
||||
|
||||
function! ale#code_action#HandleCodeAction(code_action, options) abort
|
||||
let g:handle_code_action_called = 1
|
||||
AssertEqual !&hidden, get(a:options, 'should_save')
|
||||
AssertEqual g:ale_save_hidden || !&hidden, get(a:options, 'should_save')
|
||||
call add(g:code_actions, a:code_action)
|
||||
endfunction
|
||||
|
||||
|
@ -59,7 +59,7 @@ Before:
|
||||
|
||||
function! ale#code_action#HandleCodeAction(code_action, options) abort
|
||||
let g:handle_code_action_called = 1
|
||||
AssertEqual !&hidden, get(a:options, 'should_save', 0)
|
||||
AssertEqual g:ale_save_hidden || !&hidden, get(a:options, 'should_save', 0)
|
||||
call add(g:code_actions, a:code_action)
|
||||
endfunction
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user