npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lsp-editor-adapter

v0.0.10

Published

Make your CodeMirror editor smarter by connecting to a language server

Readme

lsp-editor-adapter (alpha)

A library that automatically presents IDE-like elements for code editors in the browser using the the Language Server Protocol.

Currently, you can connect a CodeMirror document to a language server over WebSockets. Future work will support language servers running in-browser, such as via Service Worker, and also support the Ace editor.

This library is in development. Opening issues and pull requests is greatly appreciated!

Features

The following features are all automatically configured once connected to a language server:

  • Intellisense autocomplete
  • Signature completion
  • Hover tooltips
  • Highlighting matching symbols in document
  • Linting or syntax errors
  • Within the same file: Go to Definition, Type Definition, and Find References

All other features of the language server are not currently supported, but if you would like to add support, please submit a pull request!

Screenshots

These screenshots show the current state of the library:

Javascript/Typescript:

Swift:

Installation

Current requirements:

  • Language server running on a web socket connection, such as jsonrpc-ws-proxy
  • CodeMirror editor with the show-hint addon included
  • Ability to import an ES6 module, which the library is packaged as

Example installation and connection:

import * as CodeMirror from 'codemirror';
// You are required to install the show-hint addon
import 'codemirror/addon/hint/show-hint.css';
import 'codemirror/addon/hint/show-hint';

// Each adapter can have its own CSS
import 'lsp-editor-adapter/lib/codemirror-lsp.css';
import { LspWsConnection, CodeMirrorAdapter } from 'lsp-editor-adapter';

let editor = CodeMirror(document.querySelector('.editor'), {
  value: 'hello world',

  // Optional: You can add a gutter for syntax error markers
  gutters: ['CodeMirror-lsp']
});

// Take a look at how the example is configured for ideas
let connectionOptions = {
  // Required: Web socket server for the given language server
  serverUri: 'ws://localhost:8080/html',
  // The following options are how the language server is configured, and are required
  rootUri: 'file:///path/to/a/directory',
  documentUri: 'file:///path/to/a/directory/file.html',
  documentText: () => editor.getValue(),
  languageId: 'html',
};

// The WebSocket is passed in to allow testability
let lspConnection = new LspWsConnection(editor)
  .connect(new WebSocket('ws://localhost:8080'));

// The adapter is what allows the editor to provide UI elements
let adapter = new CodeMirrorAdapter(lspConnection, {
  // UI-related options go here, allowing you to control the automatic features of the LSP, i.e.
  suggestOnTriggerCharacters: false
}, editor);

// You can also provide your own hooks:
lspConnection.on('error', (e) => {
  console.error(e)
});

// You might need to provide your own hooks to handle navigating to another file, for example:
lspConnection.on('goTo', (locations) => {
  // Do something to handle the URI in this object
});

// To clean up the adapter and connection:
adapter.remove();
lspConnection.close();

Running the example

A fully-functional example project which runs three language servers and allows editing all three files is available at /example

To run the example:

cd example
npm install
npm run start

then visit localhost:4000

Developing

To develop against this library, and see updates in the example, run both of these:

# From parent directory
npx webpack --watch
# From example directory
npm run dev

To run library tests, there are two options:

npm test
npm run test-dev

test-dev will watch the source code and rerun tests in the background