Socket
Book a DemoInstallSign in
Socket

@gdquest/codemirror-lsp

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gdquest/codemirror-lsp

Enables Codemirror to interact with a local lsp, ie. a LSP that isn't socket-based, but rather work by function calls.

latest
npmnpm
Version
0.1.2
Version published
Maintainers
4
Created
Source

@gdquest/codemirror-lsp

lsp extension

Purpose

This extension enables Codemirror interact with a local lsp, ie. a LSP that isn't socket-based, but rather work by function calls.

Usage

import { basicSetup } from "codemirror";
import { EditorView } from "@codemirror/view";
import {
  createLsp,
  type LspConfigData,
  type ServerResponseCallback,
} from "@gdquest/codemirror-lsp";

// Call this function when the server needs to communicate with the LSP
let emitServerCommand: ServerResponseCallback | null = null;

function onClientCommand(jsonRpc: string) {
  // This function is called when codemirror (the client) needs to communicate with the server
}

new EditorView({
  extensions: [
    basicSetup,
    createLsp({
      autocompletion: true,
      onClientCommand,
      getData: (data: LspConfigData) => {
        emitServerCommand = data.emitServerCommand;
      },
    }),
  ],
});

Keywords

gdquest

FAQs

Package last updated on 27 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.