2018-05-28 14:16:15 +00:00
|
|
|
After:
|
|
|
|
unlet! b:ale_tsserver_completion_names
|
|
|
|
|
2017-11-26 12:24:18 +00:00
|
|
|
Execute(TypeScript completions responses should be parsed correctly):
|
|
|
|
AssertEqual [],
|
|
|
|
\ ale#completion#ParseTSServerCompletions({
|
|
|
|
\ 'body': [],
|
|
|
|
\})
|
2019-09-12 20:53:23 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'word': 'foo',
|
|
|
|
\ 'source': '/path/to/foo.ts',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'word': 'bar',
|
|
|
|
\ 'source': '',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'word': 'baz',
|
|
|
|
\ 'source': '',
|
|
|
|
\ }
|
|
|
|
\ ],
|
2017-11-26 12:24:18 +00:00
|
|
|
\ ale#completion#ParseTSServerCompletions({
|
|
|
|
\ 'body': [
|
2019-09-12 20:53:23 +00:00
|
|
|
\ {'name': 'foo', 'source': '/path/to/foo.ts'},
|
2017-11-26 12:24:18 +00:00
|
|
|
\ {'name': 'bar'},
|
|
|
|
\ {'name': 'baz'},
|
|
|
|
\ ],
|
|
|
|
\})
|
|
|
|
|
|
|
|
Execute(TypeScript completion details responses should be parsed correctly):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'word': 'abc',
|
|
|
|
\ 'menu': '(property) Foo.abc: number',
|
|
|
|
\ 'info': '',
|
2019-10-18 02:35:38 +00:00
|
|
|
\ 'kind': 'v',
|
2017-11-26 12:24:18 +00:00
|
|
|
\ 'icase': 1,
|
2019-09-12 20:53:23 +00:00
|
|
|
\ 'dup': g:ale_completion_tsserver_autoimport,
|
2017-11-26 12:24:18 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'word': 'def',
|
|
|
|
\ 'menu': '(property) Foo.def: number',
|
|
|
|
\ 'info': 'foo bar baz',
|
2019-10-18 02:35:38 +00:00
|
|
|
\ 'kind': 'v',
|
2017-11-26 12:24:18 +00:00
|
|
|
\ 'icase': 1,
|
2019-09-12 20:53:23 +00:00
|
|
|
\ 'dup': g:ale_completion_tsserver_autoimport,
|
2018-05-28 14:16:15 +00:00
|
|
|
\ },
|
2018-09-10 22:47:04 +00:00
|
|
|
\ {
|
|
|
|
\ 'word': 'ghi',
|
|
|
|
\ 'menu': '(class) Foo',
|
|
|
|
\ 'info': '',
|
2019-10-18 02:35:38 +00:00
|
|
|
\ 'kind': 'v',
|
2018-09-10 22:47:04 +00:00
|
|
|
\ 'icase': 1,
|
2019-09-12 20:53:23 +00:00
|
|
|
\ 'dup': g:ale_completion_tsserver_autoimport,
|
2018-09-10 22:47:04 +00:00
|
|
|
\ },
|
2018-05-28 14:16:15 +00:00
|
|
|
\ ],
|
|
|
|
\ ale#completion#ParseTSServerCompletionEntryDetails({
|
|
|
|
\ 'body': [
|
|
|
|
\ {
|
|
|
|
\ 'name': 'abc',
|
|
|
|
\ 'kind': 'parameterName',
|
|
|
|
\ 'displayParts': [
|
|
|
|
\ {'text': '('},
|
|
|
|
\ {'text': 'property'},
|
|
|
|
\ {'text': ')'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'Foo'},
|
|
|
|
\ {'text': '.'},
|
|
|
|
\ {'text': 'abc'},
|
|
|
|
\ {'text': ':'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'number'},
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'name': 'def',
|
|
|
|
\ 'kind': 'parameterName',
|
|
|
|
\ 'displayParts': [
|
|
|
|
\ {'text': '('},
|
|
|
|
\ {'text': 'property'},
|
|
|
|
\ {'text': ')'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'Foo'},
|
|
|
|
\ {'text': '.'},
|
|
|
|
\ {'text': 'def'},
|
|
|
|
\ {'text': ':'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'number'},
|
|
|
|
\ ],
|
|
|
|
\ 'documentation': [
|
|
|
|
\ {'text': 'foo'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'bar'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'baz'},
|
|
|
|
\ ],
|
|
|
|
\ },
|
2018-09-10 22:47:04 +00:00
|
|
|
\ {
|
|
|
|
\ 'name': 'ghi',
|
|
|
|
\ 'kind': 'className',
|
|
|
|
\ 'displayParts': [
|
|
|
|
\ {'text': '('},
|
|
|
|
\ {'text': 'class'},
|
|
|
|
\ {'text': ')'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'Foo'},
|
|
|
|
\ ],
|
|
|
|
\ },
|
2018-05-28 14:16:15 +00:00
|
|
|
\ ],
|
|
|
|
\})
|
|
|
|
|
|
|
|
Execute(Entries without details should be included in the responses):
|
2019-09-12 20:53:23 +00:00
|
|
|
let b:ale_tsserver_completion_names = [{
|
|
|
|
\ 'word': 'xyz',
|
|
|
|
\ 'source': '/path/to/xyz.ts',
|
|
|
|
\ }]
|
2018-05-28 14:16:15 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'word': 'abc',
|
2019-09-20 06:05:00 +00:00
|
|
|
\ 'menu': 'import { def } from "./Foo"; (property) Foo.abc: number',
|
2018-05-28 14:16:15 +00:00
|
|
|
\ 'info': '',
|
2019-10-18 02:35:38 +00:00
|
|
|
\ 'kind': 'v',
|
2018-05-28 14:16:15 +00:00
|
|
|
\ 'icase': 1,
|
2019-09-12 20:53:23 +00:00
|
|
|
\ 'user_data': json_encode({
|
|
|
|
\ 'codeActions': [{
|
2019-09-20 06:05:00 +00:00
|
|
|
\ 'description': 'import { def } from "./Foo";',
|
2019-09-12 20:53:23 +00:00
|
|
|
\ 'changes': [],
|
|
|
|
\ }],
|
|
|
|
\ }),
|
|
|
|
\ 'dup': g:ale_completion_tsserver_autoimport,
|
2018-05-28 14:16:15 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'word': 'def',
|
|
|
|
\ 'menu': '(property) Foo.def: number',
|
|
|
|
\ 'info': 'foo bar baz',
|
2019-10-18 02:35:38 +00:00
|
|
|
\ 'kind': 'v',
|
2018-05-28 14:16:15 +00:00
|
|
|
\ 'icase': 1,
|
2019-09-12 20:53:23 +00:00
|
|
|
\ 'dup': g:ale_completion_tsserver_autoimport,
|
2018-05-28 14:16:15 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'word': 'xyz',
|
|
|
|
\ 'menu': '',
|
|
|
|
\ 'info': '',
|
|
|
|
\ 'kind': 'v',
|
|
|
|
\ 'icase': 1,
|
2017-11-26 12:24:18 +00:00
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale#completion#ParseTSServerCompletionEntryDetails({
|
|
|
|
\ 'body': [
|
|
|
|
\ {
|
|
|
|
\ 'name': 'abc',
|
|
|
|
\ 'kind': 'parameterName',
|
|
|
|
\ 'displayParts': [
|
|
|
|
\ {'text': '('},
|
|
|
|
\ {'text': 'property'},
|
|
|
|
\ {'text': ')'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'Foo'},
|
|
|
|
\ {'text': '.'},
|
|
|
|
\ {'text': 'abc'},
|
|
|
|
\ {'text': ':'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'number'},
|
|
|
|
\ ],
|
2019-09-12 20:53:23 +00:00
|
|
|
\ 'codeActions': [{
|
2019-09-20 06:05:00 +00:00
|
|
|
\ 'description': 'import { def } from "./Foo";',
|
2019-09-12 20:53:23 +00:00
|
|
|
\ 'changes': [],
|
|
|
|
\ }],
|
2017-11-26 12:24:18 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'name': 'def',
|
|
|
|
\ 'kind': 'parameterName',
|
|
|
|
\ 'displayParts': [
|
|
|
|
\ {'text': '('},
|
|
|
|
\ {'text': 'property'},
|
|
|
|
\ {'text': ')'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'Foo'},
|
|
|
|
\ {'text': '.'},
|
|
|
|
\ {'text': 'def'},
|
|
|
|
\ {'text': ':'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'number'},
|
|
|
|
\ ],
|
|
|
|
\ 'documentation': [
|
|
|
|
\ {'text': 'foo'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'bar'},
|
|
|
|
\ {'text': ' '},
|
|
|
|
\ {'text': 'baz'},
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\})
|