Skip to content

bug: cannot format typescript files due to "Error detected while processing BufWritePre Autocommands for "*" " #520

@guoliang

Description

@guoliang

Neovim version (nvim -v)

nvim 0.10.1

Operating system/version

MacOS 14.6.1

Read debugging tips

Add the debug logs

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

Log file

Error detected while processing BufWritePre Autocommands for "*":
Error executing lua callback: ...Cellar/neovim/0.10.1/share/nvim/runtime/lua/vim/glob.lua:79: subcapture nesting too deep
stack traceback:
        [C]: in function 'match'
        ...Cellar/neovim/0.10.1/share/nvim/runtime/lua/vim/glob.lua:79: in function 'to_lpeg'
        ...eovim/0.10.1/share/nvim/runtime/lua/vim/lsp/_dynamic.lua:105: in function 'match'
        ...eovim/0.10.1/share/nvim/runtime/lua/vim/lsp/_dynamic.lua:73: in function 'get'
        ...eovim/0.10.1/share/nvim/runtime/lua/vim/lsp/_dynamic.lua:83: in function 'supports_method'
        .../Cellar/neovim/0.10.1/share/nvim/runtime/lua/vim/lsp.lua:779: in function 'get_clients'
        .../share/nvim/lazy/conform.nvim/lua/conform/lsp_format.lua:49: in function 'get_format_clients'
        ....local/share/nvim/lazy/conform.nvim/lua/conform/init.lua:400: in function 'has_lsp_formatter'
        ....local/share/nvim/lazy/conform.nvim/lua/conform/init.lua:458: in function 'format'

Describe the bug

Exception thrown, when saving angular/typescript files.

Exception still throws even though I have commented out formatters

    formatters_by_ft = {
      lua = { 'stylua' },
      css = { 'prettierd', 'prettier', stop_after_first = true },
      less = { 'prettierd', 'prettier', stop_after_first = true },
      html = { 'prettierd', 'prettier', stop_after_first = true },
      -- javascript = { 'prettierd', 'prettier', stop_after_first = true },
      -- javascriptreact = { 'prettierd', 'prettier', stop_after_first = true },
      json = { 'prettierd', 'prettier', stop_after_first = true },
      markdown = { 'prettierd', 'prettier', stop_after_first = true },
      -- typescript = { 'prettierd', 'prettier', stop_after_first = true },
      -- typescriptreact = { 'prettierd', 'prettier', stop_after_first = true },
      yaml = { 'prettierd', 'prettier', stop_after_first = true },
    },

What is the severity of this bug?

blocking (cannot use plugin)

Steps To Reproduce

  1. with Mason install prettierd, and prettier
  2. create angular project
  3. save any typescript file
  4. see error

Expected Behavior

On save, it should auto format

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

Maybe similar to #393

I already tried to re-install the plugin, I also tried to re-install prettier, and prettierd none seems to help.

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