aboutsummaryrefslogtreecommitdiff
path: root/test/send.py
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2019-12-25 09:23:25 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2019-12-25 09:23:25 +0900
commit3d04ccc3358d5b8ec59d665508b696d4787627d2 (patch)
treea00f8367d99faf9d8873fdd4ccf7d24b14a9b4c8 /test/send.py
parente4de2e6f2a146b9034fc0fa877c7765f4569f8c5 (diff)
parent008181bf9aedf976fdb725dcf9340e7f775d1fa8 (diff)
downloadvim-lsp-settings-3d04ccc3358d5b8ec59d665508b696d4787627d2.tar.gz
vim-lsp-settings-3d04ccc3358d5b8ec59d665508b696d4787627d2.tar.bz2
vim-lsp-settings-3d04ccc3358d5b8ec59d665508b696d4787627d2.zip
Merge branch 'master' into lsp-register-server
Diffstat (limited to 'test/send.py')
-rwxr-xr-xtest/send.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/send.py b/test/send.py
new file mode 100755
index 0000000..78b89aa
--- /dev/null
+++ b/test/send.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+import json
+import sys
+
+
+def send(message: dict):
+ raw = json.dumps(message)
+ message = "Content-Length: " + str(len(raw)) + "\r\n\r\n" + raw
+ sys.stdout.write(message)
+
+
+initialize = {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "method": "initialize",
+ "params": {"processId": None, "rootUri": None, "capabilities": {}},
+}
+send(initialize)
+
+initialized = {
+ "jsonrpc": "2.0",
+ "id": 2,
+ "method": "initialized",
+ "params": {},
+}
+send(initialized)
+
+shutdown = {
+ "jsonrpc": "2.0",
+ "id": 3,
+ "method": "shutdown",
+ "params": {},
+}
+send(shutdown)
+
+_exit = {
+ "jsonrpc": "2.0",
+ "id": 4,
+ "method": "exit",
+ "params": {},
+}
+send(_exit)