如何使用 ruff 作为 vim 中的 ALE 修复器

问题描述 投票:0回答:1

我在 vim 中使用 ale,我想添加 ruff 作为 python 的修复程序。

所以,在 .vimrc 中,我添加了:

let g:ale_fixers = {                                                           
\   'python': ['ruff'],                                                    
\   'javascript': ['eslint'],                                              
\   'typescript': ['eslint', 'tsserver', 'typecheck'],                     
\}       

然后,当在 vim 中执行命令 ALEFix 时,出现此错误:

117:未知功能:ale#fixers#ruff#Fix

你知道如何将 ruff 作为 vim 中的修复程序与 ALE 集成吗?

python vim ruff
1个回答
0
投票

https://docs.astral.sh/ruff/editors/setup/#vim,打开“使用 Vim 或 Neovim 的 ALE 插件”。文档显示

" Linter
let g:ale_linters = { "python": ["ruff"] }
" Formatter
let g:ale_fixers = { "python": ["ruff_format"] }
© www.soinside.com 2019 - 2024. All rights reserved.