This commit is contained in:
Даниил Заикин
2026-06-17 20:44:53 +03:00
parent 9d153773c2
commit b133e7c656
1880 changed files with 244545 additions and 0 deletions
@@ -0,0 +1,58 @@
namespace QFSW.QC
{
/// <summary>
/// Raw suggestion of a given value.
/// </summary>
public class RawSuggestion : IQcSuggestion
{
private readonly string _value;
private readonly bool _singleLiteral;
private readonly string _completion;
public string FullSignature => _value;
public string PrimarySignature => _value;
public string SecondarySignature => string.Empty;
/// <summary>
/// Constructs a suggestion from the provided value.
/// </summary>
/// <param name="value">The value to suggest.</param>
/// <param name="singleLiteral">If the value should be treated as a single literal then "" will be used as necessary.</param>
public RawSuggestion(string value, bool singleLiteral = false)
{
_value = value;
_singleLiteral = singleLiteral;
_completion = _value;
if (_completion.CanSplitScoped(' ', '"', '"'))
{
_completion = $"\"{_completion}\"";
}
}
public bool MatchesPrompt(string prompt)
{
if (_singleLiteral)
{
prompt = prompt.Trim('"');
}
return prompt == _value;
}
public string GetCompletion(string prompt)
{
return _completion;
}
public string GetCompletionTail(string prompt)
{
return string.Empty;
}
public SuggestionContext? GetInnerSuggestionContext(SuggestionContext context)
{
return null;
}
}
}