private string ConstructScintillaAutocompleteList(List<ScriptStruct> onlyMembersOf, bool staticOnly, bool isThis, string onlyIfMatchForThis)
{
List<string> globalsList = new List<string>();
if (onlyMembersOf != null)
{
AddMembersOfStruct(globalsList, onlyMembersOf, staticOnly, isThis);
}
else
{
foreach (string keyword in _keywords)
{
globalsList.Add(keyword);
}
Dictionary<string, object> addedNames = new Dictionary<string, object>();
foreach (IScript script in GetAutoCompleteScriptList())
{
int onlyShowIfDefinitionBeforePos = Int32.MaxValue;
if (script == _autoCompleteForThis)
{
onlyShowIfDefinitionBeforePos = scintillaControl1.CurrentPos;
}
AddGlobalsFromScript(globalsList, script, addedNames, onlyShowIfDefinitionBeforePos);
}
List<ScriptVariable> variables = GetListOfLocalVariablesForCurrentPosition(false);
foreach (ScriptVariable var in variables)
{
globalsList.Add(var.VariableName + "?" + IMAGE_INDEX_LOCAL_VARIABLE);
}
}
if (onlyIfMatchForThis != null)
{
onlyIfMatchForThis = onlyIfMatchForThis.ToLower();
int matchLength = onlyIfMatchForThis.Length;
bool foundMatch = false;
foreach (string entry in globalsList)
{
if (entry.Length >= matchLength)
{
if (entry.Substring(0, matchLength).ToLower() == onlyIfMatchForThis)
{
foundMatch = true;
break;
}
}
}
if (!foundMatch)
{
return string.Empty;
}
}
return ConvertAutocompleteListToScintillaFormat(globalsList);
}