MCPcopy
hub / github.com/xavierd/clang_complete / codeComplete

Method codeComplete

plugin/clang/cindex.py:906–937  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
939class Index(ClangObject):
940 """

Callers 1

Calls 2

readMethod · 0.80

Tested by

no test coverage detected