Sublime Forum

My preferences menu item is disabled

#1

This is not the first time I saw this but … I cannot remember what I did to solve it before. I think I quit and restarted but that didn’t work this time.

DEV 3157.

I’ve been sick lately. Could this be the fever finally taking over my brain?

0 Likes

#2

Bummer. Well I guess … a reboot is in order …

0 Likes

#3

And that worked …

0 Likes

#4

Menu items are disabled by default…

They are enabled when the file is loaded ( the menu needs to be closed and re-opened )…

When the item doesn’t become enabled after everything has loaded, check your console for errors - if an error exists in the code ( settings file or python file ) the menu item will remain disabled…

0 Likes

#5

Once again my Preferences menu is disabled.

Nothing I try fixes it. Closing projects, opening other projects, quitting and restarting.

Again - this is the main Sublime Preferences menu. I cannot alter any settings. Is it true that nobody else ever encounters this?

0 Likes

#6

And once again, a reboot solved the problem.

I’d love it if somebody who wrote the code for the main menu of Sublime could just list the reasons the Preferences menu item would be disabled. Everything else functions normally, just that one menu item.

0 Likes

#7





So no, you’re not the only one experiencing it.

0 Likes

#8

Well those were ST2 and I thought … you know … that might be significantly different from ST3.

Meanwhile, here I am again, unable to load my preferences. Again. And only a reboot will help. A reboot … what could that mean?

Tsunami. I think I’ve met you. A long time ago if you use this name elsewhere.

0 Likes

#9

By reboot do you mean PC or sublime text?

I have to frequently restart sublime text for certain changes to take effect in my plugin ( for example if I edit a config file by adding a new entry ) despite moving the addon to Sublime Text ( no longer in a junction )… and… even though I wrote a plugin file reloader ( which reloads files .py for the plugin properly in User\ or plugin folder, and sublime settings but I don’t see a way to reload the settings object to clear it from memory yet so it can be reloaded )…

I recommend using AutoHotkey… Here’s what I do:

;;
;; F16
;;
*~F16::
	;; If Sublime Text is running
	if ( sublime_text.IsRunning( ) )
	{
		;; Close / Exit the process
		sublime_text.CloseApp( )

		;; Play a sound
		notify.ChimeOffSimple( )
	}

	;; Launch, or Relaunch if was running, the App...
	sublime_text.RunApp( )

	;; Play a sound
	notify.ChimeSimple( )

	;; Text to Speech - too much though...
	;; notify.Speak( "SubLime Text Activated" )
return

in library_sublime_text.ahk

;;
;; Sublime Textr Library
;;
class sublime_text
{
	;;
	;; Class Variables..
	;;

	;; If debug mode is enabled, we use text to speech for certain information
	static DEBUG_MODE				:= false

	;; Sublime Text EXE / File-Name
	static SUBLIME_TEXT_FILE		:= "sublime_text.exe"

	;; Sublime Text Install Path
	static SUBLIME_TEXT_PATH		:= "C:\Program Files\Sublime Text 3\"


	;;
	;; Close Sublime Text...
	;;
	CloseApp( _force := false )
	{
		;; If the App is running, try to close it...
		if ( this.IsRunning( ) )
		{
			;;
			_file := this.GetFileName( )

			;; RunWait, tskill Pvxwin32,, Hide UserErrorLevel
			if ( _force )
				RunWait, taskkill /f /t /im %_file%,, Hide UserErrorLevel
			else
				Process, Close, % this.GetFileName( )

			;; The app is running
			return true
		}

		;; The app wasn't running
		return false
	}


	;;
	;; Launch Sublime Text...
	;;
	RunApp( )
	{
		;; Re-Open ST3
		Run, % this.GetFilePath( ) . this.GetFileName( )
	}


	;;
	;; Helper - Determine whether or not Sublime Text is running..
	;;
	IsRunning( )
	{
		;; If the executable is running, return true - otherwise false..
		if WinExist( this.GetExeString( ) )
			return true

		return false
	}


	;;
	;; Helper - Determine whether or not Sublime Text is Running and has focus..
	;;
	IsActive( )
	{
		;; If sublime_text.exe is running, and it is also in-focus - ie it is the active screen / program.. Then return true - otherwise false..
		if this.IsRunning( ) && this.HasFocus( )
			return true

		return false
	}


	;;
	;; Alias of IsActive
	;;
	HasFocus( )
	{
		return WinActive( this.GetExeString( ) )
	}


	;;
	;; Return the Application Executable String..
	;;
	GetFilePath( )
	{
		return this.SUBLIME_TEXT_PATH
	}


	;;
	;; Return the Application Executable String..
	;;
	GetFileName( )
	{
		return this.SUBLIME_TEXT_FILE
	}


	;;
	;; Return the Application Executable String..
	;;
	GetExeString( )
	{
		return "ahk_exe " . this.GetFileName( )
	}
}

I tap M1 G9 2 times to restart… although I am going to switch it back to a single press… I had trouble when I was using WinClose and WinWaitClose functions where the Wait function would cause the script to lock up ( AutoHotkey issue ) - maybe if the window being observed was switched by another function or hotkey??? or something else…

Either way… a single press closes all windows and re-opens with chimes… Although I don’t have that posted here now… so you’d have to remove it…

Edit: Changed to single press… tried spamming it and it works properly now with using the Process close call instead of WinClose…


I’d recommend looking in the console - copy the entire thing and paste it here…

An addon somewhere must be throwing / raising an error / exception or running into another error with the command or before the command is defined…

The commands start disabled and are enabled when the command is initialized ( also is_enabled is a callback used by commands - if that returns false at any given time then it will disable the menu item regardless of if there was an error or not )…

So if you can pull the code for the command in question we can see what the is_enabled function is to see why it is disabling itself for you…

For instance:

##
## Command - Open Syntax Configuration
##
class acms_menu_settings_open_syntax( sublime_plugin.WindowCommand ):
	##
	def description( self ):
		return '[ ACMS ] Settings: Active Syntax'

	## Enables / Disables the menu item based on whether the active / focused file-tab is set...
	def is_enabled( self ):
		return self.window.active_view( ) is not None

	##
	def run( self ):
		## _view = self.window.active_view( )
		## _syntax, _ = os.path.splitext( os.path.basename( _view.settings( ).get( 'syntax' ) ) )
		_default_syntax = '//\n// Acecool - Code Mapping System - Syntax Configuration - ${syntax} - These settings override both User and Default settings for the syntax - User\n//\n{\n\t$0\n}\n'

		##
		self.window.run_command(
			'edit_settings_plus',
			{
			 	'developer':	True,
				##'debugging':	True,

				'base_file':	'${default}/Preferences.sublime-settings', # '${default}/${syntax_path}'
				'user_file':	'${user_syntax}', # '${user}/${syntax}.sublime-settings', # '${user}/${syntax_path}' - User/JavaScript/JSON.sublime-settings for example... # os.path.join( sublime.packages_path( ), 'User', _syntax + '.sublime-settings' )		## 'user_file':	'${syntax}',
				'default':		_default_syntax,
			}
		)

As long as a view / file / tab is not None - the option is enabled… but if I am on an untitled tab which is newly created and that tab returns None as the type ( which isn’t right - but this would be the case for an empty group if that group is focused and no other tab is opened ) then the menu item is disabled…

0 Likes

#10

A user has figured out a reliable way to reproduce this (see Kronuz’ comment from 6/19/18 on the issue tracker).

It seems to be caused by packages containing a large amount of files. There might be other causes as well, but hopefully with at least one reliable way to repro, the devs will come up with a fix.

0 Likes