Skip to content

Commit 4a82328

Browse files
get rid of the error msg (#8158)
1 parent 9e5040e commit 4a82328

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatter.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,16 @@ string[] extraArgs
5959
protected abstract string[] GetToolCommandArgs(string documentFilePath, Range range, string[] extraArgs);
6060

6161
protected virtual async Task<string> RunToolAsync(string interpreterExePath, string documentFilePath, Range range, string[] extraArgs) {
62+
var args = GetToolCommandArgs(documentFilePath, range, extraArgs);
63+
64+
if (args == null) {
65+
return "";
66+
}
67+
6268
var output = ProcessOutput.RunHiddenAndCapture(
6369
interpreterExePath,
6470
System.Text.Encoding.UTF8,
65-
GetToolCommandArgs(documentFilePath, range, extraArgs)
71+
args
6672
);
6773

6874
await output;

Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatterBlack.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public PythonFormatterBlack() : base("black", false) { }
2424

2525
protected override string[] GetToolCommandArgs(string documentFilePath, Range range, string[] extraArgs) {
2626
if (range != null) {
27-
throw new PythonFormatterRangeNotSupportedException("Black does not support the Format Selection command.");
27+
return null;
28+
// throw new PythonFormatterRangeNotSupportedException("Black does not support the Format Selection command.");
2829
}
2930

3031
return new[] { "-m", Package, "--diff", documentFilePath };

0 commit comments

Comments
 (0)