mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 05:24:46 +08:00
#1162 Add unfinished experimental code for supporting LSP completion, clean up the tests, and make the completion cancelling better
This commit is contained in:
75
test/completion/test_tsserver_completion_parsing.vader
Normal file
75
test/completion/test_tsserver_completion_parsing.vader
Normal file
@@ -0,0 +1,75 @@
|
||||
Execute(TypeScript completions responses should be parsed correctly):
|
||||
AssertEqual [],
|
||||
\ ale#completion#ParseTSServerCompletions({
|
||||
\ 'body': [],
|
||||
\})
|
||||
AssertEqual ['foo', 'bar', 'baz'],
|
||||
\ ale#completion#ParseTSServerCompletions({
|
||||
\ 'body': [
|
||||
\ {'name': 'foo'},
|
||||
\ {'name': 'bar'},
|
||||
\ {'name': 'baz'},
|
||||
\ ],
|
||||
\})
|
||||
|
||||
Execute(TypeScript completion details responses should be parsed correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'word': 'abc',
|
||||
\ 'menu': '(property) Foo.abc: number',
|
||||
\ 'info': '',
|
||||
\ 'kind': 'f',
|
||||
\ 'icase': 1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'word': 'def',
|
||||
\ 'menu': '(property) Foo.def: number',
|
||||
\ 'info': 'foo bar baz',
|
||||
\ 'kind': 'f',
|
||||
\ 'icase': 1,
|
||||
\ },
|
||||
\ ],
|
||||
\ 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'},
|
||||
\ ],
|
||||
\ },
|
||||
\ ],
|
||||
\})
|
||||
Reference in New Issue
Block a user