From 8a54aabdd2cc16e02d92103d300c50d7c689b112 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Fri, 12 Jul 2024 11:58:23 +0800 Subject: [PATCH] fix(yaml): add missing formatting provider --- packages/yaml/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/yaml/index.ts b/packages/yaml/index.ts index ad4b70a..607ecb3 100644 --- a/packages/yaml/index.ts +++ b/packages/yaml/index.ts @@ -59,6 +59,7 @@ export function create({ }, definitionProvider: true, diagnosticProvider: {}, + documentFormattingProvider: true, documentOnTypeFormattingProvider: { triggerCharacters: ['\n'] }, @@ -152,6 +153,12 @@ export function create({ }); }, + provideDocumentFormattingEdits(document) { + return worker(document, () => { + return ls.doFormat(document); + }); + }, + provideOnTypeFormattingEdits(document, position, key, options) { return worker(document, () => { return ls.doDocumentOnTypeFormatting(document, { ch: key, options, position, textDocument: document });