Skip to content

Commit

Permalink
cleaned up directory and added \u{...} syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
emekoi committed Jul 7, 2019
1 parent 30df767 commit aeab9e2
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 16 deletions.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions Support/Main.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"id": "preferences",
"children":
[
{
"id": "package-settings",
"children":
[
{
"caption": "Zig",
"children":
[
{
"command": "edit_settings", "args":
{
"base_file": "${packages}/User/Zig.sublime-settings",
"default": "{\n\t$0\n}\n"
},
"caption": "Settings"
},
]
}
]
}
]
}
]
File renamed without changes.
4 changes: 1 addition & 3 deletions Zig.YAML-tmLanguage → Syntaxes/Zig.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ repository:
- name: string.quoted.escape.hexidecimal.zig
match: \\x[a-fA-F0-9]{2}
- name: string.quoted.escape.hexidecimal.zig
match: \\u[a-fA-F0-9]{4}
- name: string.quoted.escape.hexidecimal.zig
match: \\U[a-fA-F0-9]{6}
match: \\u\{[a-fA-F0-9]{1,6}\}
character:
begin: (\')
Expand Down
8 changes: 1 addition & 7 deletions Zig.tmLanguage → Syntaxes/Zig.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,7 @@
</dict>
<dict>
<key>match</key>
<string>\\u[a-fA-F0-9]{4}</string>
<key>name</key>
<string>string.quoted.escape.hexidecimal.zig</string>
</dict>
<dict>
<key>match</key>
<string>\\U[a-fA-F0-9]{6}</string>
<string>\\u\{[a-fA-F0-9]{1,6}\}</string>
<key>name</key>
<string>string.quoted.escape.hexidecimal.zig</string>
</dict>
Expand Down
6 changes: 2 additions & 4 deletions Zig.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ def fmt(fmt, dic):
return fmt

class Zig(sublime_plugin.EventListener):
def on_post_save(self, view):
global_settings = sublime.load_settings(fmt("{package}.sublime-settings", {
"package": self.__class__.__name__,
}))
def on_post_save_async(self, view):
global_settings = sublime.load_settings(fmt("{name}.sublime-settings", { "name": self.__class__.__name__ }))
should_fmt = view.settings().get('fmt.on_save.enabled', global_settings.get('fmt.on_save.enabled'))
if (should_fmt):
view.window().run_command("build", {"variant": "Format File"})
4 changes: 2 additions & 2 deletions Zig.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"zig": "zig",
"fmt.on_save.enabled": false,
"zig.executable": "zig",
"zig.fmt.on_save": true,
}

0 comments on commit aeab9e2

Please sign in to comment.