Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/std/prettier/vendor/index.d.ts>formatWithCursor

A modern runtime for JavaScript and TypeScript.
Go to Latest
function formatWithCursor
import { formatWithCursor } from "https://deno.land/x/deno@v0.22.0/std/prettier/vendor/index.d.ts";

formatWithCursor both formats the code, and translates a cursor position from unformatted code to formatted code. This is useful for editor integrations, to prevent the cursor from moving when code is formatted.

The cursorOffset option should be provided, to specify where the cursor is. This option cannot be used with rangeStart and rangeEnd.

Parameters

source: string
options: CursorOptions