Skip to content

olivier-martin-sf/lsp-codemirror

 
 

Repository files navigation

✨ lsp-codemirror

LSP client for CodeMirror, intends to be a more updated and better version of the original client --> https://github.com/wylieconlon/lsp-editor-adapter (thanks to Wylie :D )

🤔 Differences

  • Autocompletion improvements
  • Built-in icons
  • Support for custom autocompletion dropmenus

🤖 Installation

npm install lsp-codemirror

✍🏻 Usage

import CodeMirror from 'codemirror';
import { LspWsConnection, CodeMirrorAdapter } from 'lsp-codemirror';

const editor = CodeMirror(document.body,{})

const javascriptConnection = new LspWsConnection({
	serverUri: 'ws://localhost:2089/javascript',
	mode: 'javascript',
	rootUri: `file:///users/superman`,
	documentUri: `file:///users/superman/index.js`,
	documentText: () => editor.getValue(),
}).connect(new WebSocket('ws://localhost:2089/javascript'));

const javascriptAdapter = new CodeMirrorAdapter(javascriptConnection, {
	quickSuggestionsDelay: 25,
}, editor);

All options for CodeMirrorAdapter in: https://github.com/marc2332/lsp-codemirror/blob/aed38cc89e992b0b9aa7ee91cd298a4607a87b60/src/types.ts#L144

About

LSP integration for CodeMirror

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.0%
  • JavaScript 3.9%
  • CSS 1.2%
  • HTML 0.9%