summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Jungo <michaeljungo92@gmail.com>2017-11-11 19:28:24 +0100
committerw0rp <devw0rp@gmail.com>2017-11-12 10:56:53 +0000
commit5df6ce6bb82e6a042eff644d77c71537e375114a (patch)
treef8046b579a2882b25b3496bd108694dece8fdca5
parent39107a48b99607fdebd1708cfaf0f115768c4899 (diff)
downloadale-5df6ce6bb82e6a042eff644d77c71537e375114a.zip
Remove id from LSP notifications
-rw-r--r--autoload/ale/lsp.vim3
-rw-r--r--test/lsp/test_lsp_connections.vader28
2 files changed, 15 insertions, 16 deletions
diff --git a/autoload/ale/lsp.vim b/autoload/ale/lsp.vim
index b6c890c7..126d6c18 100644
--- a/autoload/ale/lsp.vim
+++ b/autoload/ale/lsp.vim
@@ -83,9 +83,8 @@ function! ale#lsp#CreateMessageData(message) abort
let l:is_notification = a:message[0]
let l:obj = {
- \ 'id': v:null,
- \ 'jsonrpc': '2.0',
\ 'method': a:message[1],
+ \ 'jsonrpc': '2.0',
\}
if !l:is_notification
diff --git a/test/lsp/test_lsp_connections.vader b/test/lsp/test_lsp_connections.vader
index 5549b1f7..8651d801 100644
--- a/test/lsp/test_lsp_connections.vader
+++ b/test/lsp/test_lsp_connections.vader
@@ -26,7 +26,7 @@ Execute(ale#lsp#CreateMessageData() should create an appropriate message):
\ [
\ 1,
\ "Content-Length: 79\r\n\r\n"
- \ . '{"id": 1, "jsonrpc": "2.0", "method": "someMethod", "params": {"foo": "barÜ"}}',
+ \ . '{"method": "someMethod", "jsonrpc": "2.0", "id": 1, "params": {"foo": "barÜ"}}',
\ ],
\ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}])
" Check again to ensure that we use the next ID.
@@ -34,7 +34,7 @@ Execute(ale#lsp#CreateMessageData() should create an appropriate message):
\ [
\ 2,
\ "Content-Length: 79\r\n\r\n"
- \ . '{"id": 2, "jsonrpc": "2.0", "method": "someMethod", "params": {"foo": "barÜ"}}',
+ \ . '{"method": "someMethod", "jsonrpc": "2.0", "id": 2, "params": {"foo": "barÜ"}}',
\ ],
\ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}])
else
@@ -42,14 +42,14 @@ Execute(ale#lsp#CreateMessageData() should create an appropriate message):
\ [
\ 1,
\ "Content-Length: 71\r\n\r\n"
- \ . '{"id":1,"jsonrpc":"2.0","method":"someMethod","params":{"foo":"barÜ"}}',
+ \ . '{"method":"someMethod","jsonrpc":"2.0","id":1,"params":{"foo":"barÜ"}}',
\ ],
\ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}])
AssertEqual
\ [
\ 2,
\ "Content-Length: 71\r\n\r\n"
- \ . '{"id":2,"jsonrpc":"2.0","method":"someMethod","params":{"foo":"barÜ"}}',
+ \ . '{"method":"someMethod","jsonrpc":"2.0","id":2,"params":{"foo":"barÜ"}}',
\ ],
\ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}])
endif
@@ -60,7 +60,7 @@ Execute(ale#lsp#CreateMessageData() should create messages without params):
\ [
\ 1,
\ "Content-Length: 56\r\n\r\n"
- \ . '{"id": 1, "jsonrpc": "2.0", "method": "someOtherMethod"}',
+ \ . '{"method": "someOtherMethod", "jsonrpc": "2.0", "id": 1}',
\ ],
\ ale#lsp#CreateMessageData([0, 'someOtherMethod'])
else
@@ -68,7 +68,7 @@ Execute(ale#lsp#CreateMessageData() should create messages without params):
\ [
\ 1,
\ "Content-Length: 51\r\n\r\n"
- \ . '{"id":1,"jsonrpc":"2.0","method":"someOtherMethod"}',
+ \ . '{"method":"someOtherMethod","jsonrpc":"2.0","id":1}',
\ ],
\ ale#lsp#CreateMessageData([0, 'someOtherMethod'])
endif
@@ -78,30 +78,30 @@ Execute(ale#lsp#CreateMessageData() should create notifications):
AssertEqual
\ [
\ 0,
- \ "Content-Length: 60\r\n\r\n"
- \ . '{"id": null, "jsonrpc": "2.0", "method": "someNotification"}',
+ \ "Content-Length: 48\r\n\r\n"
+ \ . '{"method": "someNotification", "jsonrpc": "2.0"}',
\ ],
\ ale#lsp#CreateMessageData([1, 'someNotification'])
AssertEqual
\ [
\ 0,
- \ "Content-Length: 86\r\n\r\n"
- \ . '{"id": null, "jsonrpc": "2.0", "method": "someNotification", "params": {"foo": "bar"}}',
+ \ "Content-Length: 74\r\n\r\n"
+ \ . '{"method": "someNotification", "jsonrpc": "2.0", "params": {"foo": "bar"}}',
\ ],
\ ale#lsp#CreateMessageData([1, 'someNotification', {'foo': 'bar'}])
else
AssertEqual
\ [
\ 0,
- \ "Content-Length: 55\r\n\r\n"
- \ . '{"id":null,"jsonrpc":"2.0","method":"someNotification"}',
+ \ "Content-Length: 45\r\n\r\n"
+ \ . '{"method":"someNotification","jsonrpc":"2.0"}',
\ ],
\ ale#lsp#CreateMessageData([1, 'someNotification'])
AssertEqual
\ [
\ 0,
- \ "Content-Length: 78\r\n\r\n"
- \ . '{"id":null,"jsonrpc":"2.0","method":"someNotification","params":{"foo":"bar"}}',
+ \ "Content-Length: 68\r\n\r\n"
+ \ . '{"method":"someNotification","jsonrpc":"2.0","params":{"foo":"bar"}}',
\ ],
\ ale#lsp#CreateMessageData([1, 'someNotification', {'foo': 'bar'}])
endif