File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ Then add the following to your `.emacs` file:
29
29
(unless (version< emacs-version "24")
30
30
(add-to-list 'load-path "~/path/to/your/zig-mode/")
31
31
(autoload 'zig-mode "zig-mode" nil t)
32
- (add-to-list 'auto-mode-alist '("\\.zig\\'" . zig-mode) ))
32
+ (add-to-list 'auto-mode-alist '("\\.\\( zig\\|zon\\)\\ '" . zig-mode))
33
33
```
34
34
35
35
## Testing
Original file line number Diff line number Diff line change 46
46
:type 'boolean
47
47
:safe #'booleanp )
48
48
49
+ (defcustom zig-ast-check-on-format nil
50
+ " Look for simple compile errors on format."
51
+ :type 'boolean
52
+ :safe #'booleanp )
53
+
49
54
(defcustom zig-zig-bin " zig"
50
55
" Path to zig executable."
51
56
:type 'file
@@ -108,10 +113,11 @@ If given a SOURCE, execute the CMD on it."
108
113
(zig--run-cmd " run" (file-local-name (buffer-file-name )) " -O" zig-run-optimization-mode))
109
114
110
115
; ; zig fmt
111
-
112
116
(reformatter-define zig-format
113
117
:program zig-zig-bin
114
- :args '(" fmt" " --stdin" )
118
+ :args (append '(" fmt" " --stdin" )
119
+ (when (string-match-p " \\ .zon\\ '" buffer-file-name) '(" --zon" ))
120
+ (when zig-ast-check-on-format '(" --ast-check" )))
115
121
:group 'zig-mode
116
122
:lighter " ZigFmt" )
117
123
You can’t perform that action at this time.
0 commit comments