diff --git a/functions.py b/functions.py index 172baf23..3fb0078d 100644 --- a/functions.py +++ b/functions.py @@ -1,5 +1,6 @@ import re import weakref +import os import parsing import dynamic # must be before evaluate, because it needs to be loaded first. @@ -7,7 +8,7 @@ import evaluate import modules import debug import imports -import os +import settings __all__ = ['complete', 'goto', 'get_definitions', 'NotFoundError', 'set_debug_function'] @@ -48,27 +49,6 @@ class Completion(object): def get_type(self): return type(self.name.parent()) - def get_vim_type(self): - """ - This is the only function, which is vim specific, it returns the vim - type, see help(complete-items) - """ - typ = self.get_type() - if typ == parsing.Statement: - return 'v' # variable - elif typ == parsing.Function: - return 'f' # function / method - elif typ in [parsing.Class, evaluate.Instance]: - return 't' # typedef -> abused as class - elif typ == parsing.Import: - return 'd' # define -> abused as import - if typ == parsing.Param: - return 'm' # member -> abused as param - else: - debug.dbg('other python type: ', typ) - - return '' - class Definition(object): def __init__(self, definition): @@ -197,7 +177,9 @@ def complete(source, line, column, source_path): completions += s.get_defined_names() completions = [c for c in completions - if c.names[-1].lower().startswith(like.lower())] + if settings.case_insensitive_completion + and c.names[-1].lower().startswith(like.lower()) + or c.names[-1].startswith(like)] needs_dot = not dot and path c = [Completion(c, needs_dot, len(like)) for c in set(completions)] diff --git a/plugin/jedi.vim b/plugin/jedi.vim index ee9e5ea9..83781484 100644 --- a/plugin/jedi.vim +++ b/plugin/jedi.vim @@ -53,7 +53,6 @@ if 1: # stuff directly behind the completion menu=PythonToVimStr(c.description), info=PythonToVimStr(c.doc), # docstr - kind=c.get_vim_type(), # completion type icase=1, # case insensitive dup=1 # allow duplicates (maybe later remove this) ) diff --git a/settings.py b/settings.py index 8cb8cdf3..e27a4bd7 100644 --- a/settings.py +++ b/settings.py @@ -1,3 +1,9 @@ +# ---------------- +# completion output settings +# ---------------- + +case_insensitive_completion = True + # ---------------- # dynamic stuff # ----------------