Created
January 30, 2017 16:06
-
-
Save rionmonster/b53865f70cd0eabeb880c80e0f19585c to your computer and use it in GitHub Desktop.
Example of Manual Package Loading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HtmlCompletionProvider(CompletionTypes.Values, "*", "class")] | |
[ContentType("htmlx")] | |
class GlyphClassCompletionListProvider : BaseClassCompletionProvider | |
{ | |
private static bool _glyphsLoaded; | |
public override string CompletionType | |
{ | |
get { return CompletionTypes.Values; } | |
} | |
public override IList<HtmlCompletion> GetEntries(HtmlCompletionContext context) | |
{ | |
if(!_glyphsLoaded) | |
{ | |
LoadGlyphfriend(); | |
} | |
var completionItems = new List<HtmlCompletion>(); | |
foreach (var glyph in VSPackage.Glyphs) | |
{ | |
completionItems.Add(CreateItem(glyph.Key, glyph.Value, context.Session)); | |
} | |
return completionItems; | |
} | |
private void LoadGlyphfriend() | |
{ | |
var package = GlobalServiceProvider.GetShell().LoadPackage<VSPackage>(); | |
_glyphsLoaded = package != null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment