Skip to main content
Module

x/vscode_languageserver_textdocument/mod.ts>TextDocument

Language server protocol implementation for VSCode. This allows implementing language services in JS/TS running on Deno.
namespace TextDocument
import { TextDocument } from "https://deno.land/x/vscode_languageserver_textdocument@v0.1.0/mod.ts";

Functions

Creates a new text document.

Updates a TextDocument by modifing its content.

interface TextDocument
import { type TextDocument } from "https://deno.land/x/vscode_languageserver_textdocument@v0.1.0/mod.ts";

A simple text document. Not to be implemented. The document keeps the content as string.

Properties

readonly
uri: DocumentUri

The associated URI for this document. Most documents have the file-scheme, indicating that they represent files on disk. However, some documents may have other schemes indicating that they are not available on disk.

readonly
languageId: string

The identifier of the language associated with this document.

readonly
version: number

The version number of this document (it will increase after each change, including undo/redo).

readonly
lineCount: number

The number of lines in this document.

Methods

getText(range?: Range): string

Get the text of this document. A substring can be retrieved by providing a range.

positionAt(offset: number): Position

Converts a zero-based offset to a position.

offsetAt(position: Position): number

Converts the position to a zero-based offset. Invalid positions are adjusted as described in Position.line and Position.character.