summaryrefslogtreecommitdiff
path: root/test/lsp/test_other_initialize_message_handling.vader
diff options
context:
space:
mode:
authorBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
committerBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
commitd2b0ae8108b2ee395d4eb43c49d68b322a023a30 (patch)
treebb8145e69bf1bcb8968b29cb1a68c47ceb83674d /test/lsp/test_other_initialize_message_handling.vader
parentef641dda80f45cb979bc93c2513c6e10cbd8e42a (diff)
parent0a384a49d371838903d8401c5358ec60f3f4266d (diff)
downloadale-d2b0ae8108b2ee395d4eb43c49d68b322a023a30.zip
Merge branch 'master' into sridhars
Diffstat (limited to 'test/lsp/test_other_initialize_message_handling.vader')
-rw-r--r--test/lsp/test_other_initialize_message_handling.vader132
1 files changed, 43 insertions, 89 deletions
diff --git a/test/lsp/test_other_initialize_message_handling.vader b/test/lsp/test_other_initialize_message_handling.vader
index 45457979..2f59535d 100644
--- a/test/lsp/test_other_initialize_message_handling.vader
+++ b/test/lsp/test_other_initialize_message_handling.vader
@@ -1,83 +1,47 @@
Before:
- let b:project = {
+ let b:conn = {
+ \ 'is_tsserver': 0,
+ \ 'data': '',
+ \ 'root': '/foo/bar',
+ \ 'open_documents': {},
\ 'initialized': 0,
- \ 'init_request_id': 3,
+ \ 'init_request_id': 0,
+ \ 'init_options': {},
+ \ 'config': {},
+ \ 'callback_list': [],
\ 'message_queue': [],
\ 'capabilities_queue': [],
- \}
-
- let b:conn = {
- \ 'projects': {
- \ '/foo/bar': b:project,
- \ },
\ 'capabilities': {
\ 'hover': 0,
\ 'references': 0,
\ 'completion': 0,
\ 'completion_trigger_characters': [],
\ 'definition': 0,
+ \ 'symbol_search': 0,
\ },
\}
After:
- unlet! b:project
unlet! b:conn
-Execute(publishDiagnostics messages with files inside project directories should initialize projects):
- " This is for some other file, ignore this one.
- call ale#lsp#HandleOtherInitializeResponses(b:conn, {
- \ 'method': 'textDocument/publishDiagnostics',
- \ 'params': {'uri': 'file:///xyz/bar/baz.txt'},
- \})
-
- AssertEqual
- \ {
- \ 'initialized': 0,
- \ 'init_request_id': 3,
- \ 'message_queue': [],
- \ 'capabilities_queue': [],
- \ },
- \ b:project
-
- call ale#lsp#HandleOtherInitializeResponses(b:conn, {
- \ 'method': 'textDocument/publishDiagnostics',
- \ 'params': {'uri': 'file:///foo/bar/baz.txt'},
- \})
-
- AssertEqual
- \ {
- \ 'initialized': 1,
- \ 'init_request_id': 3,
- \ 'message_queue': [],
- \ 'capabilities_queue': [],
- \ },
- \ b:project
-
Execute(Messages with no method and capabilities should initialize projects):
- call ale#lsp#HandleOtherInitializeResponses(b:conn, {
+ call ale#lsp#HandleInitResponse(b:conn, {
\ 'result': {'capabilities': {}},
\})
- AssertEqual
- \ {
- \ 'initialized': 1,
- \ 'init_request_id': 3,
- \ 'message_queue': [],
- \ 'capabilities_queue': [],
- \ },
- \ b:project
+ AssertEqual 1, b:conn.initialized
Execute(Other messages should not initialize projects):
- call ale#lsp#HandleOtherInitializeResponses(b:conn, {'method': 'lolwat'})
+ call ale#lsp#HandleInitResponse(b:conn, {'method': 'lolwat'})
- AssertEqual 0, b:project.initialized
+ AssertEqual 0, b:conn.initialized
- call ale#lsp#HandleOtherInitializeResponses(b:conn, {'result': {'x': {}}})
+ call ale#lsp#HandleInitResponse(b:conn, {'result': {'x': {}}})
- AssertEqual 0, b:project.initialized
+ AssertEqual 0, b:conn.initialized
Execute(Capabilities should bet set up correctly):
- call ale#lsp#HandleOtherInitializeResponses(b:conn, {
+ call ale#lsp#HandleInitResponse(b:conn, {
\ 'jsonrpc': '2.0',
\ 'id': 1,
\ 'result': {
@@ -105,34 +69,26 @@ Execute(Capabilities should bet set up correctly):
\ },
\ 'definitionProvider': v:true,
\ 'experimental': {},
- \ 'documentHighlightProvider': v:true
+ \ 'documentHighlightProvider': v:true,
+ \ 'workspaceSymbolProvider': v:true
\ },
\ },
\})
+ AssertEqual 1, b:conn.initialized
AssertEqual
\ {
- \ 'capabilities': {
- \ 'completion_trigger_characters': ['.'],
- \ 'completion': 1,
- \ 'references': 1,
- \ 'hover': 1,
- \ 'definition': 1,
- \ },
- \ 'message_queue': [],
- \ 'projects': {
- \ '/foo/bar': {
- \ 'initialized': 1,
- \ 'message_queue': [],
- \ 'capabilities_queue': [],
- \ 'init_request_id': 3,
- \ },
- \ },
+ \ 'completion_trigger_characters': ['.'],
+ \ 'completion': 1,
+ \ 'references': 1,
+ \ 'hover': 1,
+ \ 'definition': 1,
+ \ 'symbol_search': 1,
\ },
- \ b:conn
+ \ b:conn.capabilities
Execute(Disabled capabilities should be recognised correctly):
- call ale#lsp#HandleOtherInitializeResponses(b:conn, {
+ call ale#lsp#HandleInitResponse(b:conn, {
\ 'jsonrpc': '2.0',
\ 'id': 1,
\ 'result': {
@@ -161,23 +117,21 @@ Execute(Disabled capabilities should be recognised correctly):
\ },
\})
+ AssertEqual 1, b:conn.initialized
AssertEqual
\ {
- \ 'capabilities': {
- \ 'completion_trigger_characters': [],
- \ 'completion': 0,
- \ 'references': 0,
- \ 'hover': 0,
- \ 'definition': 0,
- \ },
- \ 'message_queue': [],
- \ 'projects': {
- \ '/foo/bar': {
- \ 'initialized': 1,
- \ 'message_queue': [],
- \ 'capabilities_queue': [],
- \ 'init_request_id': 3,
- \ },
- \ },
+ \ 'completion_trigger_characters': [],
+ \ 'completion': 0,
+ \ 'references': 0,
+ \ 'hover': 0,
+ \ 'definition': 0,
+ \ 'symbol_search': 0,
\ },
- \ b:conn
+ \ b:conn.capabilities
+
+Execute(Results that are not dictionaries should be handled correctly):
+ call ale#lsp#HandleInitResponse(b:conn, {
+ \ 'jsonrpc': '2.0',
+ \ 'id': 1,
+ \ 'result': v:null,
+ \})