Skip to content

Commit 64be2b8

Browse files
committed
Fix syntax error and regen docs after jsonnetfmt #206
1 parent 6548022 commit 64be2b8

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

autoload/codefmt/jsonnetfmt.vim

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ let s:plugin = maktaba#plugin#Get('codefmt')
88
function! codefmt#jsonnetfmt#GetFormatter() abort
99
let l:formatter = {
1010
\ 'name': 'jsonnetfmt',
11-
\ 'setup_instructions': 'Install jsonnet. ' .
12-
\ '(https://jsonnet.org/).'}
11+
\ 'setup_instructions': 'Install jsonnet. (https://jsonnet.org/).'}
1312

1413
function l:formatter.IsAvailable() abort
1514
return executable(s:plugin.Flag('jsonnetfmt_executable'))
1615
endfunction
1716

18-
let l:supported_filetypes = ['json','jsonnet']
17+
let l:supported_filetypes = ['json', 'jsonnet']
1918

2019
function l:formatter.AppliesToBuffer() abort
2120
return index(l:supported_filetypes, &filetype) >= 0
@@ -24,7 +23,6 @@ function! codefmt#jsonnetfmt#GetFormatter() abort
2423
""
2524
" Reformat the current buffer with jsonnetfmt or the binary named in
2625
" @flag(jsonnetfmt_executable)
27-
" @throws ShellError
2826
function l:formatter.Format() abort
2927
let l:cmd = [ s:plugin.Flag('jsonnetfmt_executable') ]
3028
let l:fname = expand('%:p')

doc/codefmt.txt

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The current list of defaults by filetype is:
4444
* java: google-java-format
4545
* javascript, json, html, css: js-beautify
4646
* javascript, html, css, markdown: prettier
47+
* json, jsonnet: jsonnetfmt
4748
* kotlin: ktfmt
4849
* lua: luaformatterfiveone
4950
* nix: nixpkgs-fmt
@@ -141,6 +142,10 @@ Options:
141142
"+some-warning": Add 'some-warning' to the warning set.
142143
Default: '' `
143144

145+
*codefmt:jsonnetfmt_executable*
146+
The path to the jsonnetfmt executable.
147+
Default: 'jsonnetfmt' `
148+
144149
*codefmt:google_java_executable*
145150
The path to the google-java executable. Generally, this should have the form:
146151
`java -jar /path/to/google-java`

plugin/register.vim

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
" * java: google-java-format
3939
" * javascript, json, html, css: js-beautify
4040
" * javascript, html, css, markdown: prettier
41+
" * json, jsonnet: jsonnetfmt
4142
" * kotlin: ktfmt
4243
" * lua: luaformatterfiveone
4344
" * nix: nixpkgs-fmt
@@ -69,7 +70,7 @@ call s:registry.AddExtension(codefmt#fish_indent#GetFormatter())
6970
call s:registry.AddExtension(codefmt#gn#GetFormatter())
7071
call s:registry.AddExtension(codefmt#gofmt#GetFormatter())
7172
call s:registry.AddExtension(codefmt#googlejava#GetFormatter())
72-
call s.registry.AddExtension(codefmt#jsonnetfmt#GetFormatter())
73+
call s:registry.AddExtension(codefmt#jsonnetfmt#GetFormatter())
7374
call s:registry.AddExtension(codefmt#jsbeautify#GetFormatter())
7475
call s:registry.AddExtension(codefmt#prettier#GetFormatter())
7576
call s:registry.AddExtension(codefmt#ktfmt#GetFormatter())

0 commit comments

Comments
 (0)