Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 7dbeffa

Browse files
authored
fix unwanted spacing around equals in override completion (#161)
1 parent 1ca07f1 commit 7dbeffa

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/Analysis/Engine/Test/LanguageServerTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,16 @@ public async Task CompletionForOverride() {
443443
await AssertCompletion(s, u, new[] { "__init__" }, new[] { "def" }, new SourceLocation(3, 9), cmpKey: ci => ci.label);
444444
}
445445

446+
[TestMethod, Priority(0)]
447+
public async Task CompletionForOverrideArgs() {
448+
using (var s = await CreateServer()) {
449+
var u = await AddModule(s, "class A:\n def bar(arg=None): pass\n\nclass B(A):\n def b");
450+
451+
await AssertNoCompletion(s, u, new SourceLocation(2, 9));
452+
await AssertCompletion(s, u, new[] { "bar(arg=None):\r\n return super().bar()" }, new[] { "bar(arg = None):\r\n return super().bar()" }, new SourceLocation(5, 10));
453+
}
454+
}
455+
446456
[TestMethod, Priority(0)]
447457
public async Task CompletionInDecorator() {
448458
var s = await CreateServer();

src/LanguageServer/Impl/Implementation/CompletionAnalysis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ private static CompletionItemKind ToCompletionItemKind(PythonMemberType memberTy
876876

877877
private static string GetSafeParameterName(ParameterResult result, int index) {
878878
if (!string.IsNullOrEmpty(result.DefaultValue)) {
879-
return GetSafeArgumentName(result, index) + " = " + result.DefaultValue;
879+
return GetSafeArgumentName(result, index) + "=" + result.DefaultValue;
880880
}
881881
return GetSafeArgumentName(result, index);
882882
}

0 commit comments

Comments
 (0)