Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit afd3c1a

Browse files
authored
Merge pull request #65 from rionmonster/develop
Version 1.5.2.0
2 parents a898c61 + 0ca8ccd commit afd3c1a

File tree

377 files changed

+713
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+713
-185
lines changed

.vs/Image Optimizer/cache-lossless.txt

Lines changed: 382 additions & 0 deletions
Large diffs are not rendered by default.

EmojiCompletionProviders/EmojiCompletionSource.cs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
using Microsoft.VisualStudio.Language.Intellisense;
22
using Microsoft.VisualStudio.Text;
3-
using Microsoft.VisualStudio.Text.Classification;
43
using Microsoft.VisualStudio.Text.Operations;
5-
using System;
64
using System.Collections.Generic;
75
using System.Linq;
8-
using System.Text.RegularExpressions;
9-
using System.Windows.Media;
6+
using Glyphfriend.Helpers;
107

118
namespace Glyphfriend.EmojiCompletionProviders
129
{
13-
class EmojiCompletionSource : ICompletionSource
10+
internal class EmojiCompletionSource : ICompletionSource
1411
{
15-
private readonly ITextBuffer _buffer;
1612
private readonly List<Completion> _emojis;
17-
private ITextStructureNavigator _textStructureNavigator;
18-
private bool _disposed = false;
13+
private readonly ITextStructureNavigator _textStructureNavigator;
14+
private bool _disposed;
1915

20-
public EmojiCompletionSource(ITextBuffer buffer,ITextStructureNavigator textStructureNavigator)
16+
public EmojiCompletionSource(ITextStructureNavigator textStructureNavigator)
2117
{
22-
_buffer = buffer;
2318
_textStructureNavigator = textStructureNavigator;
2419
// Build a collection of Emojis to handle
2520
_emojis = GlyphfriendPackage.Emojis
@@ -40,7 +35,7 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
4035
SnapshotPoint? triggerPoint = session.GetTriggerPoint(snapshot);
4136

4237
// Ensuer the trigger point is valid
43-
if (triggerPoint == null || !triggerPoint.HasValue || triggerPoint.Value.Position == 0)
38+
if (triggerPoint == null || triggerPoint.Value.Position == 0)
4439
{
4540
return;
4641
}
@@ -69,23 +64,21 @@ public void Dispose()
6964
_disposed = true;
7065
}
7166

72-
private static Completion EmojiCompletion(string emoji, ImageSource emojiImage)
67+
private static Completion EmojiCompletion(string emoji, LazyImage emojiImage)
7368
{
7469
// Map a completion object for each Emoji to the appropriate image
7570
var formattedEmoji = $":{emoji}:";
7671
// Build a completion for each Emoji
77-
return new Completion(formattedEmoji, formattedEmoji, formattedEmoji, emojiImage, formattedEmoji);
72+
return new Completion(formattedEmoji, formattedEmoji, formattedEmoji, emojiImage?.Image, formattedEmoji);
7873
}
7974

80-
private ITrackingSpan FindTokenSpanAtPosition(ICompletionSession session)
75+
private ITrackingSpan FindTokenSpanAtPosition(IIntellisenseSession session)
8176
{
8277
// Look for the nearly start of line or space prior to the starting character and
8378
// examine it
8479
SnapshotPoint currentPoint = session.TextView.Caret.Position.BufferPosition - 1;
8580
TextExtent extent = _textStructureNavigator.GetExtentOfWord(currentPoint);
8681
return currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive);
8782
}
88-
89-
9083
}
9184
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
using System.ComponentModel.Composition;
22
using Microsoft.VisualStudio.Utilities;
3-
using Glyphfriend.Helpers;
3+
using Glyphfriend.Helpers.Markdown;
44
using Microsoft.VisualStudio.Language.Intellisense;
55
using Microsoft.VisualStudio.Text;
66
using Microsoft.VisualStudio.Text.Operations;
7-
using Microsoft.VisualStudio.Text.Classification;
87

