Skip to content

Instantly share code, notes, and snippets.

@rionmonster
Last active December 27, 2016 21:20
Show Gist options
  • Save rionmonster/39f33f3903040b59dc404564a27672d6 to your computer and use it in GitHub Desktop.
Save rionmonster/39f33f3903040b59dc404564a27672d6 to your computer and use it in GitHub Desktop.
[HtmlCompletionProvider(CompletionTypes.Values,"*", "class")]
[ContentType(HtmlContentTypeDefinition.HtmlContentType)]
class FooBarClassCompletion : BaseCompletionProvider
{
private static List<string> _classes = new List<string>()
{
"foo",
"bar",
};
public override string CompletionType
{
get { return CompletionTypes.Values; }
}
public override IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
{
var list = new List<HtmlCompletion>();
foreach (var name in _classes)
{
list.Add(CreateItem(name, context.Session));
}
return list;
}
}
abstract class BaseCompletionProvider : IHtmlCompletionListProvider
{
public abstract string CompletionType { get; }
public abstract IList<HtmlCompletion> GetEntries(HtmlCompletionContext context);
protected HtmlCompletion CreateItem(string name, ICompletionSession session)
{
return new HtmlCompletion(name, name, "", null, null, session);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment