You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Neovim中用null-ls配置phpcbf/phpcsfixer实现2空格缩进?

PHP/Blade 格式化配置问题(基于null-ls)

我已经查阅两款格式化工具的文档,尝试过不同编码风格及参数配置均未成功。以下是我当前的配置代码片段:

local present, null_ls = pcall(require, "null-ls")

if not present then
    return
end

local b = null_ls.builtins

local sources = {
    --php
    b.formatting.phpcbf.with({
        extra_args = { "--tab-width=2" },
    }),
    -- b.formatting.phpcsfixer.with {
    --   args = { "--no-interaction", "--quiet", "fix", "$FILENAME", "--using-cache=no" },
    -- },
    b.formatting.blade_formatter,
}

null_ls.setup({
    debug = true,
    sources = sources,
})

内容的提问来源于stack exchange,提问作者Rafael Cano

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 08:02:36