Skip to content

Commit

Permalink
Merge remote-tracking branch 'krya/cpln_noise'
Browse files Browse the repository at this point in the history
Conflicts:
	sublime_jedi.sublime-settings
srusskih committed Jan 11, 2014
2 parents 7bd05fd + 4ea4270 commit 7aca93e
Showing 2 changed files with 24 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sublime_jedi.sublime-settings
Original file line number Diff line number Diff line change
@@ -12,6 +12,12 @@
// "" - dont insert any arguments
"auto_complete_function_params": "required",

// "debug", "error", "info", "warn"
"logging_level": "warn"
// "debug", "error", "info", "warn"
"logging_level": "warn",

// what to show in completion list
// all - show all completions ( both jedi's and sublime's )
// jedi - only jedi's
// default - only jedi's in case it has something to show else sublime's
"sublime_completions_visibility": "default"
}
16 changes: 16 additions & 0 deletions sublime_jedi/completion.py
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@

from .utils import is_python_scope, ask_daemon, get_settings
from .console_logging import getLogger
from .settings import get_settings_param

logger = getLogger(__name__)
FOLLOWING_CHARS = set(["\r", "\n", "\t", " ", ")", "]", ";", "}", "\x00"])
@@ -110,6 +111,14 @@ class Autocomplete(sublime_plugin.EventListener):

completions = []
cplns_ready = None
cplns_mode = None

def on_load(self, view):
self.cplns_mode = get_settings_param(
view,
'sublime_completions_visibility',
default='default'
)

def on_query_completions(self, view, prefix, locations):
""" Sublime autocomplete event handler
@@ -138,6 +147,11 @@ def on_query_completions(self, view, prefix, locations):
self.cplns_ready = None
if self.completions:
cplns, self.completions = self.completions, []
if self.cplns_mode in ('default', 'jedi'):
return (
[tuple(i) for i in cplns],
sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
)
return [tuple(i) for i in cplns]
return

@@ -154,6 +168,8 @@ def on_query_completions(self, view, prefix, locations):
if self.cplns_ready is None:
ask_daemon(view, self.show_completions, 'autocomplete', locations[0])
self.cplns_ready = False
if self.cplns_mode == 'jedi':
view.run_command("hide_auto_complete")
return

def show_completions(self, view, completions):

0 comments on commit 7aca93e

Please sign in to comment.