aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/rustfmt.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-04-01 17:20:11 +0800
committerGitHub <noreply@github.com>2025-04-01 17:20:11 +0800
commit2322ae403b24699a432a1744e502310e252cb1d3 (patch)
treef1484650b112d6a104831e418d0d502c9a653827 /runtime/autoload/rustfmt.vim
parent7e8b7bba21cfb0a35e442c27aec0ced1b32ce14d (diff)
downloadrneovim-2322ae403b24699a432a1744e502310e252cb1d3.tar.gz
rneovim-2322ae403b24699a432a1744e502310e252cb1d3.tar.bz2
rneovim-2322ae403b24699a432a1744e502310e252cb1d3.zip
vim-patch:4ac995b: runtime(rust): set formatprg to rustfmt (#33245)
closes: vim/vim#16967 https://github.com/vim/vim/commit/4ac995bf9366c6624a0724d19b2226f4c95694b3 Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
Diffstat (limited to 'runtime/autoload/rustfmt.vim')
-rw-r--r--runtime/autoload/rustfmt.vim7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/autoload/rustfmt.vim b/runtime/autoload/rustfmt.vim
index 8fd3858178..f325df2fda 100644
--- a/runtime/autoload/rustfmt.vim
+++ b/runtime/autoload/rustfmt.vim
@@ -1,5 +1,6 @@
" Author: Stephen Sugden <stephen@stephensugden.com>
" Last Modified: 2023-09-11
+" Last Change: 2025 Mar 31 by Vim project (rename s:RustfmtConfigOptions())
"
" Adapted from https://github.com/fatih/vim-go
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
@@ -61,7 +62,7 @@ function! s:RustfmtWriteMode()
endif
endfunction
-function! s:RustfmtConfigOptions()
+function! rustfmt#RustfmtConfigOptions()
let l:rustfmt_toml = findfile('rustfmt.toml', expand('%:p:h') . ';')
if l:rustfmt_toml !=# ''
return '--config-path '.shellescape(fnamemodify(l:rustfmt_toml, ":p"))
@@ -84,7 +85,7 @@ function! s:RustfmtCommandRange(filename, line1, line2)
let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]}
let l:write_mode = s:RustfmtWriteMode()
- let l:rustfmt_config = s:RustfmtConfigOptions()
+ let l:rustfmt_config = rustfmt#RustfmtConfigOptions()
" FIXME: When --file-lines gets to be stable, add version range checking
" accordingly.
@@ -99,7 +100,7 @@ endfunction
function! s:RustfmtCommand()
let write_mode = g:rustfmt_emit_files ? '--emit=stdout' : '--write-mode=display'
- let config = s:RustfmtConfigOptions()
+ let config = rustfmt#RustfmtConfigOptions()
return join([g:rustfmt_command, write_mode, config, g:rustfmt_options])
endfunction