diff --git a/Codist/Classifiers/CSharpClassifier.cs b/Codist/Classifiers/CSharpClassifier.cs index 0bc2b642..91d5a114 100644 --- a/Codist/Classifiers/CSharpClassifier.cs +++ b/Codist/Classifiers/CSharpClassifier.cs @@ -258,7 +258,7 @@ static void ClassifyPunctuation(TextSpan itemSpan, ITextSnapshot snapshot, List< } var s = snapshot.GetText(itemSpan.Start, itemSpan.Length)[0]; if (s == '{' || s == '}') { - var node = unitCompilation.FindNode(itemSpan, true, true); + var node = unitCompilation.FindNode(itemSpan, true, false); if (node is BaseTypeDeclarationSyntax == false && node is ExpressionSyntax == false && node is NamespaceDeclarationSyntax == false diff --git a/Codist/Config.cs b/Codist/Config.cs index 4be6fbc1..9ea3de60 100644 --- a/Codist/Config.cs +++ b/Codist/Config.cs @@ -3,14 +3,13 @@ using System.ComponentModel; using System.Diagnostics; using System.IO; -using System.Reflection; using System.Threading; using System.Windows.Media; -using Newtonsoft.Json; +using AppHelpers; using Codist.Classifiers; -using Codist.SyntaxHighlight; using Codist.Margins; -using AppHelpers; +using Codist.SyntaxHighlight; +using Newtonsoft.Json; namespace Codist { diff --git a/Codist/NaviBar/NaviBarFactory.cs b/Codist/NaviBar/NaviBarFactory.cs index ef0e7a3e..454ea693 100644 --- a/Codist/NaviBar/NaviBarFactory.cs +++ b/Codist/NaviBar/NaviBarFactory.cs @@ -12,7 +12,7 @@ namespace Codist.NaviBar /// Overrides default navigator to editor. /// [Export(typeof(IWpfTextViewCreationListener))] - [ContentType(Constants.CodeTypes.CSharp)] + [ContentType(Constants.CodeTypes.Code)] [TextViewRole(PredefinedTextViewRoles.Document)] sealed partial class NaviBarFactory : IWpfTextViewCreationListener { @@ -30,8 +30,34 @@ sealed partial class NaviBarFactory : IWpfTextViewCreationListener public void TextViewCreated(IWpfTextView textView) { if (Config.Instance.Features.MatchFlags(Features.NaviBar)) { - textView.Properties.GetOrCreateSingletonProperty(() => new SemanticContext(textView)); - new Overrider(textView); + if (textView.TextBuffer.ContentType.IsOfType(Constants.CodeTypes.CSharp)) { + textView.Properties.GetOrCreateSingletonProperty(() => new SemanticContext(textView)); + new Overrider(textView); + } +#if DEBUG + else { + AssociateFileCodeModelOverrider(); + } +#endif + } + } + + static void AssociateFileCodeModelOverrider() { + Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); + var model = CodistPackage.DTE2.ActiveDocument?.ProjectItem.FileCodeModel; // the active document can be null + if (model == null) { + return; + } + var codeElements = model.CodeElements; + foreach (EnvDTE80.CodeElement2 item in codeElements) { + System.Diagnostics.Debug.WriteLine(item.Name + "," + item.Kind + "," + item.StartPoint.Line + "," + item.StartPoint.LineCharOffset); + if (item.IsCodeType && item.Kind != EnvDTE.vsCMElement.vsCMElementDelegate) { + var ct = (item as EnvDTE.CodeType).Members; + for (int i = 1; i <= ct.Count; i++) { + var member = ct.Item(i); + System.Diagnostics.Debug.WriteLine(member.Name + "," + member.Kind + "," + member.StartPoint.Line + "," + member.StartPoint.LineCharOffset); + } + } } } diff --git a/Codist/Properties/AssemblyInfo.cs b/Codist/Properties/AssemblyInfo.cs index e5ef4d0f..23fe46db 100644 --- a/Codist/Properties/AssemblyInfo.cs +++ b/Codist/Properties/AssemblyInfo.cs @@ -11,4 +11,4 @@ [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.2.0.2963")] +[assembly: AssemblyFileVersion("4.3.0.3085")] diff --git a/Codist/source.extension.vsixmanifest b/Codist/source.extension.vsixmanifest index 0dd53e11..ce22202a 100644 --- a/Codist/source.extension.vsixmanifest +++ b/Codist/source.extension.vsixmanifest @@ -1,38 +1,33 @@  - - - Codist - A coding experience and productivity enhancer for C# programmers with advanced syntax highlight, Super Quick Info (code tooltip), Smart Bar, code navigation bar, code structure on scrollbar markers, comment tagger, and more. - https://github.com/wmjordan/Codist - license.txt - https://github.com/wmjordan/Codist/releases - icon.png - preview.png - coding, programming, productivity, syntax highlight, quick info, reference analysis, navigation, comment, tag, line number, scrollbar, C#, C, C++, html, line height - - - - - - - - - - - - - - - - - - - - - + + + Codist + A productivity enhancer for C# programmers with advanced syntax highlight, Super Quick Info (code tooltip), Smart Bar (contextual toolbar), Navigation Bar, code structure markers on scrollbar, comment tagger, and more. + https://github.com/wmjordan/Codist + license.txt + https://github.com/wmjordan/Codist/releases + icon.png + preview.png + coding, programming, productivity, syntax highlight, quick info, reference analysis, navigation, comment, tag, line number, scrollbar, C#, C, C++, html, line height + + + + + + + + + + + + + + + + +--> \ No newline at end of file diff --git a/README.md b/README.md index 9e34a70a..c7248b89 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ * Unnecessary code is marked strike-through. * Keywords are categorized and highlighted with various styles (e.g. `abstract` and `sealed`, `return` and `throw`, etc.). * Overriding methods (such as `ToString`) can be painted with gradient background color. - * Imported symbols (from external assemblies, e.g. `NotImplementedException`, `ToString`) can be marked with a different style (bold here) + * Imported symbols (from external assemblies, e.g. `NotImplementedException`, `ToString`) can be marked with a different style (bold here) from symbols in your code, which are also possible to be styled. * All the above styles are customizable. ![Syntax highlight](doc/highlight1.png) @@ -55,7 +55,7 @@ From version 4.0 on, it is possible to identify symbols which are defined in your source code and which are imported from external assemblies. - You can customize this in the *Symbol Marker* tab of in the *C#* section of *Syntax Highlight*. + You can customize them in the *Symbol Marker* tab of in the *C#* section of *Syntax Highlight*. Style _My Type and Member_ is used for symbols from your code, and _Referenced Type and Member_ is used for symbols imported from external assemblies. ![Symbolmarker Options 2](doc/symbolmarker-options-2.png) @@ -70,6 +70,8 @@ ![Comment syntax highlight](doc/comment-tagger-options.png) + To disable comment tagger, uncheck the check box of _Comment Tagger_ on the _Syntax Highlight_ option page. + * The syntax style of comments or C# XML Documentations could be changed too. You can make them semitrasparent to stand behind usual code lines by changing the *Opacity* or the *Font size* value of the corresponding syntax parts. ![Comment syntax XML Doc](doc/csharp-options-xmldoc.png) @@ -178,7 +180,7 @@ It brings commonly used operations for the selection, such as editing operations ![Smart Bar](doc/smart-bar.png) -Buttons on the *Smart Bar* changes according to contexts. +Buttons on the *Smart Bar* changes according to your selection. ![Smart Bar](doc/smart-bar-2.png) @@ -192,13 +194,13 @@ From version 3.9 on, you can change the behavior of the Smart Bar. ## Scrollbar Marker -The scrollbar can mark... +Scollbar Marker draws extra glyphs and shapes on the scrollbar for the following syntax elements: * C# `class`/`struct`/`interface`/`enum` **declarations** (marked with a square and their names) * C# symbol match marker (matches symbol under the caret, marked with an aqua square) * C# instructions (`#if`, `#else`, `#region`, `#pragma`) (marked with a gray spot) * **Line numbers** (marked with gray dashed lines and numbers) -* Special comments (marked with small squares) +* Special comments tagged by comment tagger (marked with small squares) Please see screenshots in the above sections. @@ -218,7 +220,7 @@ The scrollbar can mark... Symbol markers will be cleared when the solution is unloaded. - The style of symbol markers can be customized in options page of the *Syntax highlight* feature. + The style of symbol markers can be customized in options page of the *Syntax highlight* feature. The default colors are listed below. ![Symbol marker Options](doc/symbolmarker-options.png) @@ -234,6 +236,8 @@ The scrollbar can mark... Clicking on the syntax node on the navigation bar will select the corresponding span in the editor. If you have enabled _Smart Bar_ as well, _Smart bar_ will appear offering operations that can be performed against the syntax node. + ![Navigation Bar Menu](doc/navigation-bar-select.png) + Clicking on namespace or class definition syntax node will drop down a menu, showing members defined under it. You can type in the text box nearby the funnel icon to filter members listed in the menu. The buttons to the right hand side of the text box can be used to further filter the results. @@ -242,6 +246,8 @@ The scrollbar can mark... Clicking on the "//" button at the left side of the navigation bar will pop up a text box. You can type some text in it and search for declarations defined in the active document code window. + From version 4.3 on, it is possible to expand the search scope to project-wide, by clicking the second button nearby the text box. + ![Navigation Bar Search Declaration](doc/navigation-bar-search-declaration.png) ## Display Enhancements @@ -302,4 +308,4 @@ Your vote and feedback on the [Visual Studio Extension Marketplace](https://mark If you like _Codist_ and want to support the future development of it, you can [donate to the author](http://paypal.me/wmzuo). -The recommended amount of donation is `$19.99`, nevertheless, any other amount of donations are appreciated. +You can donate any amount of money as you like. The recommended amount of donation is `$19.99`. diff --git a/doc/load-theme.png b/doc/load-theme.png index 76a0fcd2..c600c395 100644 Binary files a/doc/load-theme.png and b/doc/load-theme.png differ diff --git a/doc/navigation-bar-overview.png b/doc/navigation-bar-overview.png index 9bbb2220..3a4ca1de 100644 Binary files a/doc/navigation-bar-overview.png and b/doc/navigation-bar-overview.png differ diff --git a/doc/navigation-bar-search-declaration.png b/doc/navigation-bar-search-declaration.png index e8fb381e..6791a523 100644 Binary files a/doc/navigation-bar-search-declaration.png and b/doc/navigation-bar-search-declaration.png differ diff --git a/doc/navigation-bar-select.png b/doc/navigation-bar-select.png new file mode 100644 index 00000000..6b6f47ca Binary files /dev/null and b/doc/navigation-bar-select.png differ diff --git a/doc/smart-bar-symbol-analysis.png b/doc/smart-bar-symbol-analysis.png index 7aafde8d..07eb93e8 100644 Binary files a/doc/smart-bar-symbol-analysis.png and b/doc/smart-bar-symbol-analysis.png differ diff --git a/doc/super-quick-info-8.png b/doc/super-quick-info-8.png index bb0cdcea..cea0624f 100644 Binary files a/doc/super-quick-info-8.png and b/doc/super-quick-info-8.png differ