Code complete in this translation unit. In-memory contents for files can be provided by passing a list of pairs as unsaved_files, the first items should be the filenames to be mapped and the second should be the contents to be substituted for the file. The c
(self, path, line, column, unsaved_files = [], options = 0)
| 904 | unsaved_files_array, |
| 905 | options) |
| 906 | def codeComplete(self, path, line, column, unsaved_files = [], options = 0): |
| 907 | """ |
| 908 | Code complete in this translation unit. |
| 909 | |
| 910 | In-memory contents for files can be provided by passing a list of pairs |
| 911 | as unsaved_files, the first items should be the filenames to be mapped |
| 912 | and the second should be the contents to be substituted for the |
| 913 | file. The contents may be passed as strings or file objects. |
| 914 | """ |
| 915 | unsaved_files_array = 0 |
| 916 | if len(unsaved_files): |
| 917 | unsaved_files_array = (_CXUnsavedFile * len(unsaved_files))() |
| 918 | for i,(name,value) in enumerate(unsaved_files): |
| 919 | if not isinstance(value, str): |
| 920 | # FIXME: It would be great to support an efficient version |
| 921 | # of this, one day. |
| 922 | value = value.read() |
| 923 | print value |
| 924 | if not isinstance(value, str): |
| 925 | raise TypeError,'Unexpected unsaved file contents.' |
| 926 | unsaved_files_array[i].name = name |
| 927 | unsaved_files_array[i].contents = value |
| 928 | unsaved_files_array[i].length = len(value) |
| 929 | ptr = TranslationUnit_codeComplete(self, path, |
| 930 | line, column, |
| 931 | unsaved_files_array, |
| 932 | len(unsaved_files), |
| 933 | options) |
| 934 | if ptr: |
| 935 | return CodeCompletionResults(ptr) |
| 936 | |
| 937 | return None |
| 938 | |
| 939 | class Index(ClangObject): |
| 940 | """ |
no test coverage detected