Skip to content

Commit 1c9f17c

Browse files
authored
Fix exception in preview when view has no syntax (#238)
Fixes #237
1 parent 2797626 commit 1c9f17c

File tree

5 files changed

+16
-21
lines changed

5 files changed

+16
-21
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# ColorHelper
22

3+
## 6.1.0
4+
5+
- **NEW**: Update to ColorAide 1.4.
6+
- **FIX**: Fix issue where if a view does not have a syntax it could
7+
cause an exception.
8+
39
## 6.0.3
410

511
- **FIX**: Fix registration of color spaces in custom color objects.

ch_preview.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ def set_file_scan_rules(self, view):
681681
ext = os.path.splitext(file_name)[1].lower() if file_name is not None else None
682682
s = sublime.load_settings('color_helper.sublime-settings')
683683
rules = util.get_settings_rules()
684-
syntax = os.path.splitext(view.settings().get('syntax').replace('Packages/', '', 1))[0]
684+
syntax = os.path.splitext(view.settings().get('syntax', '').replace('Packages/', '', 1))[0]
685685

686686
# Check if view meets criteria for on of our rule sets
687687
matched = False
@@ -795,7 +795,7 @@ def should_update(self, view):
795795
old_ext = rules.get('current_ext')
796796
if ext != old_ext:
797797
force_update = True
798-
syntax = os.path.splitext(view.settings().get('syntax').replace('Packages/', '', 1))[0]
798+
syntax = os.path.splitext(view.settings().get('syntax', '').replace('Packages/', '', 1))[0]
799799
old_syntax = rules.get("current_syntax")
800800
if old_syntax is None or old_syntax != syntax:
801801
force_update = True
@@ -810,7 +810,7 @@ def on_view_settings_change(self, view):
810810
settings = view.settings()
811811
rules = settings.get('color_helper.scan', None)
812812
if rules:
813-
syntax = os.path.splitext(settings.get('syntax').replace('Packages/', '', 1))[0]
813+
syntax = os.path.splitext(settings.get('syntax', '').replace('Packages/', '', 1))[0]
814814
old_syntax = rules.get("current_syntax")
815815
if old_syntax is None or old_syntax != syntax:
816816
self.on_activated(view)

messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"install": "messages/install.md",
3-
"6.0.0": "messages/recent.md"
3+
"6.1.0": "messages/recent.md"
44
}

messages/recent.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ColorHelper 6.0.0
1+
# ColorHelper
22

33
New release!
44

@@ -10,19 +10,8 @@ A restart of Sublime Text is **strongly** encouraged.
1010
Please report any issues as we _might_ have missed some required updates
1111
related to the upgrade to stable `coloraide`.
1212

13-
## 6.0.0
13+
## 6.1.0
1414

15-
> **WARNING**: We finally made it to a stable `coloraide` 1.x.x release,
16-
> but some more unforeseen changes had to be made. This has been a long
17-
> road to get the underlying color library to a stable state.
18-
>
19-
> - User created custom plugins may need refactoring again, but most
20-
> should be unaffected.
21-
> - If you tweaked the new`add_to_default_spaces`, please compare against
22-
> the default list as some plugins were renamed and user settings may
23-
> need to get updated. Color space plugins that do not properly load
24-
> should show log entries in the console.
25-
26-
- **NEW**: Upgraded to the stable `coloraide` 1.1. This should hopefully
27-
eliminate API churn as it is now a stable release.
28-
- **NEW**: Log when default color space loading fails.
15+
- **NEW**: Update to ColorAide 1.4.
16+
- **FIX**: Fix issue where if a view does not have a syntax it could
17+
cause an exception.

support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import webbrowser
66
import re
77

8-
__version__ = "6.0.3"
8+
__version__ = "6.1.0"
99
__pc_name__ = 'ColorHelper'
1010

1111
CSS = '''

0 commit comments

Comments
 (0)