From 6122fa204ff5fb8c471dbb3415d331b5104fb4bc Mon Sep 17 00:00:00 2001 From: GreemDev Date: Mon, 28 Jul 2025 17:58:54 -0500 Subject: [PATCH] simplify completion callback --- .../Systems/Starscript/StarscriptTextBoxViewModel.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Ryujinx/Systems/Starscript/StarscriptTextBoxViewModel.cs b/src/Ryujinx/Systems/Starscript/StarscriptTextBoxViewModel.cs index 5a4929dee..38c5b3ca3 100644 --- a/src/Ryujinx/Systems/Starscript/StarscriptTextBoxViewModel.cs +++ b/src/Ryujinx/Systems/Starscript/StarscriptTextBoxViewModel.cs @@ -107,7 +107,9 @@ namespace Ryujinx.Ava.Systems.Starscript public IEnumerable 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) { @@ -119,12 +121,6 @@ namespace Ryujinx.Ava.Systems.Starscript return CurrentSuggestions; } - private CompletionCallback CreateCallback() - { - CurrentSuggestions.Clear(); - - return (result, isFunction) => - CurrentSuggestions.Add(isFunction ? $"{result}(" : result); - } + private void CompletionCallback(string result, bool isFunction) => CurrentSuggestions.Add(isFunction ? $"{result}(" : result); } }