tower-lsp-web-demo/app/index.html
2022-05-29 15:43:56 -06:00

54 lines
1.4 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
.container {
box-sizing: border-box;
display: grid;
grid-template-rows: 2fr 4fr 1fr 2fr 4fr;
align-items: center;
width: 50vh;
height: 50vh;
margin-left: auto;
margin-right: auto;
margin-top: 25vh;
}
.container textarea {
width: 100%;
height: 100%;
resize: none;
}
</style>
<title>tower-lsp-wasm-example</title>
</head>
<body>
<pre>
<!-- NOTE: included for easy copy and pasting into stdin textarea -->
{"jsonrpc": "2.0", "method": "initialize", "params": { "capabilities": {}}, "id": 1}
{"jsonrpc": "2.0", "method": "shutdown", "id": 2}
{"jsonrpc": "2.0", "method": "exit"}
</pre>
<div class="container">
<h1>stdin</h1>
<textarea id="stdin" autocomplete="off" spellcheck="off" wrap="off"></textarea>
<button id="send-button">send</button>
<h1>stdout</h1>
<textarea id="stdout" autocomplete="off" spellcheck="off" wrap="off" readonly></textarea>
</div>
<script type="module">
import init, { serve } from "./dist/server.js"
import { LspStdin, LspStdout } from "./dist/index.js"
const stdin = new LspStdin(document.getElementById("stdin"), document.getElementById("send-button"));
const stdout = new LspStdout(document.getElementById("stdout"));
await init();
await serve(stdin, stdout);
</script>
</body>
</html>