Skip to content

Commit

Permalink
Version 4.0:
Browse files Browse the repository at this point in the history
+ Navigation Bar (new feature)
+ Symbol location (source code or metadata) distinguishability
+ Better themed interface
+ Better preview of syntax highlight options
+ Used different icons for compiler diagnostics in Super Quick Info
+ Possible to disable C# quick info temporarily when Ctrl is pressed
! Optimized priority of C# syntax highlighting
! Default config and syntax highlight tweaks
! Migrating to async and await model
- Fixed no feature was enabled after initial installation
- Fixed issue #42 (UI got frozen when adjusting syntax highlight options)
- Other fixes and tweaks
  • Loading branch information
wmjordan committed Oct 15, 2018
1 parent f8b95f2 commit dda9874
Show file tree
Hide file tree
Showing 18 changed files with 197 additions and 55 deletions.
2 changes: 2 additions & 0 deletions Codist/Codist.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
<Compile Include="Classifiers\TaggerResult.cs" />
<Compile Include="Classifiers\XmlClassificationDefinitions.cs" />
<Compile Include="Classifiers\XmlFormats.cs" />
<Compile Include="Controls\StateButton.cs" />
<Compile Include="Helpers\CancellationHelper.cs" />
<Compile Include="NaviBar\NaviBarFactory.cs" />
<Compile Include="NaviBar\CSharpBar.cs" />
<Compile Include="CodistPackage.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Codist/CodistPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Codist
/// <para>The project consists of the following namespace: <see cref="SyntaxHighlight"/> backed by <see cref="Classifiers"/>, <see cref="SmartBars"/>, <see cref="QuickInfo"/>, <see cref="Margins"/>, <see cref="NaviBar"/> etc.</para>
/// </summary>
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[InstalledProductRegistration("#110", "#112", "3.9", IconResourceID = 400)] // Information on this package for Help/About
[InstalledProductRegistration("#110", "#112", "4.0", IconResourceID = 400)] // Information on this package for Help/About
[Guid(PackageGuidString)]
[ProvideOptionPage(typeof(Options.General), Constants.NameOfMe, "General", 0, 0, true)]
[ProvideOptionPage(typeof(Options.SuperQuickInfo), CategorySuperQuickInfo, "General", 0, 0, true, Sort = 0)]
Expand Down
2 changes: 1 addition & 1 deletion Codist/Controls/Menu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Menu}">
<StackPanel CanHorizontallyScroll="True" ClipToBounds="True" Orientation="Horizontal" Background="{DynamicResource VsBrush.CommandBarMenuBackgroundGradient}" IsItemsHost="True"/>
<StackPanel CanHorizontallyScroll="True" MaxHeight="22" ClipToBounds="True" Orientation="Horizontal" Background="{DynamicResource VsBrush.CommandBarMenuBackgroundGradient}" IsItemsHost="True"/>
</ControlTemplate>
</Setter.Value>
</Setter>
Expand Down
44 changes: 44 additions & 0 deletions Codist/Controls/StateButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls.Primitives;
using AppHelpers;

