Skip to content

Commit

Permalink
Merge pull request #5348 from retailcoder/next
Browse files Browse the repository at this point in the history
Honor SCP killswitch setting
  • Loading branch information
retailcoder authored Jan 12, 2020
2 parents 2ab49f2 + b969ddc commit 60f6985
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public SelfClosingPairHandler(ICodePaneHandler pane, SelfClosingPairCompletionSe
public override bool Handle(AutoCompleteEventArgs e, AutoCompleteSettings settings, out CodeString result)
{
result = null;
if (!_scpInputLookup.TryGetValue(e.Character, out var pair) && e.Character != '\b')
if (!settings.SelfClosingPairs.IsEnabled || !_scpInputLookup.TryGetValue(e.Character, out var pair) && e.Character != '\b')
{
// not an interesting keypress.
return false;
Expand Down
12 changes: 12 additions & 0 deletions RubberduckTests/AutoComplete/SelfClosingPairHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ private bool Run(SelfClosingPairTestInfo info)
return false;
}

[Test]
public void GivenDisabledSelfClosingPairs_BailsOut()
{
var input = '"';
var original = "DoSomething |".ToCodeString();
var info = new SelfClosingPairTestInfo(original, input);
info.Settings.SelfClosingPairs.IsEnabled = false;

Assert.IsFalse(Run(info));
Assert.IsNull(info.Result);
}

[Test]
public void GivenInvalidInput_ResultIsNull()
{
Expand Down

0 comments on commit 60f6985

Please sign in to comment.