stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
3.02k stars 156 forks source link

bug: timeout using gq with conform.formatexpr #408

Open chuan137 opened 4 months ago

chuan137 commented 4 months ago

Neovim version (nvim -v)

NVIM v0.9.5 Build type: Release LuaJIT 2.1.1703358377

Operating system/version

MacOs 11.5

Add the debug logs

Log file

      14:41:17[DEBUG] Running formatters on /Users/d067954/SAPDevelop/ccloud/git/openstack/manila/manila/tests/share/test_api.py: { "yapf" }
      14:41:17[INFO] Run yapf on /Users/d067954/SAPDevelop/ccloud/git/openstack/manila/manila/tests/share/test_api.py
      14:41:17[DEBUG] Run command: { "yapf", "--quiet", "--lines", "137-153" }
      14:41:18[WARN] Formatter 'yapf' timeout
      14:41:18[INFO] yapf exited with code 143
      14:41:18[DEBUG] yapf stdout: { "" }
      14:41:18[DEBUG] yapf stderr: { "" }

Describe the bug

format with 'gq' timed out, see log

What is the severity of this bug?

tolerable (can work around it)

Steps To Reproduce

  1. set vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
  2. use 'gq' to format in visual mode.

Expected Behavior

Is it possible to set the timeout_ms option in the formatexpr function?

Minimal example file

No response

Minimal init.lua

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/conform.nvim",
    config = function()
      require("conform").setup({
        log_level = vim.log.levels.DEBUG,
        -- add your config here
      })
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context

No response