sublime-jekyll icon indicating copy to clipboard operation
sublime-jekyll copied to clipboard

Showing Command Palette creates "untitled" document

Open thinkyhead opened this issue 2 years ago • 2 comments
trafficstars

Summary of issue

If Jekyll is enabled, opening the Command Palette in a window with no document causes a new "untitled" window to be created. The Jekyll plugin is probably trying to access active document properties without checking whether an active document exists.

System details

  • macOS 13.5
  • Sublime 4143
  • Jekyll package enabled

Sublime console output

No output.

thinkyhead avatar Jul 22 '23 22:07 thinkyhead

The cause is in determine_path which insists on a document view.

        if not self.window.views():
            view = self.window.new_file()

        else:
            view = self.window.active_view()

        auto = get_setting(view, 'jekyll_auto_find_paths', False)

Replacing with this seems to work fine:

auto = get_setting(self.window.active_view(), 'jekyll_auto_find_paths', False)

thinkyhead avatar Jul 22 '23 23:07 thinkyhead

I'm not in front of a machine to test this change, but it looks fine. Thx for submitting - I'll try and get an updated version out shortly.

https://github.com/23maverick23/sublime-jekyll/blob/master/jekyll.py#L299-L317

23maverick23 avatar Jul 23 '23 02:07 23maverick23