mirror of
https://github.com/neovim/neovim.git
synced 2026-04-25 00:35:36 +00:00
vim-patch:ad0dd7c: runtime(rustfmt): Recover accidentally deleted code, don't hide rustfmt error
closes: vim/vim#19251
ad0dd7cd1e
Co-authored-by: Arkissa <mrarkssac@gmail.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
" Author: Stephen Sugden <stephen@stephensugden.com>
|
||||
" Last Modified: 2023-09-11
|
||||
" Last Change:
|
||||
" 2025 Oct 27 by Vim project don't use rustfmt as 'formatprg' by default
|
||||
" 2025 Oct 27 by Vim project: don't use rustfmt as 'formatprg' by default
|
||||
" 2026 Jan 25 by Vim project: don't hide rustfmt errors, restore default var
|
||||
"
|
||||
"
|
||||
" Adapted from https://github.com/fatih/vim-go
|
||||
@@ -69,6 +70,12 @@ function! s:RustfmtWriteMode()
|
||||
endfunction
|
||||
|
||||
function! s:RustfmtConfigOptions()
|
||||
let default = '--edition 2018'
|
||||
|
||||
if !get(g:, 'rustfmt_find_toml', 0)
|
||||
return default
|
||||
endif
|
||||
|
||||
let l:rustfmt_toml = findfile('rustfmt.toml', expand('%:p:h') . ';')
|
||||
if l:rustfmt_toml !=# ''
|
||||
return '--config-path '.shellescape(fnamemodify(l:rustfmt_toml, ":p"))
|
||||
@@ -199,7 +206,7 @@ function! s:RunRustfmt(command, tmpname, from_writepre)
|
||||
echo "rust.vim: was not able to parse rustfmt messages. Here is the raw output:"
|
||||
echo "\n"
|
||||
for l:line in l:stderr
|
||||
echo l:line
|
||||
echomsg l:line
|
||||
endfor
|
||||
endif
|
||||
|
||||
@@ -218,7 +225,10 @@ function! s:RunRustfmt(command, tmpname, from_writepre)
|
||||
|
||||
" Open lwindow after we have changed back to the previous directory
|
||||
if l:open_lwindow == 1
|
||||
try
|
||||
lwindow
|
||||
catch /^Vim\%((\S\+)\)\=:E776:/
|
||||
endtry
|
||||
endif
|
||||
|
||||
call winrestview(l:view)
|
||||
|
||||
@@ -165,6 +165,12 @@ g:rustfmt_detect_version ~
|
||||
When set to 1, will try to parse the version output from "rustfmt".
|
||||
Disabled by default for performance reasons >vim
|
||||
let g:rustfmt_detect_version = 1
|
||||
<
|
||||
*g:rustfmt_find_toml*
|
||||
g:rustfmt_find_toml ~
|
||||
When set to 1, will try to find `rustfmt.toml` file by searching from
|
||||
current path upwards. Disabled by default for performance reasons >vim
|
||||
let g:rustfmt_find_toml = 1
|
||||
<
|
||||
*g:rust_playpen_url*
|
||||
g:rust_playpen_url ~
|
||||
|
||||
Reference in New Issue
Block a user