Compares two text editor positions for exact equality of line and character coordinates.
// Source: https://github.com/nerdy-tech-com-gitub/tabby | License: Apache-2.0 | Copyright 2024 TabbyML, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { Position, Range } from "vscode-languageserver";
import { TextDocument } from "vscode-languageserver-textdocument";
export function isPositionEqual(a: Position, b: Position): boolean {
return a.line === b.line && a.character === b.character;
}
export function isPositionBefore(a: Position, b: Position): boolean {
return a.line < b.line || (a.line === b.line && a.character < b.character);
}
export function isPositionAfter(a: Position, b: Position): boolean {
return a.line > b.line || (a.line === b.line && a.character > b.character);
}
export function isPositionBeforeOrEqual(a: Position, b: Position): boole
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key