mirror of
https://github.com/dense-analysis/ale
synced 2024-12-19 21:02:02 +00:00
Allow the user to remove warnings from completions
This commit is contained in:
parent
db6b1b5ecc
commit
db5fe5659f
@ -16,6 +16,7 @@ let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100)
|
||||
let g:ale_completion_excluded_words = get(g:, 'ale_completion_excluded_words', [])
|
||||
let g:ale_completion_max_suggestions = get(g:, 'ale_completion_max_suggestions', 50)
|
||||
let g:ale_completion_tsserver_autoimport = get(g:, 'ale_completion_tsserver_autoimport', 0)
|
||||
let g:ale_completion_tsserver_remove_warnings = get(g:, 'ale_completion_tsserver_remove_warnings', 0)
|
||||
|
||||
let s:timer_id = -1
|
||||
let s:last_done_pos = []
|
||||
@ -297,10 +298,12 @@ function! ale#completion#ParseTSServerCompletions(response) abort
|
||||
let l:names = []
|
||||
|
||||
for l:suggestion in a:response.body
|
||||
call add(l:names, {
|
||||
\ 'word': l:suggestion.name,
|
||||
\ 'source': get(l:suggestion, 'source', ''),
|
||||
\})
|
||||
if g:ale_completion_tsserver_remove_warnings == 0 || l:suggestion.kind isnot# 'warning'
|
||||
call add(l:names, {
|
||||
\ 'word': l:suggestion.name,
|
||||
\ 'source': get(l:suggestion, 'source', ''),
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:names
|
||||
|
@ -420,7 +420,9 @@ completion information with Deoplete, consult Deoplete's documentation.
|
||||
|
||||
When working with TypeScript files, ALE by can support automatic imports
|
||||
from external modules. This behavior can be enabled by setting the
|
||||
|g:ale_completion_tsserver_autoimport| variable to `1`.
|
||||
|g:ale_completion_tsserver_autoimport| variable to `1`. ALE can also remove
|
||||
warnings from your completions by setting the
|
||||
|g:ale_completion_tsserver_remove_warnings| variable to 1.
|
||||
|
||||
*ale-completion-completeopt-bug*
|
||||
|
||||
|
@ -29,6 +29,51 @@ Execute(TypeScript completions responses should be parsed correctly):
|
||||
\ ],
|
||||
\})
|
||||
|
||||
Execute(TypeScript completions responses should include warnings):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'word': 'foo',
|
||||
\ 'source': '/path/to/foo.ts',
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'bar',
|
||||
\ 'source': '',
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'baz',
|
||||
\ 'source': '',
|
||||
\ }
|
||||
\ ],
|
||||
\ ale#completion#ParseTSServerCompletions({
|
||||
\ 'body': [
|
||||
\ {'name': 'foo', 'source': '/path/to/foo.ts'},
|
||||
\ {'name': 'bar', 'kind': 'warning'},
|
||||
\ {'name': 'baz'},
|
||||
\ ],
|
||||
\})
|
||||
|
||||
Execute(TypeScript completions responses should not include warnings if excluded):
|
||||
let g:ale_completion_tsserver_remove_warnings = 1
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'word': 'foo',
|
||||
\ 'source': '/path/to/foo.ts',
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'baz',
|
||||
\ 'source': '',
|
||||
\ }
|
||||
\ ],
|
||||
\ ale#completion#ParseTSServerCompletions({
|
||||
\ 'body': [
|
||||
\ {'name': 'foo', 'source': '/path/to/foo.ts'},
|
||||
\ {'name': 'bar', 'kind': 'warning'},
|
||||
\ {'name': 'baz'},
|
||||
\ ],
|
||||
\})
|
||||
|
||||
Execute(TypeScript completion details responses should be parsed correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
|
Loading…
Reference in New Issue
Block a user