Created
December 11, 2020 20:36
-
-
Save tomsmeding/7151a79106127f1b3540319bfb071cc0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, time | |
use_fast = len(sys.argv) >= 2 and sys.argv[1] == "fast" | |
def print_lsp(msg): | |
print("Content-Length: {}\r\n\r\n{}".format(len(msg), msg), end="") | |
sys.stdout.flush() | |
print_lsp('{"method": "initialize", "jsonrpc": "2.0", "id": 1, "params": {"initializationOptions": {}, "rootUri": "file:///home/tom", "capabilities": {"workspace": {"workspaceFolders": false, "configuration": false, "symbol": {"dynamicRegistration": false}, "applyEdit": false, "didChangeConfiguration": {"dynamicRegistration": false}}, "textDocument": {"documentSymbol": {"dynamicRegistration": false, "hierarchicalDocumentSymbolSupport": false}, "references": {"dynamicRegistration": false}, "publishDiagnostics": {"relatedInformation": true}, "rename": {"dynamicRegistration": false}, "completion": {"completionItem": {"snippetSupport": false, "commitCharactersSupport": false, "preselectSupport": false, "deprecatedSupport": false, "documentationFormat": ["plaintext"]}, "contextSupport": false, "dynamicRegistration": false}, "synchronization": {"didSave": true, "willSaveWaitUntil": false, "willSave": false, "dynamicRegistration": false}, "codeAction": {"dynamicRegistration": false}, "typeDefinition": {"dynamicRegistration": false}, "hover": {"dynamicRegistration": false, "contentFormat": ["plaintext"]}, "definition": {"dynamicRegistration": false, "linkSupport": false}}}, "rootPath": "/home/tom", "processId": 91179}}') | |
time.sleep(2) | |
print_lsp('{"method": "initialized", "jsonrpc": "2.0", "params": {}}') | |
time.sleep(2) | |
print_lsp('{"method": "textDocument/didOpen", "jsonrpc": "2.0", "params": {"textDocument": {"uri": "file:///home/tom/a.hs", "version": 1, "languageId": "haskell", "text": "module Main where\\nmain = return ()\\n"}}}') | |
time.sleep(2) | |
print_lsp('{"method": "textDocument/didSave", "jsonrpc": "2.0", "params": {"textDocument": {"uri": "file:///home/tom/a.hs"}}}') | |
time.sleep(2) | |
print_lsp('{"method": "textDocument/didChange", "jsonrpc": "2.0", "params": {"contentChanges": [{"text": "module Main where\\n\\nmain = return ()\\n"}], "textDocument": {"uri": "file:///home/tom/a.hs", "version": 2}}}') | |
if not use_fast: | |
time.sleep(2) | |
print_lsp('{"method": "textDocument/didSave", "jsonrpc": "2.0", "params": {"textDocument": {"uri": "file:///home/tom/a.hs"}}}') | |
time.sleep(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment