mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-20 08:38:31 +08:00
Add ALERename (tsserver & LSP), ALEOrganizeImports (tsserver) and auto import support (tsserver) (#2709)
This commit adds support for renaming symbols in tsserver and with LSP tools, and for organising imports with tsserver. Completion results for symbols that can be imported are now suggested if enabled for tsserver completion done via ALE.
This commit is contained in:
@@ -6,10 +6,24 @@ Execute(TypeScript completions responses should be parsed correctly):
|
||||
\ ale#completion#ParseTSServerCompletions({
|
||||
\ 'body': [],
|
||||
\})
|
||||
AssertEqual ['foo', 'bar', 'baz'],
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'word': 'foo',
|
||||
\ 'source': '/path/to/foo.ts',
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'bar',
|
||||
\ 'source': '',
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'baz',
|
||||
\ 'source': '',
|
||||
\ }
|
||||
\ ],
|
||||
\ ale#completion#ParseTSServerCompletions({
|
||||
\ 'body': [
|
||||
\ {'name': 'foo'},
|
||||
\ {'name': 'foo', 'source': '/path/to/foo.ts'},
|
||||
\ {'name': 'bar'},
|
||||
\ {'name': 'baz'},
|
||||
\ ],
|
||||
@@ -24,6 +38,7 @@ Execute(TypeScript completion details responses should be parsed correctly):
|
||||
\ 'info': '',
|
||||
\ 'kind': 'f',
|
||||
\ 'icase': 1,
|
||||
\ 'dup': g:ale_completion_tsserver_autoimport,
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'def',
|
||||
@@ -31,6 +46,7 @@ Execute(TypeScript completion details responses should be parsed correctly):
|
||||
\ 'info': 'foo bar baz',
|
||||
\ 'kind': 'f',
|
||||
\ 'icase': 1,
|
||||
\ 'dup': g:ale_completion_tsserver_autoimport,
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'ghi',
|
||||
@@ -38,6 +54,7 @@ Execute(TypeScript completion details responses should be parsed correctly):
|
||||
\ 'info': '',
|
||||
\ 'kind': 'f',
|
||||
\ 'icase': 1,
|
||||
\ 'dup': g:ale_completion_tsserver_autoimport,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#completion#ParseTSServerCompletionEntryDetails({
|
||||
@@ -96,7 +113,10 @@ Execute(TypeScript completion details responses should be parsed correctly):
|
||||
\})
|
||||
|
||||
Execute(Entries without details should be included in the responses):
|
||||
let b:ale_tsserver_completion_names = ['xyz']
|
||||
let b:ale_tsserver_completion_names = [{
|
||||
\ 'word': 'xyz',
|
||||
\ 'source': '/path/to/xyz.ts',
|
||||
\ }]
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
@@ -106,6 +126,13 @@ Execute(Entries without details should be included in the responses):
|
||||
\ 'info': '',
|
||||
\ 'kind': 'f',
|
||||
\ 'icase': 1,
|
||||
\ 'user_data': json_encode({
|
||||
\ 'codeActions': [{
|
||||
\ 'description': 'abc action',
|
||||
\ 'changes': [],
|
||||
\ }],
|
||||
\ }),
|
||||
\ 'dup': g:ale_completion_tsserver_autoimport,
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'def',
|
||||
@@ -113,6 +140,7 @@ Execute(Entries without details should be included in the responses):
|
||||
\ 'info': 'foo bar baz',
|
||||
\ 'kind': 'f',
|
||||
\ 'icase': 1,
|
||||
\ 'dup': g:ale_completion_tsserver_autoimport,
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'xyz',
|
||||
@@ -139,6 +167,10 @@ Execute(Entries without details should be included in the responses):
|
||||
\ {'text': ' '},
|
||||
\ {'text': 'number'},
|
||||
\ ],
|
||||
\ 'codeActions': [{
|
||||
\ 'description': 'abc action',
|
||||
\ 'changes': [],
|
||||
\ }],
|
||||
\ },
|
||||
\ {
|
||||
\ 'name': 'def',
|
||||
|
||||
Reference in New Issue
Block a user