Skip to content

Commit

Permalink
Check that file exists before considering it for formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Aug 26, 2020
1 parent 971dcca commit f5adfe9
Showing 1 changed file with 2 additions and 1 deletion.
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 ||
formatOptions.FileMatcher.Match(document.FilePath).HasMatches;
(formatOptions.FileMatcher.Match(document.FilePath).HasMatches && File.Exists(document.FilePath));
if (!isFileIncluded || !document.SupportsSyntaxTree)
{
continue;
Expand Down

0 comments on commit f5adfe9

Please sign in to comment.