mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-31 03:05:21 +00:00
32 lines
No EOL
869 B
TypeScript
32 lines
No EOL
869 B
TypeScript
import {
|
|
createConnection,
|
|
ProposedFeatures,
|
|
PublishDiagnosticsParams,
|
|
TextDocumentSyncKind,
|
|
} from 'vscode-languageserver/node';
|
|
import { OpticsBackend } from './optics_lsp';
|
|
|
|
// Create LSP connection
|
|
const connection = createConnection(ProposedFeatures.all);
|
|
|
|
const sendDiagnosticsCallback = (params: PublishDiagnosticsParams) =>
|
|
connection.sendDiagnostics(params);
|
|
const ls = new OpticsBackend(sendDiagnosticsCallback);
|
|
|
|
connection.onNotification((...args) => ls.onNotification(...args));
|
|
connection.onHover((params) => ls.onHover(params));
|
|
|
|
connection.onInitialize(() => {
|
|
return {
|
|
capabilities: {
|
|
textDocumentSync: {
|
|
openClose: true,
|
|
save: true,
|
|
change: TextDocumentSyncKind.Full,
|
|
},
|
|
hoverProvider: true,
|
|
},
|
|
};
|
|
});
|
|
|
|
connection.listen(); |