Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Eliminate CursorOptions type; treat cursorOffset just like any other …
…option
  • Loading branch information
ExplodingCabbage committed Dec 5, 2023
commit 43c69445e92e319ab4614e83e534de743e569455
14 changes: 6 additions & 8 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ export interface RequiredOptions extends doc.printer.Options {
* @deprecated use bracketSameLine instead
*/
jsxBracketSameLine: boolean;
/**
* Specify where the cursor is.
* @default -1
*/
cursorOffset: number;
/**
* Format only a segment of a file.
* @default 0
Expand Down Expand Up @@ -543,13 +548,6 @@ export interface Printer<T = any> {
| undefined;
}

export interface CursorOptions extends Options {
/**
* Specify where the cursor is.
*/
cursorOffset: number;
}

export interface CursorResult {
formatted: string;
cursorOffset: number;
Expand All @@ -574,7 +572,7 @@ export function check(source: string, options?: Options): Promise<boolean>;
*/
export function formatWithCursor(
source: string,
options: CursorOptions,
options: Options,
): Promise<CursorResult>;

export interface ResolveConfigOptions {
Expand Down
4 changes: 2 additions & 2 deletions src/standalone.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CursorOptions, CursorResult, Options, SupportInfo } from "./index.js";
import { CursorResult, Options, SupportInfo } from "./index.js";

/**
* formatWithCursor both formats the code, and translates a cursor position from unformatted code to formatted code.
Expand All @@ -13,7 +13,7 @@ import { CursorOptions, CursorResult, Options, SupportInfo } from "./index.js";
*/
export function formatWithCursor(
source: string,
options: CursorOptions,
options: Options,
): Promise<CursorResult>;

/**
Expand Down