import type { Diagnostic as CompilerDiagnostic } from "@marko/compiler/babel-utils"; import { type InitializeParams } from "vscode-languageserver"; import type { Plugin } from "../types"; interface FixCandidate { title: string; /** Value handed to the compiler `applyFixes` map for this fix. */ value: unknown; isPreferred: boolean; } /** Code action kind for the batched "fix all" source action. */ export declare const SOURCE_FIX_ALL_KIND = "source.fixAll.marko"; /** Code action kinds this plugin produces, advertised to the client. */ export declare const markoCodeActionKinds: string[]; export declare function initialize(params: InitializeParams): void; /** * Surfaces the Marko compiler's diagnostic `fix`es (in place AST edits suggested * by compiler plugins) as in editor code actions: a quick fix per fixable * diagnostic in range, plus a batched "fix all" source action. * * A fix mutates the AST during compilation, so it can't be serialized into a * text edit directly. Instead we re-run the compiler asking it to apply the * relevant fix(es) -- via the `applyFixes` config keyed by diagnostic index -- * reprint the result in `migrate` mode, format it with prettier, and diff it * against the original document to produce a minimal text edit. * * A fix is either an automatic function fix or an interactive `confirm`/`select` * prompt; see `getFixCandidates` and `collectBatchFixes` for how each is * surfaced. */ export declare const doCodeActions: Plugin["doCodeActions"]; /** * Resolves a deferred fix (or fix-all) action by re-running the compiler to * apply the fix(es) and attaching the resulting text edit. */ export declare const doCodeActionResolve: NonNullable; /** * Maps a diagnostic's fix to the quick fix action(s) to offer for it. * * The compiler's diagnostics API models a `fix` as one of three things: * - `true`: an automatic function fix (applied by the compiler in `migrate` * output without asking) -> a single, preferred quick fix. * - a `confirm` prompt (a yes/no decision) -> a single quick fix whose * invocation answers "yes" (`apply(true)`). * - a `select` prompt (pick one of N options) -> one quick fix per option * (`apply(option.value)`). * * `confirm`/`select` are interactive prompts, so they are never marked preferred * -- the user must consciously choose, rather than have "Auto Fix" answer for * them -- and they are excluded from the batched "fix all". */ export declare function getFixCandidates(diag: CompilerDiagnostic): FixCandidate[]; /** * Builds the `applyFixes` map for a batched "fix all" from the diagnostics whose * fix is applied automatically -- function fixes (`fix === true`), the same set * the compiler applies in `migrate` output without prompting. * * `confirm`/`select` fixes are interactive prompts: the compiler only applies * them when given an explicit answer (with no answer their `apply` is a no-op), * so they're deliberately excluded here and instead offered as individual quick * fixes where the user makes the choice. */ export declare function collectBatchFixes(diagnostics: CompilerDiagnostic[]): Map; export {};