diff --git a/Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatter.cs b/Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatter.cs index ab36c6b9dd..e14fc0632b 100644 --- a/Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatter.cs +++ b/Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatter.cs @@ -59,10 +59,16 @@ string[] extraArgs protected abstract string[] GetToolCommandArgs(string documentFilePath, Range range, string[] extraArgs); protected virtual async Task RunToolAsync(string interpreterExePath, string documentFilePath, Range range, string[] extraArgs) { + var args = GetToolCommandArgs(documentFilePath, range, extraArgs); + + if (args == null) { + return ""; + } + var output = ProcessOutput.RunHiddenAndCapture( interpreterExePath, System.Text.Encoding.UTF8, - GetToolCommandArgs(documentFilePath, range, extraArgs) + args ); await output; diff --git a/Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatterBlack.cs b/Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatterBlack.cs index 00181ba2d4..ae5d1794a6 100644 --- a/Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatterBlack.cs +++ b/Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatterBlack.cs @@ -24,7 +24,8 @@ public PythonFormatterBlack() : base("black", false) { } protected override string[] GetToolCommandArgs(string documentFilePath, Range range, string[] extraArgs) { if (range != null) { - throw new PythonFormatterRangeNotSupportedException("Black does not support the Format Selection command."); + return null; + // throw new PythonFormatterRangeNotSupportedException("Black does not support the Format Selection command."); } return new[] { "-m", Package, "--diff", documentFilePath };