Last active
July 5, 2019 10:30
-
-
Save thomasfaingnaert/6006fe12473a2b452c35ffea3197d461 to your computer and use it in GitHub Desktop.
Control LSP server from Bash
This file contains hidden or 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 bash | |
send() | |
{ | |
local length=${#1} | |
printf "Content-Length: $length\r\n" >pipe | |
printf '\r\n' >pipe | |
printf ${1//\\/\\\\} >pipe | |
} | |
rm -rf pipe | |
mkfifo pipe | |
language-server <pipe & | |
exec 3>pipe | |
# initialize | |
send '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{...}}' | |
sleep 1 | |
# initialized | |
send '{"jsonrpc":"2.0","method":"initialized","params":{}}' | |
sleep 1 | |
# ... | |
exec 3>&- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment