Add janet-format fixer for Janet (#5142)

This commit is contained in:
David Gouch
2026-07-25 22:22:54 +09:00
committed by GitHub
parent 5fab9dec37
commit 5d4b0881b7
7 changed files with 62 additions and 0 deletions
+5
View File
@@ -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'],
+13
View File
@@ -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
View File
@@ -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:
@@ -329,6 +329,8 @@ Notes:
* `inko` !!
* ISPC
* `ispc`!!
* Janet
* `janet-format`
* Java
* `PMD`
* `checkstyle`!!
+2
View File
@@ -3687,6 +3687,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|
+2
View File
@@ -339,6 +339,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:
@@ -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,
\}