{"id":13672819,"url":"https://github.com/wylieconlon/lsp-editor-adapter","last_synced_at":"2026-01-20T03:05:38.448Z","repository":{"id":41803500,"uuid":"157781375","full_name":"wylieconlon/lsp-editor-adapter","owner":"wylieconlon","description":"Connects language servers with the CodeMirror editor","archived":false,"fork":false,"pushed_at":"2023-01-04T18:24:55.000Z","size":589,"stargazers_count":119,"open_issues_count":55,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-18T04:57:45.209Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://codemirror-lsp.wylie.su","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wylieconlon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-15T22:37:08.000Z","updated_at":"2025-04-12T01:15:28.000Z","dependencies_parsed_at":"2023-02-02T19:46:45.628Z","dependency_job_id":null,"html_url":"https://github.com/wylieconlon/lsp-editor-adapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wylieconlon%2Flsp-editor-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wylieconlon%2Flsp-editor-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wylieconlon%2Flsp-editor-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wylieconlon%2Flsp-editor-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wylieconlon","download_url":"https://codeload.github.com/wylieconlon/lsp-editor-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251246394,"owners_count":21558762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:01:49.746Z","updated_at":"2026-01-20T03:05:33.431Z","avatar_url":"https://github.com/wylieconlon.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# lsp-editor-adapter (alpha)\n\nA library that automatically presents IDE-like elements for code editors in the browser using the the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/).\n\nCurrently, you can connect a [CodeMirror](https://codemirror.net/) document to a language server over WebSockets.\nFuture work will support language servers running in-browser, such as via Service Worker, and also support the\nAce editor.\n\n_This library is in development. Opening issues and pull requests is greatly appreciated!_\n\n## Features\n\nThe following features are all automatically configured once connected to a language server:\n\n* Intellisense autocomplete\n* Signature completion\n* Hover tooltips\n* Highlighting matching symbols in document\n* Linting or syntax errors\n* Within the same file: Go to Definition, Type Definition, and Find References\n\nAll other features of the language server are not currently supported, but if you would like to add support,\nplease submit a pull request!\n\n## Screenshots\n\nThese screenshots show the current state of the library:\n\nJavascript/Typescript:\n\n\u003cimg width=\"533\" alt=\"screenshot 2019-01-21 01 03 47\" src=\"https://user-images.githubusercontent.com/666475/51455610-6dcbbc80-1d18-11e9-8b8a-e7d757ca1440.png\"\u003e\n\nSwift:\n\n\u003cimg width=\"459\" alt=\"screenshot 2019-01-26 17 08 32\" src=\"https://user-images.githubusercontent.com/666475/51793344-0d5fd380-218d-11e9-99bc-0e06e1f51c89.png\"\u003e\n\u003cimg width=\"580\" alt=\"screenshot 2019-01-27 13 47 23\" src=\"https://user-images.githubusercontent.com/666475/51805363-4c982e00-223a-11e9-97be-876fd1b49371.png\"\u003e\n\u003cimg width=\"581\" alt=\"screenshot 2019-01-27 13 47 36\" src=\"https://user-images.githubusercontent.com/666475/51805364-4c982e00-223a-11e9-9e4e-cd7f9ca05ff9.png\"\u003e\n\u003cimg width=\"601\" alt=\"screenshot 2019-01-27 13 48 11\" src=\"https://user-images.githubusercontent.com/666475/51805365-4c982e00-223a-11e9-9856-996ccfa4c8bc.png\"\u003e\n\n\n## Installation\n\nCurrent requirements:\n\n* Language server running on a web socket connection, such as [jsonrpc-ws-proxy](https://github.com/wylieconlon/jsonrpc-ws-proxy) \n* CodeMirror editor with the `show-hint` addon included\n* Ability to import an ES6 module, which the library is packaged as\n\nExample installation and connection:\n\n``` javascript\nimport * as CodeMirror from 'codemirror';\n// You are required to install the show-hint addon\nimport 'codemirror/addon/hint/show-hint.css';\nimport 'codemirror/addon/hint/show-hint';\n\n// Each adapter can have its own CSS\nimport 'lsp-editor-adapter/lib/codemirror-lsp.css';\nimport { LspWsConnection, CodeMirrorAdapter } from 'lsp-editor-adapter';\n\nlet editor = CodeMirror(document.querySelector('.editor'), {\n  value: 'hello world',\n\n  // Optional: You can add a gutter for syntax error markers\n  gutters: ['CodeMirror-lsp']\n});\n\n// Take a look at how the example is configured for ideas\nlet connectionOptions = {\n  // Required: Web socket server for the given language server\n  serverUri: 'ws://localhost:8080/html',\n  // The following options are how the language server is configured, and are required\n  rootUri: 'file:///path/to/a/directory',\n  documentUri: 'file:///path/to/a/directory/file.html',\n  documentText: () =\u003e editor.getValue(),\n  languageId: 'html',\n};\n\n// The WebSocket is passed in to allow testability\nlet lspConnection = new LspWsConnection(editor)\n  .connect(new WebSocket('ws://localhost:8080'));\n\n// The adapter is what allows the editor to provide UI elements\nlet adapter = new CodeMirrorAdapter(lspConnection, {\n  // UI-related options go here, allowing you to control the automatic features of the LSP, i.e.\n  suggestOnTriggerCharacters: false\n}, editor);\n\n// You can also provide your own hooks:\nlspConnection.on('error', (e) =\u003e {\n  console.error(e)\n});\n\n// You might need to provide your own hooks to handle navigating to another file, for example:\nlspConnection.on('goTo', (locations) =\u003e {\n  // Do something to handle the URI in this object\n});\n\n// To clean up the adapter and connection:\nadapter.remove();\nlspConnection.close();\n```\n\n## Running the example\n\nA fully-functional example project which runs three language servers and allows editing all three files\nis available at /example\n\nTo run the example:\n\n```\ncd example\nnpm install\nnpm run start\n```\n\nthen visit localhost:4000\n\n## Developing\n\nTo develop against this library, and see updates in the example, run both of these:\n\n```\n# From parent directory\nnpx webpack --watch\n```\n\n```\n# From example directory\nnpm run dev\n```\n\nTo run library tests, there are two options:\n\n```\nnpm test\nnpm run test-dev\n```\n\ntest-dev will watch the source code and rerun tests in the background\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwylieconlon%2Flsp-editor-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwylieconlon%2Flsp-editor-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwylieconlon%2Flsp-editor-adapter/lists"}