/// <summary> /// Called at startup. /// Initialize UI system. /// </summary> public IEnumerator Start() { DataFiles.DataHome = Application.dataPath; Parser = new Parser(Ontology, parser => ReplCommands.Commands(parser, this)); Driver.Repl = this; History = new History(this); ConfigurationFiles.UnityPath = Application.dataPath; var generator = PlayerPrefs.GetString("DefinitionsDirectory", null); if (String.IsNullOrEmpty(generator)) { OutputField.text = "No generator selected. Press <b>F1 for help</b>, ESC for menu."; } else { OutputField.text = $"<size=120>Using <b>{Path.GetFileName(generator)}</b> generator.</size>\nPress <b>F1 for help</b>, ESC for menu."; try { Ontology.DefinitionsDirectory = generator; Ontology.Reload(); } catch (Exception e) { Debug.LogException(e); } CheckForLoadErrors(); } // Move keyboard focus to input SelectInput(); return(ScrollToTop()); }
public string[] GetSuggestions(string text, int index) { var matchingKeywords = Scanner.ReservedKeywords .Where(keyword => keyword.Key.StartsWith(text)) .Where(keyword => keyword.Value != TokenType.RESERVED_WORD) .Select(keyword => keyword.Key) .ToList(); matchingKeywords.AddRange( ReplCommands.Where(command => command.StartsWith(text)) ); return(matchingKeywords.ToArray()); }