From 0a06e4632fe6f11bc7895f7f1d65fcf4cd1a50bc Mon Sep 17 00:00:00 2001 From: Stefan VanBuren Date: Thu, 9 Apr 2026 11:55:21 -0400 Subject: [PATCH] Add LSP support for buf config files This will enable running `buf lsp` for the various buf configuration files. Currently targeting the v2 configuration files, which will probably be the ones we primarily add LSP features to. (Not all have LSP features yet, but I don't think it hurts anything to enable the LSP for those file types.) Related to bufbuild/buf#4438. Ref: https://buf.build/docs/configuration/v2/buf-policy-yaml/ --- src/state.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/state.ts b/src/state.ts index 5dd3fea..894e489 100644 --- a/src/state.ts +++ b/src/state.ts @@ -28,9 +28,15 @@ const bufFilename = os.platform() === "win32" ? "buf.exe" : "buf"; let serverOutputChannel: vscode.OutputChannel | undefined; /** - * A {@link vscode.DocumentSelector} for proto files. + * A {@link vscode.DocumentSelector} for proto and buf config files. */ -const protoDocumentSelector = [{ scheme: "file", language: "proto" }]; +const protoDocumentSelector = [ + { scheme: "file", language: "proto" }, + { scheme: "file", pattern: "**/buf.yaml" }, + { scheme: "file", pattern: "**/buf.gen.yaml" }, + { scheme: "file", pattern: "**/buf.policy.yaml" }, + { scheme: "file", pattern: "**/buf.lock" }, +]; /** * Minimum Buf version required to use LSP via `buf beta lsp`.