Skip to content

Commit

Permalink
Fix extension compare and order of evaluation (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser authored Feb 19, 2019
1 parent 97bca41 commit 02543c9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions ApplySyntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def update_extenstions(lst):
ext_map = {}

# Walk the entries
for entry in SETTINGS.get("default_syntaxes", []) + SETTINGS.get("syntaxes", []):
for entry in SETTINGS.get("syntaxes", []) + SETTINGS.get("default_syntaxes", []):
# Grab the extensions from each relevant rule
ext = []
if "extensions" in entry:
Expand Down Expand Up @@ -544,8 +544,9 @@ def extension_matches(self, rule):
extensions = rule.get('extensions', [])
file_name = os.path.basename(self.file_name).lower()
for extension in extensions:
dot_file_match = extension.startswith('.') and extension == file_name
if dot_file_match or file_name.endswith('.' + extension):
ext = extension.lower()
dot_file_match = ext.startswith('.') and ext == file_name
if dot_file_match or file_name.endswith('.' + ext):
match = True
break
return match
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## ApplySyntax 2.5.4

- **FIX**: Fix extension compare and order of evaluation.

## ApplySyntax 2.5.3

- **FIX**: Use proper Bash syntax.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/markdown/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The `extensions` attribute is used to define extensions to apply a syntax to. `

An added benefit of `extensions`, if you are using ST3 and set [`add_exts_to_lang_settings`](#add-extensions-to-language-settings) to `true`, is that ApplySyntax will add the extensions to the specified syntax language's settings file in your `User` folder. By doing this, Sublime Text will be able to show the associated icon for the file type in the sidebar. Apply syntax will also create a file `ApplySyntax.ext-list` in your `User` folder and track which extension it added so that if you remove a rule, ApplySyntax will only remove the extensions it added to the language file in question. If you do not like this functionality, you can simply disable `add_exts_to_lang_settings` by setting it to `false`.

!!! note "Note":
!!! note "Note"
`add_exts_to_lang_settings` will not be applied to `extensions` found in a [project specific rule](#project-specific-rules), as project specific rules are not global, but the effects of `add_exts_to_lang_settings` are global.

### Match
Expand Down
2 changes: 1 addition & 1 deletion support.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import webbrowser
import re

__version__ = "2.5.3"
__version__ = "2.5.4"
__pc_name__ = 'ApplySyntax'

CSS = '''
Expand Down

0 comments on commit 02543c9

Please sign in to comment.