https://github.com/furqansoftware/codemirror-languageserver
Language Server integration for CodeMirror 6
https://github.com/furqansoftware/codemirror-languageserver
codemirror codemirror-6 language-server-protocol lsp lsp-client
Last synced: 6 days ago
JSON representation
Language Server integration for CodeMirror 6
- Host: GitHub
- URL: https://github.com/furqansoftware/codemirror-languageserver
- Owner: FurqanSoftware
- License: bsd-3-clause
- Created: 2021-02-26T16:36:53.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-11T05:13:59.000Z (3 months ago)
- Last Synced: 2025-05-12T09:28:10.491Z (9 days ago)
- Topics: codemirror, codemirror-6, language-server-protocol, lsp, lsp-client
- Language: TypeScript
- Homepage:
- Size: 227 KB
- Stars: 223
- Watchers: 6
- Forks: 30
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Language Server Plugin for CodeMirror 6
[](https://www.npmjs.com/package/codemirror-languageserver)
This plugin enables code completion, hover tooltips, and linter functionality by connecting a CodeMirror 6 editor with a language server over WebSocket.
[How It Works](https://hjr265.me/blog/codemirror-lsp/)
## Usage
```
npm i codemirror-languageserver
`````` js
import { languageServer } from 'codemirror-languageserver';const transport = new WebSocketTransport(serverUri)
var ls = languageServer({
// WebSocket server uri and other client options.
serverUri,
rootUri: 'file:///',// Alternatively, to share the same client across multiple instances of this plugin.
client: new LanguageServerClient({
serverUri,
rootUri: 'file:///'
}),documentUri: `file:///${filename}`,
languageId: 'cpp' // As defined at https://microsoft.github.io/language-server-protocol/specification#textDocumentItem.
});var view = new EditorView({
state: EditorState.create({
extensions: [
// ...
ls,
// ...
]
})
});
```## Contributing
Contributions are welcome.
## Real World Uses
https://user-images.githubusercontent.com/348107/120141150-c6bb9180-c1fd-11eb-8ada-9b7b7a1e4ade.mp4
- [Toph](https://toph.co): Competitive programming platform. Toph uses Language Server Plugin for CodeMirror 6 with its integrated code editor.
## License
The library is available under the BSD (3-Clause) License.