diff --git a/autoload/ale/lsp.vim b/autoload/ale/lsp.vim index b6c890c..126d6c1 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 5549b1f..8651d80 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