Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that file exists before considering it for formatting #775

Merged
merged 1 commit into from Sep 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/CodeFormatter.cs
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -197,7 +198,7 @@ private static Workspace OpenFolderWorkspace(string workspacePath, SourceFileMat
addedFilePaths.Add(document.FilePath);

var isFileIncluded = formatOptions.WorkspaceType == WorkspaceType.Folder ||
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documents in a folder workspace have already been verified to exist.

formatOptions.FileMatcher.Match(document.FilePath).HasMatches;
(formatOptions.FileMatcher.Match(document.FilePath).HasMatches && File.Exists(document.FilePath));
if (!isFileIncluded || !document.SupportsSyntaxTree)
{
continue;
Expand Down