namespace Codist.Controls
{
sealed class StateButton<TState> : ToggleButton
where TState : struct, Enum
{
readonly TState _State;
readonly Func<TState> _StateGetter;
readonly Action<TState, bool> _StateSetter;
bool _lockUI;

public StateButton(TState state, Func<TState> stateGetter, Action<TState, bool> stateSetter) {
_State = state;
_StateGetter = stateGetter;
_StateSetter = stateSetter;
this.SetBackgroundForCrispImage(ThemeHelper.TitleBackgroundColor);
}

public void UpdateState() {
_lockUI = true;
try {
IsChecked = _StateGetter().MatchFlags(_State);
}
finally {
_lockUI = false;
}
}

protected override void OnChecked(RoutedEventArgs e) {
base.OnChecked(e);
if (_lockUI == false) {
_StateSetter(_State, IsChecked.GetValueOrDefault());
}
}
}
}
58 changes: 58 additions & 0 deletions Codist/NaviBar/SymbolHistory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codist.CodeBar
{
readonly struct SymbolHistory : IEquatable<SymbolHistory>
{
internal static List<SymbolHistory> Records { get; } = new List<SymbolHistory>();
internal static void Add(string document) {
for (int i = 0; i < Records.Count; i++) {
if (String.Equals(Records[i].Document, document, StringComparison.OrdinalIgnoreCase)) {
Records.RemoveAt(i);
break;
}
}
Records.Insert(0, new SymbolHistory(document, 1, 1));
if (Records.Count > 10) {
Records.RemoveAt(10);
}
}

public readonly string Document;
public readonly int Line, Column;

public SymbolHistory(string document, int line, int column) {
Document = document;
Line = line;
Column = column;
}

public override bool Equals(object obj) {
return AppHelpers.ClrHacker.DirectCompare(this, (SymbolHistory)obj);
}

public bool Equals(SymbolHistory other) {
return AppHelpers.ClrHacker.DirectCompare(this, other);
}

public override int GetHashCode() {
var hashCode = 1439312346;
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Document);
hashCode = hashCode * -1521134295 + Line.GetHashCode();
hashCode = hashCode * -1521134295 + Column.GetHashCode();
return hashCode;
}

public static bool operator ==(SymbolHistory history1, SymbolHistory history2) {
return history1.Equals(history2);
}

public static bool operator !=(SymbolHistory history1, SymbolHistory history2) {
return !(history1 == history2);
}
}
}
22 changes: 11 additions & 11 deletions Codist/Options/GeneralPage.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Codist/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
[assembly: AssemblyTrademark(nameof(Codist))]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.9.0.2489")]
[assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyFileVersion("4.0.0.2601")]
2 changes: 1 addition & 1 deletion Codist/SmartBars/SmartBar.CommonEdit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static CommandItem[] GetCaseCommands() {
ctx.KeepToolBarOnClick = true;
TextEditorHelper.ExecuteEditorCommand("Edit.Capitalize");
}),
new CommandItem(KnownImageIds.Blank, "Uppercase", null, ctx => {
new CommandItem(KnownImageIds.ASerif, "Uppercase", null, ctx => {
ctx.KeepToolBarOnClick = true;
TextEditorHelper.ExecuteEditorCommand("Edit.MakeUppercase");
}),
Expand Down
8 changes: 4 additions & 4 deletions Codist/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?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="3.9.0.2489" Language="en-US" Publisher="WMJ" />
<Identity Id="Codist.WMJ.c7b93d20-621f-4b21-9d28-d51157ef0b94" Version="4.0.0.2600" Language="en-US" Publisher="WMJ" />
<DisplayName>Codist</DisplayName>
<Description xml:space="preserve">A C# coding experience and productivity enhancer with advanced syntax highlight, Super Quick Info (code tooltip), Smart Bar, breadcrumb navigation bar, code structure on scrollbar markers, comment tagger, and more.</Description>
<Description xml:space="preserve">A C# coding experience and productivity enhancer with advanced syntax highlight, Super Quick Info (code tooltip), Smart Bar, code navigation bar, code structure on scrollbar markers, comment tagger, and more.</Description>
<MoreInfo>https://github.com/wmjordan/Codist</MoreInfo>
<ReleaseNotes>https://github.com/wmjordan/Codist/releases/tag/v3.0</ReleaseNotes>
<ReleaseNotes>https://github.com/wmjordan/Codist/releases/tag/v4.0</ReleaseNotes>
<Icon>icon.png</Icon>
<PreviewImage>preview.png</PreviewImage>
<Tags>programming, productivity, syntax highlight, quick info, reference analysis, breadcrumb, comment, tag, line number, scrollbar, C#, C, C++, html, line height</Tags>
<Tags>programming, productivity, syntax highlight, quick info, reference analysis, navigation, comment, tag, line number, scrollbar, C#, C, C++, html, line height</Tags>
</Metadata>
<Installation>
<InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Pro" />
Expand Down
108 changes: 73 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@

# Features and screenshots

* Advanced syntax highlight with *comment tagger*
* Super Quick Info with *Click and Go* to source code
* Smart Bar (**new in version 3.0**) with symbol reference analyzers
* Scrollbar markers
* [Advanced syntax highlight](#advanced-c-syntax-highlight) with [*comment tagger*](#comment-tagger-and-styles)
* [Super Quick Info](#super-quick-info) with *Click and Go* to source code
* [Smart Bar](#smart-bar) with symbol reference analyzers
* [Scrollbar Marker](#scrollbar-marker)
* [Symbol Marker](#symbol-marker)
* [Navigation bar](#navigation-bar) (**new in version 4.0**)
* Extra margin between lines
* [Comprehensive options](#feature-control) are offered

![Feature overview](doc/preview.png)

Expand All @@ -24,6 +27,7 @@
* Unnecessary code is marked strike-through.
* Keywords are categorized and highlighted with various styles.
* Overriding methods (such as `ToString`) can be painted with gradient background color.
* Imported symbols (from external assemblies) can be marked with a different style (bold here)
* All the above styles are customizable.

![Syntax highlight](doc/highlight1.png)
Expand All @@ -34,14 +38,41 @@

![Load Theme](doc/load-theme.png)

From version 4.0 on, it is possible to Save and Load your own syntax highlight to an individual file and share it with your workmates.

### Customization of syntax highlight styles

To customize and tweak the syntax highlight styles, click the *common syntax* tab in the *syntax highlight* section, or click the sub sections inside the *Syntax Highlight* section to change individual styles, accordingly.

![Style customization](doc/syntax-highlight.png)

Syntax definitions under the _All languages_ section apply to all languages; those under _Comment_ section apply to comment taggers (see below), others apply to corresponding languages accordingly.

**TIP**: Open a document window before you change the syntax theme or tweak the syntax highlight settings, while you change theme, you can see how the styles change in the code document window simultaneously.

### My symbols and external symbols

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*.

![Symbolmarker Options 2](doc/symbolmarker-options-2.png)

## Comment tagger and styles
* The comment tagger highlights comments to your specific styles, according to the first token inside the comment.

Here's the effect of the highlighted comments.

![Comment syntax highlight](doc/syntax-highlight-comments.png)

To configure the comment tags, click the *Tags* tab, in the *Comment* sub-section of the *Syntax Highlight* section, where you can add, remove or modify comment tags.

![Comment syntax highlight](doc/comment-tagger-options.png)

* 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)

## Super Quick Info

The quick info (the tooltip shown when you hover your mouse pointer on your C# source code) can be enhanced by *Codist*.
Expand Down Expand Up @@ -127,33 +158,6 @@ The quick info (the tooltip shown when you hover your mouse pointer on your C# s

![Super Quick Info - Color](doc/super-quick-info-color.png)

## Comment tagger and styles
* The comment tagger highlights comments to your specific styles, according to the first token inside the comment.

Here's the effect of the highlighted comments.

![Comment syntax highlight](doc/syntax-highlight-comments.png)

To configure the comment tags, click the *Tags* tab, in the *Comment* sub-section of the *Syntax Highlight* section, where you can add, remove or modify comment tags.

![Comment syntax highlight](doc/comment-tagger-options.png)

* 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)

## Markers on the Scrollbar Margin

The scrollbar can mark...

* C# `class`/`struct`/`interface`/`enum` **declarations** (marked with a square and their names)
* C# symbol references (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)

Please see screenshots in the above sections.

## Smart Bar

The *Smart Bar* is a context-aware tool bar appeared automatically when you select some text, or double tap the Shift key on your keyboard.
Expand All @@ -174,7 +178,19 @@ From version 3.9 on, you can change the behavior of the Smart Bar.

![Smart Bar Options](doc/smart-bar-options.PNG)

### Symbol markers
## Scrollbar Marker

The scrollbar can mark...

* 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)

Please see screenshots in the above sections.

## Symbol Marker

Symbol marker is a new feature introduced in version 3.8.

Expand All @@ -194,18 +210,40 @@ From version 3.9 on, you can change the behavior of the Smart Bar.

![Symbol marker Options](doc/symbolmarker-options.png)

# Feature control
## Navigation Bar

Navigation bar is a new feature introduced since version 4.0. It overrides the original navigation bar on the top of the document window.

It not only shows available types and declarations in the code window like the original navigation bar, but also syntax nodes containing the caret.

When you hover the mouse over the node on the bar, corresponding span of the node will be highlighted in the editor.

![Navigation Bar Overview](doc/navigation-bar-overview.png)

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.

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.

![Navigation Bar Menu](doc/navigation-bar-menu.png)

Clicking on the "//" button at the left side of the navigation bar will pop up a text box. You can type in it and search for declarations defined in the active document code window.

![Navigation Bar Search Declaration](doc/navigation-bar-search-declaration.png)

# Feature Control
Open the *Codist* section in the *Tools->Options* dialog. In the *General* section you can toggle features of *Codist*.

![General customization](doc/general-options.png)

1. *Feature controllers* contains check boxes which can be used to enable/disable features of *Codist*.

It is useful when your laptop are running on battery. Disabling *Codist* may help it sustain a little bit longer.
When you are running on a laptop with battery. Disabling *Codist* may help it sustain a little bit longer.

Someone who does not like the syntax highlight or use another syntax highlighter can also turn off the *Syntax Highlight* feature individually here.

These options affects new document windows. Existing document windows won't be affected.
These **options will take effect on new document windows**. Existing document windows won't be affected.

2. Within the *Extra line margins* group box, you can adjust margins between lines to make code lines more readable.

Expand Down
Binary file modified doc/general-options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/load-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/navigation-bar-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/navigation-bar-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/navigation-bar-search-declaration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/symbolmarker-options-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/syntax-highlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dda9874

Please sign in to comment.