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

Function formatResult

plugin/libclang.py:167–194  ·  view source on GitHub ↗
(result)

Source from the content-addressed store, hash-verified

165 return cr
166
167def formatResult(result):
168 completion = dict()
169
170 abbr = getAbbr(result.string)
171 word = filter(lambda x: not x.isKindInformative() and not x.isKindResultType(), result.string)
172
173 args_pos = []
174 cur_pos = 0
175 for chunk in word:
176 chunk_len = len(chunk.spelling)
177 if chunk.isKindPlaceHolder():
178 args_pos += [[ cur_pos, cur_pos + chunk_len ]]
179 cur_pos += chunk_len
180
181 word = "".join(map(lambda x: x.spelling, word))
182
183 completion['word'] = word
184 completion['abbr'] = abbr
185 completion['menu'] = word
186 completion['info'] = word
187 completion['args_pos'] = args_pos
188 completion['dup'] = 0
189
190 # Replace the number that represents a specific kind with a better
191 # textual representation.
192 completion['kind'] = kinds[result.cursorKind]
193
194 return completion
195
196
197class CompleteThread(threading.Thread):

Callers

nothing calls this directly

Calls 4

getAbbrFunction · 0.85
isKindInformativeMethod · 0.80
isKindResultTypeMethod · 0.80
isKindPlaceHolderMethod · 0.80

Tested by

no test coverage detected