From 9bdd8890e64d38b5d06b7790342e178a6c052794 Mon Sep 17 00:00:00 2001 From: Jack Frey Date: Thu, 18 Jul 2024 16:50:58 -0400 Subject: [PATCH 1/2] fix: Prevent "Specified path does not exist" error for empty untitled files --- src/features/providers/linter/lint.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/features/providers/linter/lint.ts b/src/features/providers/linter/lint.ts index cd83c51..5f60ace 100644 --- a/src/features/providers/linter/lint.ts +++ b/src/features/providers/linter/lint.ts @@ -141,6 +141,10 @@ export default class LintingProvider { return; } + if (document && document.isUntitled && document.getText() === "") { + return; + } + const args: string[] = [...Configuration.lintFileArguments()]; const options: CommandOptions = { filePath: filePath }; From 774d6be94ed50016bc92b0b479116fc7944fcac5 Mon Sep 17 00:00:00 2001 From: Jack Frey Date: Thu, 18 Jul 2024 20:44:09 -0400 Subject: [PATCH 2/2] fix: Add similar fix to prevent error when formatting --- src/features/providers/formatter/format.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/features/providers/formatter/format.ts b/src/features/providers/formatter/format.ts index 734150a..8a88daa 100644 --- a/src/features/providers/formatter/format.ts +++ b/src/features/providers/formatter/format.ts @@ -26,6 +26,10 @@ export class FormattingProvider implements vscode.DocumentFormattingEditProvider return []; } + if (document && document.isUntitled && document.getText() === "") { + return []; + } + Utilities.appendHyphenatedLine(); Utilities.outputChannel.appendLine(`Format triggered for ${filePath}`);