Skip to main content
Go to Latest
class LineContext
Re-export
import { LineContext } from "https://deno.land/x/denops_lsputil@v0.9.2/mod.ts";

Context of the line where the cursor is. If in cmdline mode, it is obtained from the command line.

0-based and columns are utf-16 offset.

import { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts";
import { LineContext } from "./context.ts"

export async function main(denops: Denops): Promise<void> {
  const ctx = await LineContext.create(denops);
  // String before the cursor
  const beforeLine = ctx.text.slice(0, ctx.character);
  // String after the cursor
  const afterLine = ctx.text.slice(ctx.character);
}

Constructors

new
LineContext(
character: number,
text: string,
mode?: string,
)

Properties

character: number
mode: string
text: string