Sublime Forum

"show_definitions": false not working?

#1

I’m trying out the plugin EasyClangComplete and I’m getting double popups for definition. First the default one and then the plugin one on top. It’s annoying to see the default one for a brief moment before it’s replaced with the plugin one.

Google led me to trying to disable the default one with “show_definitions”: false in my user settings but it stills shows. I’ve tried to disable the EasyClangComplete also but it’s still showing the default definition popup.

Any help or advice on how to proceed would be appreciated.

I’m running build 3210 on OSX. User settings below…

{
	"caret_extra_width": 2,
	"close_windows_when_empty": false,
	"color_scheme": "Packages/Theme - Afterglow/Afterglow-monokai.tmTheme",
	"default_line_ending": "unix",
	"ensure_newline_at_eof_on_save": true,
	"font_size": 12,
	"highlight_line": false,
	"ignored_packages":
	[
		"C Improved",
		"Rust",
		"Vintage"
	],
	"margin": 3,
	"material_theme_accent_scrollbars": false,
	"material_theme_bright_scrollbars": true,
	"material_theme_panel_separator": true,
	"material_theme_small_tab": true,
	"material_theme_tabs_autowidth": true,
	"material_theme_tabs_separator": true,
	"open_files_in_new_window": false,
	"rulers":
	[
		80
	],
	"show_definitions": false,
	"show_encoding": true,
	"show_line_endings": true,
	"tab_size": 4,
	"theme": "Material-Theme-Darker.sublime-theme",
	"translate_tabs_to_spaces": false,
	"trim_trailing_white_space_on_save": false
}
0 Likes

#2

In Default/symbol.py, the on_hover event handler in the ShowDefinitions class starts with a line that stops the hover popup from doing anything if the current view has that setting set:

class ShowDefinitions(sublime_plugin.EventListener):
    def on_hover(self, view, point, hover_zone):
        if not view.settings().get('show_definitions'):
            return

You definitely have the correct setting in your user preferences there, so at first blush it should indeed not display the hover popup when you hover the mouse over a symbol.

If that’s still happening, the most probable reason is that the setting is being overridden elsewhere. As seen in the code, the plugin asks the current file it has the setting turned on, and settings in a view come first from the Preferences.sublime-settings, then from the settings key in the current sublime-project file (if it’s present), and then from syntax specific settings.

As a quick check, while you have the file open and focused, use View > Show Console and enter view.settings().get("show_definitions"); if it responds with True, then something elsewhere is altering the setting.

So if you’re using sublime-project files with your code, you can use Project > Edit Project from the menu and see if there’s a settings key in there that’s overriding it (or move the file out of the window it’s in and see if it still happens).

Or, while you have a file of that type open, choose Preferences > Settings - Syntax Specific to open up the specific settings for files of that type to see if it’s being overridden there.

It’s also possible for plugins to modify settings, so if neither of those are the case it gets a bit trickier to nail down.

If the setting reports False but the default hover popup still appears, the most likely culprits are that there’s some other plugin mimicking the default hover popup or an edit has been made to the default plugin in a way that has removed the check.

That last one is less likely to have happened without you knowing about it, but if you want to check you can use Preferences > Browse Packages and see if there’s a folder named Default with a file named symbol.py inside of it. If there is, moving the file way or renaming it to not have a .py extension and restarting Sublime should solve the problem.

0 Likes

#3

First thanks for the quick and extensive answer.

I’m not really sure why but after executing view.settings().get("show_definitions"); in the console it was clear that the value indeed was True.

After looking around in the Application Support folder I noticed that Local/Session.sublime_session had "show_definitions": true defined and also a package Jedi - Python autocomplete. I suspected the later and disabled the plugin followed by a restart of Sublime but still got the popups.

I then tried issuing view.settings().set('show_definitions', False); in the console and the popups stopped showing. The setting now also seems to be persistent after restarting.

Once again thanks for the help!

1 Like

#4

Glad you resolved your issue!

As an addendum, a shorter way to do something like this specifically is to just close and re-open the file. Settings can be applied in a file-specific way (such as by plugins and also by menu items; say for example if you change the rulers in a file using the menu).

Settings set that way persist for as long as the file is open, and Sublime stores the value in the session when you quit and restart. Closing the file will throw the setting away (though of course if it’s a plugin that is putting the setting there, it may do so again).

0 Likes