import { TextEdit } from "vscode-languageserver-protocol";
import { formatSource } from "../formatter.js";
export function handleFormatting(_params, doc, config) {
    const original = doc.getText();
    const formatted = formatSource(original, config);
    if (formatted === null || formatted === original)
        return [];
    return [
        TextEdit.replace({
            start: { line: 0, character: 0 },
            end: doc.positionAt(original.length),
        }, formatted),
    ];
}
