Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ internal partial class InstantiateCommand : BaseCommand<InstantiateCommandArgs>
{
private static readonly TimeSpan ConstraintEvaluationTimeout = TimeSpan.FromMilliseconds(1000);

internal static IEnumerable<CompletionItem> GetTemplateNameCompletions(string? tempalteName, IEnumerable<TemplateGroup> templateGroups, IEngineEnvironmentSettings environmentSettings)
internal static IEnumerable<CompletionItem> GetTemplateNameCompletions(string? templateName, IEnumerable<TemplateGroup> templateGroups, IEngineEnvironmentSettings environmentSettings)
{
TemplateConstraintManager constraintManager = new(environmentSettings);
if (string.IsNullOrWhiteSpace(tempalteName))
if (string.IsNullOrWhiteSpace(templateName))
{
return GetAllowedTemplateGroups(constraintManager, templateGroups)
.SelectMany(g => g.ShortNames, (g, shortName) => new CompletionItem(shortName, documentation: g.Description))
.Select(g => new CompletionItem(g.ShortNames[0], documentation: g.Description))
.Distinct()
.OrderBy(c => c.Label, StringComparer.OrdinalIgnoreCase)
.ToArray();
}

IEnumerable<TemplateGroup> matchingTemplateGroups = templateGroups.Where(t => t.ShortNames.Any(sn => sn.StartsWith(tempalteName, StringComparison.OrdinalIgnoreCase)));
IEnumerable<TemplateGroup> matchingTemplateGroups =
templateGroups.Where(t => t.ShortNames.Any(sn => sn.StartsWith(templateName, StringComparison.OrdinalIgnoreCase)));

return GetAllowedTemplateGroups(constraintManager, matchingTemplateGroups)
.SelectMany(g => g.ShortNames, (g, shortName) => new CompletionItem(shortName, documentation: g.Description))
.Where(c => c.Label.StartsWith(tempalteName))
.Select(g => new CompletionItem(g.ShortNames.First(sn => sn.StartsWith(templateName, StringComparison.OrdinalIgnoreCase)), documentation: g.Description))
.Distinct()
.OrderBy(c => c.Label, StringComparer.OrdinalIgnoreCase)
.ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@
InsertText: sln,
Documentation: Create an empty solution containing no projects
},
{
Label: solution,
Kind: Value,
SortText: solution,
InsertText: solution,
Documentation: Create an empty solution containing no projects
},
{
Label: tool-manifest,
Kind: Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@
InsertText: sln,
Documentation: Create an empty solution containing no projects
},
{
Label: solution,
Kind: Value,
SortText: solution,
InsertText: solution,
Documentation: Create an empty solution containing no projects
},
{
Label: tool-manifest,
Kind: Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ nunit
nunit-test
page
proto
razor
razorclasslib
razorcomponent
react
sln
solution
tool-manifest
viewimports
viewstart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ nunit
nunit-test
page
proto
razor
razorclasslib
razorcomponent
react
sln
solution
tool-manifest
viewimports
viewstart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ nunit
nunit-test
page
proto
razor
razorclasslib
razorcomponent
react
sln
solution
tool-manifest
viewimports
viewstart
Expand Down