Exemple #1
0
        // Internal for testing
        internal static List <RazorCompletionItem> GetDirectiveCompletionItems(RazorSyntaxTree syntaxTree)
        {
            var directives      = syntaxTree.Options.Directives.Concat(DefaultDirectives);
            var completionItems = new List <RazorCompletionItem>();

            foreach (var directive in directives)
            {
                var completionDisplayText = directive.DisplayName ?? directive.Directive;
                var completionItem        = new RazorCompletionItem(
                    completionDisplayText,
                    directive.Directive,
                    directive.Description,
                    RazorCompletionItemKind.Directive);
                completionItems.Add(completionItem);
            }

            return(completionItems);
        }
Exemple #2
0
        // Internal for testing
        internal static List <RazorCompletionItem> GetDirectiveCompletionItems(RazorSyntaxTree syntaxTree)
        {
            var defaultDirectives = FileKinds.IsComponent(syntaxTree.Options.FileKind) ? Array.Empty <DirectiveDescriptor>() : DefaultDirectives;
            var directives        = syntaxTree.Options.Directives.Concat(defaultDirectives);
            var completionItems   = new List <RazorCompletionItem>();

            foreach (var directive in directives)
            {
                var completionDisplayText = directive.DisplayName ?? directive.Directive;
                var completionItem        = new RazorCompletionItem(
                    completionDisplayText,
                    directive.Directive,
                    directive.Description,
                    RazorCompletionItemKind.Directive);
                completionItems.Add(completionItem);
            }

            return(completionItems);
        }
Exemple #3
0
 private static void AssertRazorCompletionItem(DirectiveDescriptor directive, RazorCompletionItem item) =>
 AssertRazorCompletionItem(directive.Directive, directive, item);
Exemple #4
0
 private static void AssertRazorCompletionItem(string completionDisplayText, DirectiveDescriptor directive, RazorCompletionItem item)
 {
     Assert.Equal(item.DisplayText, completionDisplayText);
     Assert.Equal(item.InsertText, directive.Directive);
     Assert.Equal(directive.Description, item.Description);
 }