Skip to content

Commit

Permalink
Merge pull request #149 from jackfrey13/ads-untitle-file-error-fix
Browse files Browse the repository at this point in the history
Prevent "Specified path does not exist" error for empty untitled files
  • Loading branch information
RobertOstermann authored Jul 19, 2024
2 parents d8d4f22 + 774d6be commit c06d99d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/features/providers/formatter/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down
4 changes: 4 additions & 0 deletions src/features/providers/linter/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down

0 comments on commit c06d99d

Please sign in to comment.