Skip to content

Instantly share code, notes, and snippets.

@rionmonster
Created January 30, 2017 16:06
Show Gist options
  • Save rionmonster/b53865f70cd0eabeb880c80e0f19585c to your computer and use it in GitHub Desktop.
Save rionmonster/b53865f70cd0eabeb880c80e0f19585c to your computer and use it in GitHub Desktop.
Example of Manual Package Loading
[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