File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ function! ale#fixers#stylua#GetCwd(buffer) abort
8
8
for l: possible_configfile in [' stylua.toml' , ' .stylua.toml' ]
9
9
let l: config = ale#path#FindNearestFile (a: buffer , l: possible_configfile )
10
10
11
- return ! empty (l: config ) ? fnamemodify (l: config , ' :h' ) : ' %s:h'
11
+ if ! empty (l: config )
12
+ return fnamemodify (l: config , ' :h' )
13
+ endif
12
14
endfor
13
15
14
- return ' '
16
+ return ' %s:h '
15
17
endfunction
16
18
17
19
function ! ale#fixers#stylua#Fix (buffer ) abort
Original file line number Diff line number Diff line change @@ -18,3 +18,23 @@ Execute(The stylua callback should include custom stylua options):
18
18
\ . ' ' . g:ale_lua_stylua_options
19
19
\ . ' --stdin-filepath %s -',
20
20
\ }
21
+
22
+ Execute(stylua should detect stylua.toml):
23
+ call ale#test#SetFilename('../test-files/stylua/stylua_config_dir/subdir/test.lua')
24
+
25
+ AssertFixer
26
+ \ {
27
+ \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/stylua/stylua_config_dir'),
28
+ \ 'command': ale#Escape('stylua')
29
+ \ . ' --stdin-filepath %s -',
30
+ \ }
31
+
32
+ Execute(stylua should detect .stylua.toml):
33
+ call ale#test#SetFilename('../test-files/stylua/stylua_dot_config_dir/subdir/test.lua')
34
+
35
+ AssertFixer
36
+ \ {
37
+ \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/stylua/stylua_dot_config_dir'),
38
+ \ 'command': ale#Escape('stylua')
39
+ \ . ' --stdin-filepath %s -',
40
+ \ }
You can’t perform that action at this time.
0 commit comments