Skip to content

Commit

Permalink
Version 2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
wmjordan committed May 6, 2018
1 parent 02ee3f7 commit 337b581
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Codist/CodistPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Codist
/// </para>
/// </remarks>
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "2.7", IconResourceID = 400)] // Information on this package for Help/About
[InstalledProductRegistration("#110", "#112", "2.8", IconResourceID = 400)] // Information on this package for Help/About
[Guid(PackageGuidString)]
[ProvideOptionPage(typeof(Options.Misc), Constants.NameOfMe, "General", 0, 0, true)]
[ProvideOptionPage(typeof(Options.CSharp), Constants.NameOfMe, "C#", 0, 0, true, Sort = 10)]
Expand Down
46 changes: 36 additions & 10 deletions Codist/Helpers/CodeAnalysisHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,37 +231,63 @@ public static bool IsType(this CodeMemberType type) {
public static bool IsMember(this CodeMemberType type) {
return type > CodeMemberType.Member && type < CodeMemberType.Other;
}
public static XElement GetBaseTypeDocumentation(this ISymbol symbol, out ISymbol baseType) {
return GetBaseTypeDocumentation(symbol, symbol, out baseType);
public static XElement InheritDocumentation(this ISymbol symbol, out ISymbol baseMember) {
return InheritDocumentation(symbol, symbol, out baseMember);
}
static XElement GetBaseTypeDocumentation(ISymbol symbol, ISymbol querySymbol, out ISymbol baseType) {
static XElement InheritDocumentation(ISymbol symbol, ISymbol querySymbol, out ISymbol baseMember) {
var t = symbol.Kind == SymbolKind.NamedType ? symbol as INamedTypeSymbol : symbol.ContainingType;
if (t == null
// go to the base type if not querying interface
|| t.TypeKind != TypeKind.Interface && (t = t.BaseType) == null
) {
baseType = null;
baseMember = null;
return null;
}
XElement doc;
var member = t.GetMembers(querySymbol.Name).FirstOrDefault(i => i.MatchSignature(querySymbol.Kind, querySymbol.GetReturnType(), querySymbol.GetParameters()));
if (member != null && (doc = member.GetXmlDoc().GetSummary()) != null) {
baseType = member;
baseMember = member;
return doc;
}
if (t.TypeKind != TypeKind.Interface && (doc = GetBaseTypeDocumentation(t, querySymbol, out baseType)) != null) {
if (t.TypeKind != TypeKind.Interface && (doc = InheritDocumentation(t, querySymbol, out baseMember)) != null) {
return doc;
}
else if (symbol.Kind != SymbolKind.NamedType
&& symbol == querySymbol
else if (symbol == querySymbol
&& symbol.Kind != SymbolKind.NamedType
&& (t = symbol.ContainingType) != null) {
foreach (var item in t.Interfaces) {
if ((doc = GetBaseTypeDocumentation(item, querySymbol, out baseType)) != null) {
if ((doc = InheritDocumentation(item, querySymbol, out baseMember)) != null) {
return doc;
}
}
switch (symbol.Kind) {
case SymbolKind.Method:
foreach (var item in (symbol as IMethodSymbol).ExplicitInterfaceImplementations) {
if ((doc = item.GetXmlDoc().GetSummary()) != null) {
baseMember = item;
return doc;
}
}
break;
case SymbolKind.Property:
foreach (var item in (symbol as IPropertySymbol).ExplicitInterfaceImplementations) {
if ((doc = item.GetXmlDoc().GetSummary()) != null) {
baseMember = item;
return doc;
}
}
break;
case SymbolKind.Event:
foreach (var item in (symbol as IEventSymbol).ExplicitInterfaceImplementations) {
if ((doc = item.GetXmlDoc().GetSummary()) != null) {
baseMember = item;
return doc;
}
}
break;
}
}
baseType = null;
baseMember = null;
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions Codist/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.7.0.0")]
[assembly: AssemblyFileVersion("2.7.0.989")]
[assembly: AssemblyVersion("2.8.0.0")]
[assembly: AssemblyFileVersion("2.8.0.1003")]
7 changes: 3 additions & 4 deletions Codist/QuickInfo/CSharpQuickInfoSourceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Xml.Linq;
using AppHelpers;
using Microsoft.CodeAnalysis;
Expand Down Expand Up @@ -90,12 +89,10 @@ public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiC
var unitCompilation = semanticModel.SyntaxTree.GetCompilationUnitRoot();

//look for occurrences of our QuickInfo words in the span
var navigator = _NavigatorService.GetTextStructureNavigator(_TextBuffer);
var node = unitCompilation.FindNode(new TextSpan(querySpan.Start, querySpan.Length), true, true);
if (node == null || node.Span.Contains(subjectTriggerPoint.Position) == false) {
goto EXIT;
}
var extent = navigator.GetExtentOfWord(querySpan.Start).Span;
if (Config.Instance.QuickInfoOptions.MatchFlags(QuickInfoOptions.Parameter)) {
ShowParameterInfo(qiContent, node);
}
Expand Down Expand Up @@ -142,6 +139,8 @@ public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiC
w.ApplyClickAndGo(symbol);
}
QuickInfoOverrider.LimitQuickInfoItemSize(qiContent, w);
var navigator = _NavigatorService.GetTextStructureNavigator(_TextBuffer);
var extent = navigator.GetExtentOfWord(querySpan.Start).Span;
applicableToSpan = qiContent.Count > 0 && session.TextView.TextSnapshot == currentSnapshot
? currentSnapshot.CreateTrackingSpan(extent.Start, extent.Length, SpanTrackingMode.EdgeInclusive)
: null;
Expand All @@ -163,7 +162,7 @@ void OverrideDocumentation(SyntaxNode node, DefaultQuickInfoPanelWrapper qiWrapp
}
else if (Config.Instance.QuickInfoOptions.MatchFlags(QuickInfoOptions.DocumentationFromBaseType)) {
ISymbol baseMember;
var baseDocs = symbol.GetBaseTypeDocumentation(out baseMember);
var baseDocs = symbol.InheritDocumentation(out baseMember);
if (baseDocs != null) {
var info = new TextBlock { TextWrapping = TextWrapping.Wrap }
.AddText("Documentation from ")
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.7.0.985" Language="en-US" Publisher="WMJ" />
<Identity Id="Codist.WMJ.c7b93d20-621f-4b21-9d28-d51157ef0b94" Version="2.8.0.1000" Language="en-US" Publisher="WMJ" />
<DisplayName>Codist</DisplayName>
<Description xml:space="preserve">A plugin which enhances coding experience with advanced syntax highlighting, scrollbar marking and Super Quick Info for C# programmers.</Description>
<MoreInfo>https://github.com/wmjordan/Codist</MoreInfo>
Expand Down

0 comments on commit 337b581

Please sign in to comment.