41 lines
No EOL
1.3 KiB
HTML
41 lines
No EOL
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en-US">
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="viewport" content="width=device-width,height=device-height" />
|
|
<title>BaseX LSP</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<div>something<button onclick="foo()">send</button><a href="/dba/logs" target="_blank">dba</a></div>
|
|
<div id="editor" style="height: 100px">some text</div>
|
|
<script type="module">
|
|
import * as ace from "https://www.unpkg.com/ace-code@latest/src-noconflict/ace.js";
|
|
import { Mode as JSONMode } from "ace-code/src/mode/json"; //any mode you want
|
|
import { AceLanguageClient } from "ace-linters/build/ace-language-client";
|
|
|
|
// Create a web socket
|
|
const serverData = {
|
|
module: () => import("ace-linters/build/language-client"),
|
|
modes: "json|json5",
|
|
type: "socket",
|
|
socket: new WebSocket("ws://127.0.0.1:3000/exampleServer"), // address of your websocket server
|
|
}
|
|
// Create an Ace editor
|
|
let editor = ace.edit("container", {
|
|
mode: new JSONMode() // Set the mode of the editor to JSON
|
|
});
|
|
|
|
// Create a language provider for web socket
|
|
let languageProvider = AceLanguageClient.for(serverData);
|
|
|
|
// Register the editor with the language provider
|
|
languageProvider.registerEditor(editor);
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
</html> |