Skip to content

Commit

Permalink
+ Covers more parameter situations in Super Quick Info
Browse files Browse the repository at this point in the history
  • Loading branch information
wmjordan committed Feb 6, 2018
1 parent 46a1587 commit a439ddf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Codist/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.0.0")]
[assembly: AssemblyFileVersion("2.4.2.435")]
[assembly: AssemblyFileVersion("2.4.2.439")]
23 changes: 15 additions & 8 deletions Codist/Views/CSharpTooltip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Codist.Views
{
sealed class CSharpQuickInfoSource : IQuickInfoSource
{
static Brush _InterfaceBrush, _ClassBrush, _StructBrush, _TextBrush, _NumberBrush, _EnumBrush, _KeywordBrush, _MethodBrush, _ParameterBrush;
static Brush _InterfaceBrush, _ClassBrush, _StructBrush, _TextBrush, _NumberBrush, _EnumBrush, _KeywordBrush, _MethodBrush, _DelegateBrush, _ParameterBrush;
readonly IEditorFormatMapService _FormatMapService;
IEditorFormatMap _FormatMap;

Expand Down Expand Up @@ -67,7 +67,7 @@ public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiC
//look for occurrences of our QuickInfo words in the span
var navigator = _QuickInfoSourceProvider.NavigatorService.GetTextStructureNavigator(_TextBuffer);
var extent = navigator.GetSpanOfEnclosing(new SnapshotSpan(subjectTriggerPoint.Value, 0));
var node = unitCompilation.FindNode(new Microsoft.CodeAnalysis.Text.TextSpan(extent.Span.Start, extent.Span.Length), false, true);
var node = unitCompilation.FindNode(new Microsoft.CodeAnalysis.Text.TextSpan(extent.Span.Start, extent.Span.Length), true, true);
if (node == null || node.Span.Contains(subjectTriggerPoint.Value.Position) == false) {
goto EXIT;
}
Expand All @@ -86,17 +86,15 @@ public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiC
infoBox = new TextBlock { Text = (node as SwitchStatementSyntax).Sections.Count + " sections" };
}
else if (nodeKind == SyntaxKind.StringLiteralExpression) {
infoBox = ShowStringInfo(node.ToString());
infoBox = ShowStringInfo(node.GetFirstToken().ValueText);
}
if (infoBox != null) {
qiContent.Add(infoBox);
applicableToSpan = currentSnapshot.CreateTrackingSpan(extent.Span.Start, extent.Span.Length, SpanTrackingMode.EdgeInclusive);
return;
}
goto EXIT;
goto RETURN;
}

if (node is PredefinedTypeSyntax) {
if (node is PredefinedTypeSyntax/* void */) {
goto EXIT;
}
var formatMap = _FormatMapService.GetEditorFormatMap(session.TextView);
Expand Down Expand Up @@ -173,7 +171,9 @@ public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiC
}
}
RETURN:
applicableToSpan = currentSnapshot.CreateTrackingSpan(extent.Span.Start, extent.Span.Length, SpanTrackingMode.EdgeInclusive);
applicableToSpan = qiContent.Count > 0
? currentSnapshot.CreateTrackingSpan(extent.Span.Start, extent.Span.Length, SpanTrackingMode.EdgeInclusive)
: null;
return;
EXIT:
applicableToSpan = null;
Expand Down Expand Up @@ -321,6 +321,9 @@ static StackPanel ShowNumericForms(object value, NumericForm form) {

void ShowParameterInfo(IList<object> qiContent, SyntaxNode node) {
var argument = node;
if (node.Kind() == SyntaxKind.NullLiteralExpression) {
argument = node.Parent;
}
int depth = 0;
do {
var n = argument as ArgumentSyntax;
Expand Down Expand Up @@ -446,6 +449,9 @@ static StackPanel ToUIText(ImmutableArray<SymbolDisplayPart> parts, string title
case SymbolDisplayPartKind.StructName:
stack.AddText(part.Symbol.Name, argumentIndex == Int32.MinValue, false, _StructBrush);
break;
case SymbolDisplayPartKind.DelegateName:
stack.AddText(part.Symbol.Name, argumentIndex == Int32.MinValue, false, _DelegateBrush);
break;
case SymbolDisplayPartKind.StringLiteral:
stack.AddText(part.ToString(), false, false, _TextBrush);
break;
Expand All @@ -465,6 +471,7 @@ static void UpdateSyntaxHighlights(IEditorFormatMap formatMap) {
_ClassBrush = GetFormatBrush(Constants.CodeClassName, formatMap);
_TextBrush = GetFormatBrush(Constants.CodeString, formatMap);
_EnumBrush = GetFormatBrush(Constants.CodeEnumName, formatMap);
_DelegateBrush = GetFormatBrush(Constants.CodeDelegateName, formatMap);
_NumberBrush = GetFormatBrush(Constants.CodeNumber, formatMap);
_StructBrush = GetFormatBrush(Constants.CodeStructName, formatMap);
_KeywordBrush = GetFormatBrush(Constants.CodeKeyword, formatMap);
Expand Down
2 changes: 1 addition & 1 deletion Codist/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="Codist.WMJ.c7b93d20-621f-4b21-9d28-d51157ef0b94" Version="2.4.2.434" Language="en-US" Publisher="WMJ" />
<Identity Id="Codist.WMJ.c7b93d20-621f-4b21-9d28-d51157ef0b94" Version="2.4.2.437" Language="en-US" Publisher="WMJ" />
<DisplayName>Codist</DisplayName>
<Description xml:space="preserve">A plugin which enhances coding experience with advanced syntax highlighting and scrollbar marking.

Expand Down

0 comments on commit a439ddf

Please sign in to comment.