Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions autoload/ale/fix/registry.vim
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['clojure'],
\ 'description': 'formatter and linter for clojure files',
\ },
\ 'janet-format': {
\ 'function': 'ale#fixers#janet_format#Fix',
\ 'suggested_filetypes': ['janet'],
\ 'description': 'Formatter for janet files',
\ },
\ 'typstyle': {
\ 'function': 'ale#fixers#typstyle#Fix',
\ 'suggested_filetypes': ['typst'],
Expand Down
13 changes: 13 additions & 0 deletions autoload/ale/fixers/janet_format.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
" Author: David Gouch <dgouch@gmail.com>
" Description: Format with janet-format https://github.com/janet-lang/spork

call ale#Set('janet_janet_format_executable', 'janet-format')

function! ale#fixers#janet_format#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'janet_janet_format_executable')

return {
\ 'command': ale#Escape(l:executable) . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction
19 changes: 19 additions & 0 deletions doc/ale-janet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
===============================================================================
ALE Janet Integration *ale-janet-options*


===============================================================================
janet-format *ale-janet-janet-format*

*ale-options.janet_janet_format_executable*
*g:ale_janet_janet_format_executable*
*b:ale_janet_janet_format_executable*
janet_janet_format_executable
g:ale_janet_janet_format_executable
Type: |String|
Default: `'janet-format'`

This variable sets the executable used for janet-format.

===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
2 changes: 2 additions & 0 deletions doc/ale-supported-languages-and-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ Notes:
* `inko` !!
* ISPC
* `ispc`!!
* Janet
* `janet-format`
* Java
* `PMD`
* `checkstyle`!!
Expand Down
2 changes: 2 additions & 0 deletions doc/ale.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3667,6 +3667,8 @@ documented in additional help files.
inko..................................|ale-inko-inko|
ispc....................................|ale-ispc-options|
ispc..................................|ale-ispc-ispc|
janet...................................|ale-janet-options|
janet-format..........................|ale-janet-janet-format|
java....................................|ale-java-options|
checkstyle............................|ale-java-checkstyle|
clang-format..........................|ale-java-clangformat|
Expand Down
2 changes: 2 additions & 0 deletions supported-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ formatting.
* [inko](https://inko-lang.org/) :floppy_disk:
* ISPC
* [ispc](https://ispc.github.io/) :floppy_disk:
* Janet
* [janet-format](https://github.com/janet-lang/spork)
* Java
* [PMD](https://pmd.github.io/)
* [checkstyle](http://checkstyle.sourceforge.net) :floppy_disk:
Expand Down
19 changes: 19 additions & 0 deletions test/fixers/test_janet_format_fixer_callback.vader
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Before:
call ale#assert#SetUpFixerTest('janet', 'janet-format')

After:
call ale#assert#TearDownFixerTest()

Execute(The janet-format callback should return the correct default values):
AssertFixer {
\ 'command': ale#Escape('janet-format') . ' %t',
\ 'read_temporary_file': 1,
\}

Execute(The janet-format callback should allow a custom executable):
let g:ale_janet_janet_format_executable = '/custom/path/to/janet-format'

AssertFixer {
\ 'command': ale#Escape('/custom/path/to/janet-format') . ' %t',
\ 'read_temporary_file': 1,
\}