Skip to content

Commit 60f6985

Browse files
authored
Merge pull request #5348 from retailcoder/next
Honor SCP killswitch setting
2 parents 2ab49f2 + b969ddc commit 60f6985

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Rubberduck.Core/AutoComplete/SelfClosingPairs/SelfClosingPairHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public SelfClosingPairHandler(ICodePaneHandler pane, SelfClosingPairCompletionSe
4040
public override bool Handle(AutoCompleteEventArgs e, AutoCompleteSettings settings, out CodeString result)
4141
{
4242
result = null;
43-
if (!_scpInputLookup.TryGetValue(e.Character, out var pair) && e.Character != '\b')
43+
if (!settings.SelfClosingPairs.IsEnabled || !_scpInputLookup.TryGetValue(e.Character, out var pair) && e.Character != '\b')
4444
{
4545
// not an interesting keypress.
4646
return false;

RubberduckTests/AutoComplete/SelfClosingPairHandlerTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ private bool Run(SelfClosingPairTestInfo info)
2020
return false;
2121
}
2222

23+
[Test]
24+
public void GivenDisabledSelfClosingPairs_BailsOut()
25+
{
26+
var input = '"';
27+
var original = "DoSomething |".ToCodeString();
28+
var info = new SelfClosingPairTestInfo(original, input);
29+
info.Settings.SelfClosingPairs.IsEnabled = false;
30+
31+
Assert.IsFalse(Run(info));
32+
Assert.IsNull(info.Result);
33+
}
34+
2335
[Test]
2436
public void GivenInvalidInput_ResultIsNull()
2537
{

0 commit comments

Comments
 (0)