@singapore-editor/lsp-plugin
v0.2.18
Published
Language server diagnostics, completion, hover, and navigation for the Singapore editor.
Maintainers
Readme
@singapore-editor/lsp-plugin
Language server diagnostics, completion, hover, and navigation for the Singapore editor.
Part of Singapore. A code editor for the browser that keeps every version.
Install
npm install @singapore-editor/core @singapore-editor/lsp-pluginUsage
Run a language server that accepts LSP JSON-RPC over WebSocket at the example URL.
import { Editor } from '@singapore-editor/core/editor'
import { createLanguageServerPlugin } from '@singapore-editor/lsp-plugin'
const host = document.createElement('div')
host.style.height = '400px'
document.body.append(host)
const editor = new Editor(host, {
plugins: [
createLanguageServerPlugin({
webSocketRoute: 'ws://localhost:3001/lsp',
rootUri: 'file:///project',
}),
],
})
editor.openDocument({
documentId: '/project/main.ts',
text: 'const value: number = "one"\n',
languageId: 'typescript',
})API highlights
createLanguageServerPlugin()connects one server.createLanguageServerSetPlugin()assigns features to several servers.onApplyWorkspaceEditsends cross-file edits to your app.
In the Singapore family
@singapore-editor/core owns the editor view. Add this plugin to connect the view to a language server.
Singapore README · Documentation
License
MIT. License
