mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-08-01 18:49:05 -06:00
simplify completion callback
This commit is contained in:
@ -107,7 +107,9 @@ namespace Ryujinx.Ava.Systems.Starscript
|
|||||||
|
|
||||||
public IEnumerable<object> GetSuggestions(string input, CancellationToken token)
|
public IEnumerable<object> GetSuggestions(string input, CancellationToken token)
|
||||||
{
|
{
|
||||||
CurrentScriptSource = _hv.ParseAndGetCompletions(input, input.Length, CreateCallback(), token);
|
CurrentSuggestions.Clear();
|
||||||
|
|
||||||
|
CurrentScriptSource = _hv.ParseAndGetCompletions(input, input.Length, CompletionCallback, token);
|
||||||
|
|
||||||
if (CurrentScriptSource.HasErrors)
|
if (CurrentScriptSource.HasErrors)
|
||||||
{
|
{
|
||||||
@ -119,12 +121,6 @@ namespace Ryujinx.Ava.Systems.Starscript
|
|||||||
return CurrentSuggestions;
|
return CurrentSuggestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompletionCallback CreateCallback()
|
private void CompletionCallback(string result, bool isFunction) => CurrentSuggestions.Add(isFunction ? $"{result}(" : result);
|
||||||
{
|
|
||||||
CurrentSuggestions.Clear();
|
|
||||||
|
|
||||||
return (result, isFunction) =>
|
|
||||||
CurrentSuggestions.Add(isFunction ? $"{result}(" : result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user