facelessuser / ColorHelper

Sublime plugin that provides helpful color previews and tooltips
https://facelessuser.github.io/ColorHelper/
MIT License
254 stars 30 forks source link

ColorHelper fails if no syntax is assigned to output panels. #237

Closed deathaxe closed 1 year ago

deathaxe commented 1 year ago

Description

If an output panel is created without syntax being assigned, ColorHelper raises following exception:

>> p = window.create_output_panel("hello")
Traceback (most recent call last):
  File "C:\Apps\Sublime Text 40xx\Lib\python33\sublime_plugin.py", line 940, in on_activated
    run_view_callbacks('on_activated', view_id)
  File "C:\Apps\Sublime Text 40xx\Lib\python33\sublime_plugin.py", line 708, in run_view_callbacks
    callback(v, *args)
  File "C:\Apps\Sublime Text 40xx\Lib\python33\sublime_plugin.py", line 152, in profiler
    return event_handler(*args)
  File "C:\Apps\Sublime Text 40xx\Data\Installed Packages\ColorHelper.sublime-package\ch_preview.py", line 669, in on_activated
    self.set_file_scan_rules(view)
  File "C:\Apps\Sublime Text 40xx\Data\Installed Packages\ColorHelper.sublime-package\ch_preview.py", line 684, in set_file_scan_rules
    syntax = os.path.splitext(view.settings().get('syntax').replace('Packages/', '', 1))[0]
AttributeError: 'NoneType' object has no attribute 'replace'

Support Info

- ST ver.: 4136
- Platform: windows
- Arch: x64
- Plugin ver.: 6.0.3
- Install via PC: True
- mdpopups ver.: 4.2.2

Steps to Reproduce Issue

  1. Create a new panel by running p = window.create_output_panel("hello") in console.
  2. Open the panel via right click on "Show sidebar" button
  3. Return to console
facelessuser commented 1 year ago

Yep, this is reproducible.