Skip to content

Commit

Permalink
Merge pull request #7 from Haacked/fixes-6
Browse files Browse the repository at this point in the history
Remove encouragement from signature help
  • Loading branch information
haacked committed Jun 23, 2014
2 parents 6fc814d + ab56320 commit 6578f38
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ local.properties
.settings/
.loadpath

# Roslyn generated folders
*.sln.ide/

# External tool builders
.externalToolBuilders/

Expand Down
2 changes: 2 additions & 0 deletions EncouragePackage/EncourageIntellisenseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ void OnSaved(Document document)
var triggerPoint = point.Snapshot.CreateTrackingPoint(point.Position, PointTrackingMode.Positive);
if (!provider.SignatureHelpBroker.IsSignatureHelpActive(textView))
{
textView.Properties.AddProperty(EncourageSignatureHelpSource.SessionKey, null);
session = provider.SignatureHelpBroker.TriggerSignatureHelp(textView, triggerPoint, true);
textView.Properties.RemoveProperty(EncourageSignatureHelpSource.SessionKey);
}
}

Expand Down
12 changes: 12 additions & 0 deletions EncouragePackage/EncourageSignatureHelpSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ internal Signature(ITrackingSpan trackingSpan, string content, string prettyPrin
}
}

/// <summary>
/// This object needs to be added as a key to the property bag of an ITextView where
/// encouragement should be applied. This prevents encouragement from being
/// introduced in places like signature overload.
/// </summary>
internal static readonly object SessionKey = new object();

readonly ITextBuffer subjectBuffer;
readonly IEncouragements encouragements;

Expand All @@ -78,6 +85,11 @@ public void Dispose()

public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
{
if (!session.TextView.Properties.ContainsProperty(SessionKey))
{
return;
}

// Map the trigger point down to our buffer.
var subjectTriggerPoint = session.GetTriggerPoint(subjectBuffer.CurrentSnapshot);
if (!subjectTriggerPoint.HasValue)
Expand Down

0 comments on commit 6578f38

Please sign in to comment.