summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorGuillermo R. Roig Carralero <groig@users.noreply.github.com>2023-03-26 06:38:24 +0000
committerGitHub <noreply@github.com>2023-03-26 15:38:24 +0900
commit7dbd3c96ac1eb3a1981e740423a31500108f6e25 (patch)
tree83f578aa588edbf7f29c4819e52a940515004441 /autoload
parentfbae1bc1937ce69fa80b4b32d178ce666fd5c07c (diff)
downloadale-7dbd3c96ac1eb3a1981e740423a31500108f6e25.zip
Add support for `rustywind` fixer (#4477)
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/rustywind.vim17
2 files changed, 22 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index b3275a32..f7fff6a7 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -600,6 +600,11 @@ let s:default_registry = {
\ 'function': 'ale#fixers#pycln#Fix',
\ 'suggested_filetypes': ['python'],
\ 'description': 'remove unused python import statements',
+\ },
+\ 'rustywind': {
+\ 'function': 'ale#fixers#rustywind#Fix',
+\ 'suggested_filetypes': ['html'],
+\ 'description': 'Sort Tailwind CSS classes',
\ }
\}
diff --git a/autoload/ale/fixers/rustywind.vim b/autoload/ale/fixers/rustywind.vim
new file mode 100644
index 00000000..5e9bb3c5
--- /dev/null
+++ b/autoload/ale/fixers/rustywind.vim
@@ -0,0 +1,17 @@
+scriptencoding utf-8
+" Author: Guillermo Roig <groig@protonmail.com>
+" Description: Sort TailwindCSS classes with rustywind
+
+call ale#Set('html_rustywind_executable', 'rustywind')
+call ale#Set('html_rustywind_options', '')
+
+function! ale#fixers#rustywind#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'html_rustywind_executable')
+ let l:options = ale#Var(a:buffer, 'html_rustywind_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' --stdin'
+ \}
+endfunction