private unsafe IList <CodeCompletion> CodeCompleteAt(uint line, uint column, ICollection <UnsavedFile> unsavedFiles, uint options, out ICollection <Diagnostic> diagnostics) { var nativeCompletions = Interop.clang_codeCompleteAt( Native, Spelling, line, column, unsavedFiles.Select(file => file.Native).ToArray(), (uint)unsavedFiles.Count, options); uint numDiagnostics = Interop.clang_codeCompleteGetNumDiagnostics(nativeCompletions); diagnostics = new List <Diagnostic>((int)numDiagnostics); for (uint i = 0; i < numDiagnostics; ++i) { diagnostics.Add(new Diagnostic(Interop.clang_codeCompleteGetDiagnostic(nativeCompletions, i))); } var completions = new List <CodeCompletion>((int)nativeCompletions->NumResults); for (uint i = 0; i < nativeCompletions->NumResults; ++i) { completions.Add(new CodeCompletion(nativeCompletions->results + i)); } Interop.clang_disposeCodeCompleteResults(nativeCompletions); return(completions); }