Closed ratijas closed 3 months ago
Thanks for posting it. I also found this on saving json files.
But I think just assigning self.view = view
in both listeners would be a quick valid solution, in PrettyJsonListeners.py
.
As yours gives me another error on save (which I don't know where it comes from...):
Traceback (most recent call last):
File "D:\Program Files\Sublime Text\Lib\python38\sublime_plugin.py", line 1691, in run_
edit = self.view.begin_edit(edit_token, self.name())
AttributeError: 'NoneType' object has no attribute 'begin_edit'
The view is intended to be provided by the base plugin class instances, so PrettyJsonBaseCommand
is a mixin which has access to the view.
But PrettyJsonLintListener
doesn't have view attribute self.view
, so it cannot pass it to its mixin instance of PrettyJsonBaseCommand
. That's why def on_post_save(self, view):
has view as argument.
So I'd say it's incorrectly inherits from PrettyJsonBaseCommand
and it would need to be redesigned,
maybe using a constructor argument as in your code, but creating an instance from the listener method,
but the commands should also do it, instead of inheriting the mixin.
Anyway, this seems an abandoned project, so I'll use my fork for me, and will create a clone package on package control some day, if someone else doesn't do it until then...
The fact I already forgot about my PR and the fact that it's still not merged is a certified GitHub momentâ„¢
Projects like this should be moved under bigger organizations / umbrellas with a pool of maintainers and on-boarding/off-boarding processes.
This PR is obsolete.
cool, thanks!
Fixed #180