Last active
December 27, 2016 21:20
-
-
Save rionmonster/39f33f3903040b59dc404564a27672d6 to your computer and use it in GitHub Desktop.
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(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