Skip to content

Commit

Permalink
Add settings to disable tooltips and auto complete in settings
Browse files Browse the repository at this point in the history
Resolves #286
  • Loading branch information
rchl authored and FichteFoll committed Aug 29, 2020
1 parent 0739994 commit 0b27ffc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
*.cache
*.mypy_cache
*.sublime-project
*.sublime-workspace
*.sublime-workspace
6 changes: 6 additions & 0 deletions Package/PackageDev.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
// Underline unknown keys in Sublime Settings.
"settings.linting": true,

// Auto complete keys and values in Sublime Settings.
"settings.auto_complete": true,

// Show tooltip with setting description on hovering keys and values.
"settings.tooltip": true,

// List of patterns for color schemes not to be displayed in completions.
// Each color scheme containing one of the list's strings is hidden.
"settings.exclude_color_scheme_patterns": [
Expand Down
4 changes: 4 additions & 0 deletions plugins_/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ def on_query_completions(self, prefix, locations):
tuple ([ [trigger, content], [trigger, content] ], flags):
the tuple with content ST needs to display completions
"""
if not get_setting('settings.auto_complete'):
return
if self.known_settings and len(locations) == 1:
point = locations[0]
self.is_completing_key = False
Expand All @@ -189,6 +191,8 @@ def on_query_completions(self, prefix, locations):

def on_hover(self, point, hover_zone):
"""Sublime Text hover event handler to show tooltip if needed."""
if not get_setting('settings.tooltip'):
return
# not a settings file or not hovering text
if not self.known_settings or hover_zone != sublime.HOVER_TEXT:
return
Expand Down

0 comments on commit 0b27ffc

Please sign in to comment.