Fix #130 - Run linters when the filetype is changed
This commit is contained in:
parent
c9ee3efc11
commit
ab3fd2e849
11
doc/ale.txt
11
doc/ale.txt
@ -276,6 +276,17 @@ g:ale_lint_on_enter *g:ale_lint_on_enter*
|
|||||||
behaviour.
|
behaviour.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_lint_on_filetype_changed *g:ale_lint_on_filetype_changed*
|
||||||
|
|
||||||
|
Type: |Number|
|
||||||
|
Default: `1`
|
||||||
|
|
||||||
|
This option will cause ALE to run whenever the filetype is changed. A short
|
||||||
|
delay will be used before linting will be done, so the filetype can be
|
||||||
|
changed quickly several times in a row, but resulting in only one lint
|
||||||
|
cycle.
|
||||||
|
|
||||||
|
|
||||||
g:ale_lint_on_save *g:ale_lint_on_save*
|
g:ale_lint_on_save *g:ale_lint_on_save*
|
||||||
|
|
||||||
Type: |Number|
|
Type: |Number|
|
||||||
|
@ -78,6 +78,9 @@ let g:ale_lint_on_enter = get(g:, 'ale_lint_on_enter', 1)
|
|||||||
" This flag can be set to 1 to enable linting when a buffer is written.
|
" This flag can be set to 1 to enable linting when a buffer is written.
|
||||||
let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 1)
|
let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 1)
|
||||||
|
|
||||||
|
" This flag can be set to 1 to enable linting when the filetype is changed.
|
||||||
|
let g:ale_lint_on_filetype_changed = get(g:, 'ale_lint_on_filetype_changed', 1)
|
||||||
|
|
||||||
" This flag may be set to 0 to disable ale. After ale is loaded, :ALEToggle
|
" This flag may be set to 0 to disable ale. After ale is loaded, :ALEToggle
|
||||||
" should be used instead.
|
" should be used instead.
|
||||||
let g:ale_enabled = get(g:, 'ale_enabled', 1)
|
let g:ale_enabled = get(g:, 'ale_enabled', 1)
|
||||||
@ -161,6 +164,13 @@ function! s:ALEInitAuGroups() abort
|
|||||||
endif
|
endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
augroup ALERunOnFiletypeChangeGroup
|
||||||
|
autocmd!
|
||||||
|
if g:ale_enabled && g:ale_lint_on_filetype_changed
|
||||||
|
autocmd FileType * call ale#Queue(300, 'lint_file')
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
augroup ALERunOnSaveGroup
|
augroup ALERunOnSaveGroup
|
||||||
autocmd!
|
autocmd!
|
||||||
if g:ale_enabled && g:ale_lint_on_save
|
if g:ale_enabled && g:ale_lint_on_save
|
||||||
|
@ -15,6 +15,7 @@ Before:
|
|||||||
\ 'ALECursorGroup',
|
\ 'ALECursorGroup',
|
||||||
\ 'ALEHighlightBufferGroup',
|
\ 'ALEHighlightBufferGroup',
|
||||||
\ 'ALERunOnEnterGroup',
|
\ 'ALERunOnEnterGroup',
|
||||||
|
\ 'ALERunOnFiletypeChangeGroup',
|
||||||
\ 'ALERunOnSaveGroup',
|
\ 'ALERunOnSaveGroup',
|
||||||
\ 'ALERunOnTextChangedGroup',
|
\ 'ALERunOnTextChangedGroup',
|
||||||
\]
|
\]
|
||||||
|
Loading…
Reference in New Issue
Block a user