From 0b27ffc93c2b74b47aeb46fa1e256138d956b331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ch=C5=82odnicki?= Date: Sun, 10 May 2020 23:28:14 +0200 Subject: [PATCH] Add settings to disable tooltips and auto complete in settings Resolves #286 --- .gitignore | 3 ++- Package/PackageDev.sublime-settings | 6 ++++++ plugins_/settings/__init__.py | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ce5880b7..cfbd81b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.pyc *.cache +*.mypy_cache *.sublime-project -*.sublime-workspace \ No newline at end of file +*.sublime-workspace diff --git a/Package/PackageDev.sublime-settings b/Package/PackageDev.sublime-settings index 5b7bbb44..afc8629f 100644 --- a/Package/PackageDev.sublime-settings +++ b/Package/PackageDev.sublime-settings @@ -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": [ diff --git a/plugins_/settings/__init__.py b/plugins_/settings/__init__.py index 8d8141b7..97cd09d6 100644 --- a/plugins_/settings/__init__.py +++ b/plugins_/settings/__init__.py @@ -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 @@ -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