From b928a2ac4d1651568e78f2a7e0144d789f6326f0 Mon Sep 17 00:00:00 2001 From: JohnnyMorganz Date: Sun, 17 Nov 2024 13:57:27 +0100 Subject: [PATCH] extension: fix stdin-filepath for non-file documents --- stylua-vscode/CHANGELOG.md | 4 ++++ stylua-vscode/src/extension.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/stylua-vscode/CHANGELOG.md b/stylua-vscode/CHANGELOG.md index 1118951b..d116c604 100644 --- a/stylua-vscode/CHANGELOG.md +++ b/stylua-vscode/CHANGELOG.md @@ -11,6 +11,10 @@ To view the changelog of the StyLua binary, see [here](https://github.com/Johnny ## [Unreleased] +### Fixed + +- Skip `--stdin-filepath` when handling non-file based text documents (e.g., untitled documents) + ## [1.7.0] - 2024-11-16 ### Changed diff --git a/stylua-vscode/src/extension.ts b/stylua-vscode/src/extension.ts index 8383175a..87bfeb0b 100644 --- a/stylua-vscode/src/extension.ts +++ b/stylua-vscode/src/extension.ts @@ -248,7 +248,7 @@ export async function activate(context: vscode.ExtensionContext) { outputChannel, styluaBinaryPath.path, text, - document.uri.fsPath, + document.uri.scheme === "file" ? document.uri.fsPath : undefined, cwd, byteOffset(document, range.start), byteOffset(document, range.end)