Skip to main content

latest
Works with
JSR Score
82%
Published
a month ago (3.0.0)

lsp_stream

It provides Decoder/Encoder of Base Protocol of Language Server Protocol

import { LspEncoderStream } from "./lsp_stream.ts";
import { JsonStringifyStream } from "jsr:/@std/json@0.222.1";

const stream = new JsonStringifyStream();
const writer = stream.writable.getWriter();
stream.readable
  .pipeThrough(new LspEncoderStream())
  .pipeTo(Deno.stdout.writable);
await writer.write({ foo: "bar" });
await writer.write({ baz: 100 });
import { LspDecoderStream } from "./lsp_stream.ts";

const stream = Deno.stdin.readable
  .pipeThrough(new LspDecoderStream());
const reader = stream.getReader();
const result = await reader.read();
if (!result.done) {
  const msg = JSON.parse(result.value);
}

License

NYSL

Add Package

deno add @kuuote/lsp-stream

Import symbol

import * as mod from "@kuuote/lsp-stream";

Add Package

npx jsr add @kuuote/lsp-stream

Import symbol

import * as mod from "@kuuote/lsp-stream";

Add Package

yarn dlx jsr add @kuuote/lsp-stream

Import symbol

import * as mod from "@kuuote/lsp-stream";

Add Package

pnpm dlx jsr add @kuuote/lsp-stream

Import symbol

import * as mod from "@kuuote/lsp-stream";

Add Package

bunx jsr add @kuuote/lsp-stream

Import symbol

import * as mod from "@kuuote/lsp-stream";