/// <summary> /// Gets completion data for a given instance /// </summary> /// <param name="instanceName"> /// The identifier of the instance /// <see cref="System.String"/> /// </param> /// <param name="isPointer"> /// Whether the instance in question is a pointer /// <see cref="System.Boolean"/> /// </param> /// <returns> /// Completion data for the instance /// <see cref="CompletionDataList"/> /// </returns> private CompletionDataList GetMembersOfInstance(string instanceName, bool isPointer) { CProject project = Document.Project as CProject; if (project == null) { return(null); } ProjectInformation info = ProjectInformationManager.Instance.Get(project); CompletionDataList list = new CompletionDataList(); list.AutoSelect = false; string container = null; string currentFileName = Document.FileName; bool in_project = false; // Find the typename of the instance foreach (Member li in info.Members) { if (instanceName == li.Name && li.IsPointer == isPointer) { container = li.InstanceType; in_project = true; break; } } // Search included files if (!in_project && info.IncludedFiles.ContainsKey(currentFileName)) { foreach (CBinding.Parser.FileInformation fi in info.IncludedFiles[currentFileName]) { foreach (Member li in fi.Members) { if (instanceName == li.Name && li.IsPointer == isPointer) { container = li.InstanceType; break; } } } } if (null == container) { // Search locals foreach (Local li in info.Locals) { if (instanceName == li.Name && li.IsPointer == isPointer && currentFileName == li.File) { container = li.InstanceType; in_project = true; break; } } } // Not found if (container == null) { return(null); } // Get the LanguageItem corresponding to the typename // and populate completion data accordingly if (in_project) { AddMembersWithParent(list, info.InstanceMembers(), container); } else { foreach (CBinding.Parser.FileInformation fi in info.IncludedFiles[currentFileName]) { AddMembersWithParent(list, fi.InstanceMembers(), container); } } return(list); }