Skip to content

bug: Default timeout_ms does not work with formatexpr() #824

@arkq

Description

@arkq

Neovim version (nvim -v)

NVIM v0.10.4

Operating system/version

Debian GNU/Linux 13 (trixie)

Read debugging tips

Add the debug logs

  • I have set log_level = vim.log.levels.DEBUG and pasted the log contents below.

Log file

N/A

Describe the bug

The M.formatexpr = function(opts) defined in lua/conform/init.lua uses custom default value for timeout_ms. So, when running M.format(opts) the default timeout from default_format_opts is not used.

The workaround that I have:

vim.o.formatexpr = "v:lua.myformatexpr()"
_G.myformatexpr = function()
  require("conform").formatexpr({ timeout_ms = 2000 })
end

What is the severity of this bug?

tolerable (can work around it)

Steps To Reproduce

vim.o.formatexpr = "v:lua.require('conform').formatexpr()"

require("conform").setup({
  default_format_opts = { timeout_ms = 2000 },
})

gq still timeouts after 500 ms.

Expected Behavior

If some values are set in the default_format_opts, they should be used as defaults defaults in the M.formatexpr.

Minimal example file

No response

Minimal init.lua

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions