@@ -155,6 +155,9 @@ def _serialize_completions(self, script, identifier=None, prefix=''):
155155 'raw_type' : '' ,
156156 'rightLabel' : self ._additional_info (signature )
157157 }
158+ _completion ['description' ] = ''
159+ _completion ['raw_docstring' ] = ''
160+
158161 # we pass 'text' here only for fuzzy matcher
159162 if value :
160163 _completion ['snippet' ] = '%s=${1:%s}$0' % (name , value )
@@ -188,6 +191,15 @@ def _serialize_completions(self, script, identifier=None, prefix=''):
188191 'raw_docstring' : completion .docstring (raw = True ),
189192 'rightLabel' : self ._additional_info (completion )
190193 }
194+ for c in _completions :
195+ if c ['text' ] == _completion ['text' ]:
196+ c ['type' ] = _completion ['type' ]
197+ c ['raw_type' ] = _completion ['raw_type' ]
198+ if len (c ['description' ]) == 0 and len (c ['raw_docstring' ]) == 0 :
199+ c ['description' ] = _completion ['description' ]
200+ c ['raw_docstring' ] = _completion ['description' ]
201+
202+
191203 if any ([c ['text' ].split ('=' )[0 ] == _completion ['text' ]
192204 for c in _completions ]):
193205 # ignore function arguments we already have
@@ -388,7 +400,7 @@ def _serialize_tooltip(self, definitions, identifier=None):
388400 if definition .type == 'module' :
389401 signature = definition .full_name
390402 description = definition .docstring (raw = True ).strip ()
391- if not description and not definition . get_line_code ( ):
403+ if not description and hasattr ( definition , ' get_line_code' ):
392404 # jedi returns an empty string for compiled objects
393405 description = definition .docstring ().strip ()
394406 _definition = {
0 commit comments