@inject ScriptService ScriptService
@inject ModuleService ModuleService
@foreach (var group in Snippets.Select(s => s.Group).Distinct())
{
}
@if (Variables != null && Variables.Any())
{
}
@code {
[Parameter] public string? Value { get; set; }
[Parameter] public EventCallback ValueChanged { get; set; }
[Parameter] public int Height { get; set; } = 500;
[Parameter] public IEnumerable? Variables { get; set; }
[Parameter] public EventCallback OnSave { get; set; }
CodeInput? _codeInput;
IEnumerable Snippets { get; set; } = [];
List _moduleFunctions = new();
protected override void OnInitialized()
{
Snippets = ScriptService.GetSnippets();
_moduleFunctions = ModuleService.GetPublicFunctionCompletions()
.Select(f => new ModuleFunctionCompletion(f.Name, string.IsNullOrWhiteSpace(f.Synopsis) ? null : f.Synopsis, f.Module))
.ToList();
}
public async Task LayoutAsync()
{
if (_codeInput != null)
await _codeInput.LayoutAsync();
}
async Task InsertText(string text)
{
if (_codeInput != null)
await _codeInput.InsertText(text);
}
async Task InsertSnippet(Snippet snippet)
{
if (_codeInput != null)
await _codeInput.InsertSnippet(snippet.Content);
}
}