< Summary

Information
Class: Elsa.Workflows.UIHints.CodeEditor.CodeEditorOptionsProviderBase
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/UIHints/CodeEditor/CodeEditorOptionsProviderBase.cs
Line coverage
91%
Covered lines: 11
Uncovered lines: 1
Coverable lines: 12
Total lines: 41
Line coverage: 91.6%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetUIPropertiesAsync(...)100%11100%
GetCodeEditorOptions(...)100%22100%
GetLanguage(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/UIHints/CodeEditor/CodeEditorOptionsProviderBase.cs

#LineLine coverage
 1using System.Reflection;
 2
 3namespace Elsa.Workflows.UIHints.CodeEditor;
 4
 5/// <summary>
 6/// Provides options for the code editor component.
 7/// </summary>
 8public abstract class CodeEditorOptionsProviderBase : PropertyUIHandlerBase
 9{
 10    /// <inheritdoc />
 11    public override ValueTask<IDictionary<string, object>> GetUIPropertiesAsync(PropertyInfo propertyInfo, object? conte
 12    {
 58213        var codeEditorOptions = GetCodeEditorOptions(propertyInfo, context);
 14
 58215        var options = new Dictionary<string, object>
 58216        {
 58217            [InputUIHints.CodeEditor] = codeEditorOptions
 58218        };
 19
 58220        return new(options);
 21    }
 22
 23    /// <summary>
 24    /// Returns an object containing properties that will be used to render the UI for the property.
 25    /// </summary>
 26    protected virtual CodeEditorOptions GetCodeEditorOptions(PropertyInfo propertyInfo, object? context)
 27    {
 58228        var language = GetLanguage(propertyInfo, context);
 58229        var options = new CodeEditorOptions();
 30
 58231        if (!string.IsNullOrWhiteSpace(language))
 58232            options.Language = language;
 33
 58234        return options;
 35    }
 36
 37    /// <summary>
 38    /// Returns the language to use for syntax highlighting.
 39    /// </summary>
 040    protected virtual string GetLanguage(PropertyInfo propertyInfo, object? context) => "";
 41}