mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
vim shows now docstrings also correct
This commit is contained in:
@@ -133,8 +133,6 @@ class Scope(Simple):
|
|||||||
""" Clean up a docstring """
|
""" Clean up a docstring """
|
||||||
self.docstr = cleandoc(literal_eval(string))
|
self.docstr = cleandoc(literal_eval(string))
|
||||||
debug.dbg("Scope(%s)::docstr = %s" % (self, self.docstr))
|
debug.dbg("Scope(%s)::docstr = %s" % (self, self.docstr))
|
||||||
if self.get_parent_until().path != '__builtin__':
|
|
||||||
print self, self.docstr
|
|
||||||
|
|
||||||
def add_import(self, imp):
|
def add_import(self, imp):
|
||||||
self.imports.append(imp)
|
self.imports.append(imp)
|
||||||
@@ -1265,8 +1263,6 @@ class PyFuzzyParser(object):
|
|||||||
if not string:
|
if not string:
|
||||||
return None, tok
|
return None, tok
|
||||||
#print 'new_stat', string, set_vars, used_funcs, used_vars
|
#print 'new_stat', string, set_vars, used_funcs, used_vars
|
||||||
#if self.freshscope and self.get_parent_until().path != '__builtin__':
|
|
||||||
#print self, self.docstr
|
|
||||||
if self.freshscope and len(tok_list) == 1 \
|
if self.freshscope and len(tok_list) == 1 \
|
||||||
and self.last_token[0] == tokenize.STRING:
|
and self.last_token[0] == tokenize.STRING:
|
||||||
self.scope.add_docstr(self.last_token[1])
|
self.scope.add_docstr(self.last_token[1])
|
||||||
|
|||||||
@@ -51,9 +51,8 @@ if 1:
|
|||||||
d = dict(word=str(c),
|
d = dict(word=str(c),
|
||||||
abbr=str(c),
|
abbr=str(c),
|
||||||
# stuff directly behind the completion
|
# stuff directly behind the completion
|
||||||
# TODO change it so that ' are allowed (not used now, because of repr)
|
menu=PythonToVimStr(c.description),
|
||||||
menu=c.description.replace("'", '"'),
|
info=PythonToVimStr(c.help), # docstr
|
||||||
info=c.help, # docstr and similar stuff
|
|
||||||
kind=c.get_vim_type(), # completion type
|
kind=c.get_vim_type(), # completion type
|
||||||
icase=1, # case insensitive
|
icase=1, # case insensitive
|
||||||
dup=1, # allow duplicates (maybe later remove this)
|
dup=1, # allow duplicates (maybe later remove this)
|
||||||
@@ -198,6 +197,12 @@ import traceback # for exception output
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
import functions
|
import functions
|
||||||
|
|
||||||
|
class PythonToVimStr(str):
|
||||||
|
""" Vim has a different string implementation of single quotes """
|
||||||
|
__slots__ = []
|
||||||
|
def __repr__(self):
|
||||||
|
return '"%s"' % self.replace('"', r'\"')
|
||||||
PYTHONEOF
|
PYTHONEOF
|
||||||
|
|
||||||
" vim: set et ts=4:
|
" vim: set et ts=4:
|
||||||
|
|||||||
Reference in New Issue
Block a user