Remove id from LSP notifications
This commit is contained in:
parent
39107a48b9
commit
5df6ce6bb8
2 changed files with 15 additions and 16 deletions
|
@ -83,9 +83,8 @@ function! ale#lsp#CreateMessageData(message) abort
|
||||||
let l:is_notification = a:message[0]
|
let l:is_notification = a:message[0]
|
||||||
|
|
||||||
let l:obj = {
|
let l:obj = {
|
||||||
\ 'id': v:null,
|
|
||||||
\ 'jsonrpc': '2.0',
|
|
||||||
\ 'method': a:message[1],
|
\ 'method': a:message[1],
|
||||||
|
\ 'jsonrpc': '2.0',
|
||||||
\}
|
\}
|
||||||
|
|
||||||
if !l:is_notification
|
if !l:is_notification
|
||||||
|
|
|
@ -26,7 +26,7 @@ Execute(ale#lsp#CreateMessageData() should create an appropriate message):
|
||||||
\ [
|
\ [
|
||||||
\ 1,
|
\ 1,
|
||||||
\ "Content-Length: 79\r\n\r\n"
|
\ "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Ü'}])
|
\ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}])
|
||||||
" Check again to ensure that we use the next ID.
|
" Check again to ensure that we use the next ID.
|
||||||
|
@ -34,7 +34,7 @@ Execute(ale#lsp#CreateMessageData() should create an appropriate message):
|
||||||
\ [
|
\ [
|
||||||
\ 2,
|
\ 2,
|
||||||
\ "Content-Length: 79\r\n\r\n"
|
\ "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Ü'}])
|
\ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}])
|
||||||
else
|
else
|
||||||
|
@ -42,14 +42,14 @@ Execute(ale#lsp#CreateMessageData() should create an appropriate message):
|
||||||
\ [
|
\ [
|
||||||
\ 1,
|
\ 1,
|
||||||
\ "Content-Length: 71\r\n\r\n"
|
\ "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Ü'}])
|
\ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}])
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ 2,
|
\ 2,
|
||||||
\ "Content-Length: 71\r\n\r\n"
|
\ "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Ü'}])
|
\ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}])
|
||||||
endif
|
endif
|
||||||
|
@ -60,7 +60,7 @@ Execute(ale#lsp#CreateMessageData() should create messages without params):
|
||||||
\ [
|
\ [
|
||||||
\ 1,
|
\ 1,
|
||||||
\ "Content-Length: 56\r\n\r\n"
|
\ "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'])
|
\ ale#lsp#CreateMessageData([0, 'someOtherMethod'])
|
||||||
else
|
else
|
||||||
|
@ -68,7 +68,7 @@ Execute(ale#lsp#CreateMessageData() should create messages without params):
|
||||||
\ [
|
\ [
|
||||||
\ 1,
|
\ 1,
|
||||||
\ "Content-Length: 51\r\n\r\n"
|
\ "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'])
|
\ ale#lsp#CreateMessageData([0, 'someOtherMethod'])
|
||||||
endif
|
endif
|
||||||
|
@ -78,30 +78,30 @@ Execute(ale#lsp#CreateMessageData() should create notifications):
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ 0,
|
\ 0,
|
||||||
\ "Content-Length: 60\r\n\r\n"
|
\ "Content-Length: 48\r\n\r\n"
|
||||||
\ . '{"id": null, "jsonrpc": "2.0", "method": "someNotification"}',
|
\ . '{"method": "someNotification", "jsonrpc": "2.0"}',
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#lsp#CreateMessageData([1, 'someNotification'])
|
\ ale#lsp#CreateMessageData([1, 'someNotification'])
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ 0,
|
\ 0,
|
||||||
\ "Content-Length: 86\r\n\r\n"
|
\ "Content-Length: 74\r\n\r\n"
|
||||||
\ . '{"id": null, "jsonrpc": "2.0", "method": "someNotification", "params": {"foo": "bar"}}',
|
\ . '{"method": "someNotification", "jsonrpc": "2.0", "params": {"foo": "bar"}}',
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#lsp#CreateMessageData([1, 'someNotification', {'foo': 'bar'}])
|
\ ale#lsp#CreateMessageData([1, 'someNotification', {'foo': 'bar'}])
|
||||||
else
|
else
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ 0,
|
\ 0,
|
||||||
\ "Content-Length: 55\r\n\r\n"
|
\ "Content-Length: 45\r\n\r\n"
|
||||||
\ . '{"id":null,"jsonrpc":"2.0","method":"someNotification"}',
|
\ . '{"method":"someNotification","jsonrpc":"2.0"}',
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#lsp#CreateMessageData([1, 'someNotification'])
|
\ ale#lsp#CreateMessageData([1, 'someNotification'])
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ 0,
|
\ 0,
|
||||||
\ "Content-Length: 78\r\n\r\n"
|
\ "Content-Length: 68\r\n\r\n"
|
||||||
\ . '{"id":null,"jsonrpc":"2.0","method":"someNotification","params":{"foo":"bar"}}',
|
\ . '{"method":"someNotification","jsonrpc":"2.0","params":{"foo":"bar"}}',
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#lsp#CreateMessageData([1, 'someNotification', {'foo': 'bar'}])
|
\ ale#lsp#CreateMessageData([1, 'someNotification', {'foo': 'bar'}])
|
||||||
endif
|
endif
|
||||||
|
|
Reference in a new issue