98
namespace Glyphfriend.EmojiCompletionProviders
109
{
1110
[ContentType(MarkdownContentTypeDefinition.MarkdownContentType)]
1211
[Name("Markdown Emoji")]
1312
[Export(typeof(ICompletionSourceProvider))]
14-
class EmojiCompletionProvider : ICompletionSourceProvider
13+
internal class EmojiCompletionProvider : ICompletionSourceProvider
1514
{
1615
[Import]
17-
public ITextStructureNavigatorSelectorService TextStructureNavigatorSelector = null;
16+
private ITextStructureNavigatorSelectorService _textStructureNavigatorSelector;
1817

1918
public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
2019
{
2120
// Build the Emoji completion handler for the current text buffer
22-
return new EmojiCompletionSource(textBuffer, TextStructureNavigatorSelector.GetTextStructureNavigator(textBuffer));
21+
return new EmojiCompletionSource(_textStructureNavigatorSelector.GetTextStructureNavigator(textBuffer));
2322
}
2423
}
2524
}

GlyphCompletionProviders/BaseGlyphfriendProvider.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,48 @@
66

77
namespace Glyphfriend.GlyphCompletionProviders
88
{
9-
class BaseGlyphfriendProvider : ICssCompletionEntryGlyphProvider
9+
internal class BaseGlyphfriendProvider : ICssCompletionEntryGlyphProvider
1010
{
11+
/// <summary>
12+
/// The default CSS class for this library (e.g. fa-default for Font Awesome)
13+
/// </summary>
14+
protected string DefaultIconClass { get; set; }
1115
/// <summary>
1216
/// A Regular Expression representing the file that is used to define the glyphs (e.g. @"^font(-?)awesome(-.*)?(\.min)?\.css$" for Font Awesome)
1317
/// </summary>
14-
protected Regex GlyphCSSDefinitionExpression { get; set; }
18+
protected Regex GlyphCssDefinitionExpression { get; set; }
1519
/// <summary>
1620
/// The name of the Library (e.g. Font Awesome)
1721
/// </summary>
1822
protected string Library { get; set; }
23+
1924
/// <summary>
20-
/// The default CSS class for this library (e.g. fa-default for Font Awesome)
25+
/// Attempts to load a glyph based on its current name and where it was defined. First Glyphfriend will
26+
/// check and attempt to load the glyph if it exists, otherwise it will let Visual Studio handle it
2127
/// </summary>
22-
protected string DefaultIconClass { get; set; }
23-
28+
/// <param name="entryName">The name of the glyph (e.g. fa-beer, glyphicon-alert, etc.)</param>
29+
/// <param name="sourceUri">The URL that cooresponds to the location of the glyph (e.g. the font-awesome.css file for fa-beer, etc.)</param>
30+
/// <param name="nameType"></param>
31+
/// <returns></returns>
2432
public ImageSource GetCompletionGlyph(string entryName, Uri sourceUri, CssNameType nameType)
2533
{
2634
// If the source is null or no glyphs have been loaded, ignore the request
2735
if (sourceUri == null || GlyphfriendPackage.Glyphs == null) { return null; }
2836
// Get the file path of the source being used
2937
var filename = Path.GetFileName(Convert.ToString(sourceUri));
3038
// Determine if the file matches this provider and we have the library loaded
31-
if (GlyphCSSDefinitionExpression.IsMatch(filename.Trim()) && GlyphfriendPackage.Glyphs.ContainsKey(Library))
39+
if (GlyphCssDefinitionExpression.IsMatch(filename.Trim()) && GlyphfriendPackage.Glyphs.ContainsKey(Library))
3240
{
3341
// Since the library is loaded, determine if the Glyph exists
3442
if (entryName != null && GlyphfriendPackage.Glyphs[Library].ContainsKey(entryName))
3543
{
36-
// It does, so serve it
37-
return GlyphfriendPackage.Glyphs[Library][entryName];
44+
// It does, so lazily resolve the image
45+
return GlyphfriendPackage.Glyphs[Library][entryName]?.Image;
3846
}
3947
// Otherwise attempt to see if a default icon is defined and loaded and use it
4048
if (DefaultIconClass != null && GlyphfriendPackage.Glyphs[Library].ContainsKey(DefaultIconClass))
4149
{
42-
return GlyphfriendPackage.Glyphs[Library][DefaultIconClass];
50+
return GlyphfriendPackage.Glyphs[Library][DefaultIconClass]?.Image;
4351
}
4452
}
4553
// Let Visual Studio handle this on its own
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
using Microsoft.CSS.Editor.Completion;
2-
using Microsoft.VisualStudio.Utilities;
3-
using System.ComponentModel.Composition;
1+
using System.ComponentModel.Composition;
42
using System.Text.RegularExpressions;
3+
using Microsoft.CSS.Editor.Completion;
4+
using Microsoft.VisualStudio.Utilities;
55

6-
namespace Glyphfriend.GlyphCompletionProviders
6+
namespace Glyphfriend.GlyphCompletionProviders.Implementations
77
{
88
[Export(typeof(ICssCompletionEntryGlyphProvider))]
99
[Name("Glyphfriend Bootstrap")]
1010
[Order(Before = "Default Bootstrap")]
11-
class BootstrapGlyphCompletionProvider : BaseGlyphfriendProvider
11+
internal class BootstrapGlyphCompletionProvider : BaseGlyphfriendProvider
1212
{
1313
public BootstrapGlyphCompletionProvider()
1414
{
15-
// Define the library name, used to determine the proper folder for the glyphs
1615
Library = "Bootstrap";
17-
// Define the pattern used to match with the CSS file that defines the glyphs
18-
GlyphCSSDefinitionExpression = new Regex(@"^bootstrap(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
16+
GlyphCssDefinitionExpression = new Regex(@"^bootstrap(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
1917
}
2018
}
2119
}

GlyphCompletionProviders/Implementations/EntypoGlyphCompletionProvider.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
using Microsoft.CSS.Editor.Completion;
2-
using Microsoft.VisualStudio.Utilities;
3-
using System.ComponentModel.Composition;
1+
using System.ComponentModel.Composition;
42
using System.Text.RegularExpressions;
3+
using Microsoft.CSS.Editor.Completion;
4+
using Microsoft.VisualStudio.Utilities;
55

6-
namespace Glyphfriend.GlyphCompletionProviders
6+
namespace Glyphfriend.GlyphCompletionProviders.Implementations
77
{
88
[Export(typeof(ICssCompletionEntryGlyphProvider))]
99
[Name("Glyphfriend Entypo")]
10-
class EntypoGlyphCompletionEntryGlyphProvider : BaseGlyphfriendProvider
10+
internal class EntypoGlyphCompletionEntryGlyphProvider : BaseGlyphfriendProvider
1111
{
1212
public EntypoGlyphCompletionEntryGlyphProvider()
1313
{
14-
// Define the library name, used to determine the proper folder for the glyphs
1514
Library = "Entypo";
16-
// Define the pattern used to match with the CSS file that defines the glyphs
17-
GlyphCSSDefinitionExpression = new Regex(@"^entypo?(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
18-
// Define an optional default icon name to display if a glyph is unavailable
15+
GlyphCssDefinitionExpression = new Regex(@"^entypo?(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
1916
DefaultIconClass = "icon-default";
2017
}
2118
}

GlyphCompletionProviders/Implementations/FontAwesomeGlyphCompletionProvider.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
using Microsoft.CSS.Editor.Completion;
2-
using Microsoft.VisualStudio.Utilities;
3-
using System.ComponentModel.Composition;
1+
using System.ComponentModel.Composition;
42
using System.Text.RegularExpressions;
3+
using Microsoft.CSS.Editor.Completion;
4+
using Microsoft.VisualStudio.Utilities;
55

6-
namespace Glyphfriend.GlyphCompletionProviders
6+
namespace Glyphfriend.GlyphCompletionProviders.Implementations
77
{
88
[Export(typeof(ICssCompletionEntryGlyphProvider))]
99
[Name("Glyphfriend Font Awesome")]
10-
class FontAwesomeGlyphCompletionProvider : BaseGlyphfriendProvider
10+
internal class FontAwesomeGlyphCompletionProvider : BaseGlyphfriendProvider
1111
{
1212
public FontAwesomeGlyphCompletionProvider()
1313
{
14-
// Define the library name, used to determine the proper folder for the glyphs
1514
Library = "FontAwesome";
16-
// Define the pattern used to match with the CSS file that defines the glyphs
17-
GlyphCSSDefinitionExpression = new Regex(@"^font(-?)awesome(-.*)?(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
18-
// Define an optional default icon name to display if a glyph is unavailable
15+
GlyphCssDefinitionExpression = new Regex(@"^font(-?)awesome(-.*)?(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
1916
DefaultIconClass = "fa-default";
2017
}
2118
}

GlyphCompletionProviders/Implementations/FoundationGlyphCompletionProvider.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
using Microsoft.CSS.Editor.Completion;
2-
using Microsoft.VisualStudio.Utilities;
3-
using System.ComponentModel.Composition;
1+
using System.ComponentModel.Composition;
42
using System.Text.RegularExpressions;
3+
using Microsoft.CSS.Editor.Completion;
4+
using Microsoft.VisualStudio.Utilities;
55

6-
namespace Glyphfriend.GlyphCompletionProviders
6+
namespace Glyphfriend.GlyphCompletionProviders.Implementations
77
{
88
[Export(typeof(ICssCompletionEntryGlyphProvider))]
99
[Name("Glyphfriend Foundation")]
10-
class FoundationGlyphCompletionEntryGlyphProvider : BaseGlyphfriendProvider
10+
internal class FoundationGlyphCompletionEntryGlyphProvider : BaseGlyphfriendProvider
1111
{
1212
public FoundationGlyphCompletionEntryGlyphProvider()
1313
{
14-
// Define the library name, used to determine the proper folder for the glyphs
1514
Library = "Foundation";
16-
// Define the pattern used to match with the CSS file that defines the glyphs
17-
GlyphCSSDefinitionExpression = new Regex(@"^foundation-icons(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
18-
// Define an optional default icon name to display if a glyph is unavailable
15+
GlyphCssDefinitionExpression = new Regex(@"^foundation-icons(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
1916
DefaultIconClass = "fi-default";
2017
}
2118
}

GlyphCompletionProviders/Implementations/IcoMoonGlyphCompletionProvider.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
using Microsoft.CSS.Editor.Completion;
2-
using Microsoft.VisualStudio.Utilities;
3-
using System.ComponentModel.Composition;
1+
using System.ComponentModel.Composition;
42
using System.Text.RegularExpressions;
3+
using Microsoft.CSS.Editor.Completion;
4+
using Microsoft.VisualStudio.Utilities;
55

6-
namespace Glyphfriend.GlyphCompletionProviders
6+
namespace Glyphfriend.GlyphCompletionProviders.Implementations
77
{
88
[Export(typeof(ICssCompletionEntryGlyphProvider))]
99
[Name("Glyphfriend Icomoon")]
10-
class IcoMoonGlyphCompletionEntryGlyphProvider : BaseGlyphfriendProvider
10+
internal class IcoMoonGlyphCompletionEntryGlyphProvider : BaseGlyphfriendProvider
1111
{
1212
public IcoMoonGlyphCompletionEntryGlyphProvider()
1313
{
14-
// Define the library name, used to determine the proper folder for the glyphs
1514
Library = "IcoMoon";
16-
// Define the pattern used to match with the CSS file that defines the glyphs
17-
GlyphCSSDefinitionExpression = new Regex(@"^(style|icomoon)(\-free)?(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
18-
// Define an optional default icon name to display if a glyph is unavailable
15+
GlyphCssDefinitionExpression = new Regex(@"^(style|icomoon)(\-free)?(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
1916
DefaultIconClass = "icon-default";
2017
}
2118
}

GlyphCompletionProviders/Implementations/IonicGlyphCompletionProvider.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
using Microsoft.CSS.Editor.Completion;
2-
using Microsoft.VisualStudio.Utilities;
3-
using System.ComponentModel.Composition;
1+
using System.ComponentModel.Composition;
42
using System.Text.RegularExpressions;
3+
using Microsoft.CSS.Editor.Completion;
4+
using Microsoft.VisualStudio.Utilities;
55

6-
namespace Glyphfriend.GlyphCompletionProviders
6+
namespace Glyphfriend.GlyphCompletionProviders.Implementations
77
{
88
[Export(typeof(ICssCompletionEntryGlyphProvider))]
99
[Name("Glyphfriend Ionic")]
10-
class IonicGlyphCompletionProvider : BaseGlyphfriendProvider
10+
internal class IonicGlyphCompletionProvider : BaseGlyphfriendProvider
1111
{
1212
public IonicGlyphCompletionProvider()
1313
{
14-
// Define the library name, used to determine the proper folder for the glyphs
1514
Library = "Ionic";
16-
// Define the pattern used to match with the CSS file that defines the glyphs
17-
GlyphCSSDefinitionExpression = new Regex(@"^ionicons(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
18-
// Define an optional default icon name to display if a glyph is unavailable
15+
GlyphCssDefinitionExpression = new Regex(@"^ionicons(\.min)?\.css$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
1916
DefaultIconClass = "ion-default";
2017
}
2118
}

0 commit comments

Comments
 (0)