Skip to content

Commit

Permalink
no need to write and read temporary file with syntax_tree (#4834)
Browse files Browse the repository at this point in the history
  • Loading branch information
doits authored Oct 14, 2024
1 parent a7ef181 commit 2e5f135
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions autoload/ale/fixers/syntax_tree.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ function! ale#fixers#syntax_tree#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'ruby_syntax_tree_options')

return ale#ruby#EscapeExecutable(l:executable, 'stree')
\ . ' write'
\ . ' format'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction

function! ale#fixers#syntax_tree#Fix(buffer) abort
return {
\ 'command': ale#fixers#syntax_tree#GetCommand(a:buffer),
\ 'read_temporary_file': 1,
\}
endfunction
6 changes: 2 additions & 4 deletions test/fixers/test_syntax_tree_fixer_callback.vader
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ Execute(The syntax_tree callback should return the correct default values):

AssertEqual
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_ruby_syntax_tree_executable)
\ . ' write %t',
\ . ' format %t',
\ },
\ ale#fixers#syntax_tree#Fix(bufnr(''))

Expand All @@ -30,8 +29,7 @@ Execute(The syntax_tree callback should include custom options):

AssertEqual
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_ruby_syntax_tree_executable)
\ . ' write --print-width=100 --plugins=plugin/trailing_comma %t',
\ . ' format --print-width=100 --plugins=plugin/trailing_comma %t',
\ },
\ ale#fixers#syntax_tree#Fix(bufnr(''))

0 comments on commit 2e5f135

Please sign in to comment.