Skip to content

Commit

Permalink
Merge pull request #775 from JoeRobich/ensure-file-exists
Browse files Browse the repository at this point in the history
Check that file exists before considering it for formatting
  • Loading branch information
JoeRobich authored Sep 8, 2020
2 parents 742aa69 + f5adfe9 commit 965e7e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CodeFormatter.cs
Original file line number Diff line number Diff line change
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 @@ -187,7 +188,7 @@ private static async Task<Solution> RunCodeFormattersAsync(
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 965e7e5

Please sign in to comment.