Skip to content

Commit

Permalink
- Fixed an issue causing VS to crash
Browse files Browse the repository at this point in the history
  • Loading branch information
wmjordan committed Feb 7, 2018
1 parent a439ddf commit af5554f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 25 deletions.
29 changes: 18 additions & 11 deletions Codist/Classifiers/CodeTagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,25 @@ public IEnumerable<ITagSpan<ClassificationTag>> GetTags(NormalizedSnapshotSpanCo
yield break;
}
IEnumerable<IMappingTagSpan<IClassificationTag>> tagSpans;
if (_Tags.LastParsed == 0) {
// perform a full parse for the first time
Debug.WriteLine("Full parse");
tagSpans = _Aggregator.GetTags(new SnapshotSpan(snapshot, 0, snapshot.Length));
_Tags.LastParsed = snapshot.Length;
}
else {
var start = spans[0].Start;
var end = spans[spans.Count - 1].End;
Debug.WriteLine($"Get tag [{start.Position}..{end.Position})");
try {
if (_Tags.LastParsed == 0) {
// perform a full parse for the first time
Debug.WriteLine("Full parse");
tagSpans = _Aggregator.GetTags(new SnapshotSpan(snapshot, 0, snapshot.Length));
_Tags.LastParsed = snapshot.Length;
}
else {
var start = spans[0].Start;
var end = spans[spans.Count - 1].End;
Debug.WriteLine($"Get tag [{start.Position}..{end.Position})");

tagSpans = _Aggregator.GetTags(spans);
tagSpans = _Aggregator.GetTags(spans);
}
}
catch (ObjectDisposedException ex) {
// HACK: TagAggregator could be disposed during editing, to be investigated further
Debug.WriteLine(ex.Message);
yield break;
}

foreach (var tagSpan in tagSpans) {
Expand Down
1 change: 1 addition & 0 deletions Codist/Margins/CodeMarginElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ private void DrawMarkers(DrawingContext drawingContext) {
}
if (b == ClassNameBrush || b == InterfaceNameBrush || b == StructNameBrush || b == EnumNameBrush) {
if (tag.Length > 0) {
// the tag could be zero-lengthed, so we have to check
DrawDeclarationMark(drawingContext, b, y, c, snapshot.GetText(tag.Start, tag.Length));
}
continue;
Expand Down
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.439")]
[assembly: AssemblyFileVersion("2.4.2.443")]
5 changes: 4 additions & 1 deletion Codist/Views/CSharpTooltip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ static StackPanel ToUIText(ImmutableArray<SymbolDisplayPart> parts, string title
}

static void UpdateSyntaxHighlights(IEditorFormatMap formatMap) {
System.Diagnostics.Trace.Assert(formatMap != null, "format map is null");
_InterfaceBrush = GetFormatBrush(Constants.CodeInterfaceName, formatMap);
_ClassBrush = GetFormatBrush(Constants.CodeClassName, formatMap);
_TextBrush = GetFormatBrush(Constants.CodeString, formatMap);
Expand All @@ -480,7 +481,9 @@ static void UpdateSyntaxHighlights(IEditorFormatMap formatMap) {
}

private void _ConfigUpdated(object sender, EventArgs e) {
UpdateSyntaxHighlights(_FormatMap);
if (_FormatMap != null) {
UpdateSyntaxHighlights(_FormatMap);
}
}
StackPanel ShowAttributes(ImmutableArray<AttributeData> attrs, int position) {
var stack = new StackPanel();
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.437" Language="en-US" Publisher="WMJ" />
<Identity Id="Codist.WMJ.c7b93d20-621f-4b21-9d28-d51157ef0b94" Version="2.4.2.443" 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
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@
![Syntax highlight](doc/highlight2.png)
![Syntax highlight](doc/highlight3.png)

## Customized comment styles
* The comment tagger highlights comments (actually all editor styles) to your specific styles.

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

Here's the effect of the highlighted comments.

![Comment syntax highlight](doc/syntax-highlight-comments.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* value of the corresponding syntax parts.

## Super Quick Info

The quick info (the tooltip shown when you hover your mouse pointer to language elements) can be enhanced by *Codist*.
Expand Down Expand Up @@ -69,6 +58,17 @@ The quick info (the tooltip shown when you hover your mouse pointer to language

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

## Customized comment styles
* The comment tagger highlights comments to your specific styles.

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

Here's the effect of the highlighted comments.

![Comment syntax highlight](doc/syntax-highlight-comments.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* value of the corresponding syntax parts.

## Markers on the Scrollbar Margin

The scrollbar can mark...
Expand Down

0 comments on commit af5554f

Please sign in to comment.