Ok so some good news,
I have narrowed it down now and it had to do with settings initialization. This problem has been bugging me for weeks and I finally cracked it as my completed plugin was just sitting there ready to be released.This was odd because every other setting was being initialized and used throughout the code in exactly the same fashion, and there are quite a few variables and various checks…all working 100%, except this one setting.
For anyone else having this problem how i figured it out was to open and close ST3, then immediately before doing anything else open the console (ctrl-tilde) and run the plugin command to check for errors.
I could then see the plugin was loading correctly, however I was getting a compile error. (yeah i know duh right) but the thing is it was error free in my linter, and error free in ST3 after a save so i just missed it somehow…The fix was to reinitialize my master settings variable inside the class that was being called.
The error I was getting : TypeError: argument of type ‘NoneType’ is not iterable… yet the setting was defined in the settings file as so:
“file_types” : “php”, “htm”, “html”],
And even more strangely, after a save the list variable did become iterable. Say what???
Have a look:
# global settings variable
s = sublime.load_settings("PhpBeautify.sublime-settings")
...
...
...
# HERE IS THE CAUSE #
if ext not in s.get("file_types"):
return False
# ALSO TRIED THIS, DIDN"T WORK #
if ext not in s.get("file_types", 'php', 'html', 'htm']):
return false
# THIS WORKAROUND FIXED THE LOADING ISSUE, HOWEVER NOW THE USER CAN'T SET FILETYPES #
if ext not in 'php', 'html', 'htm']:
return False
#
# What finally worked was "reinitializing" the settings variable using the
# global keyword in my run function, kinda lame as i had already done this elsewhere
# and it means the settings get checked every single time the command is run.
#
# FINAL PRODUCTION FIX #
def run(self, edit, shadow_copy=False, process_directory=False):
global s
s = sublime.load_settings("PhpBeautify.sublime-settings")