Skip to content

bug: Can't format with Rubocop and keep getting formatter timeout #369

Description

@Lucashdml

Neovim version (nvim -v)

NVIM v0.9.5

Operating system/version

Ubuntu 22.04

Add the debug logs

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

Log file: /home/lucas/.local/state/nvim/conform.log
17:27:33[WARN] No formatters found for /home/lucas/repos/rubyTest/calculo.rb
17:27:36[WARN] No formatters found for /home/lucas/repos/rubyTest/calculo.rb
17:53:10[WARN] Formatter 'rubocop' timeout
18:19:23[WARN] Formatter 'rubocop' timeout
18:21:15[WARN] Formatter 'rubocop' timeout
18:25:07[WARN] Formatter 'rubocop' timeout
18:41:30[WARN] Formatter 'rubocop' timeout
19:43:19[WARN] Formatter 'rubocop' timeout
19:46:15[WARN] Formatter 'rubocop' timeout
19:56:23[WARN] Formatter 'rubocop' timeout
19:56:32[DEBUG] Running formatters on /home/lucas/repos/rubyTest/calculo.rb: { "rubocop" }
19:56:32[INFO] Run rubocop on /home/lucas/repos/rubyTest/calculo.rb
19:56:32[DEBUG] Run command: { "rubocop", "--server", "-a", "-f", "quiet", "--stderr", "--stdin", "/home/lucas/repos/rubyTest/calculo.rb" }
19:56:33[WARN] Formatter 'rubocop' timeout
19:56:33[INFO] rubocop exited with code 143
19:56:33[DEBUG] rubocop stdout: { "" }
19:56:33[DEBUG] rubocop stderr: { "" }

Formatters for this buffer:
LSP: solargraph
rubocop ready (ruby) /home/lucas/.local/share/nvim/mason/bin/rubocop
solargraph unavailable: No config found

Other formatters:
prettier ready (css, javascript, html) /home/lucas/.local/share/nvim/mason/bin/prettier
shfmt ready (sh) /home/lucas/.local/share/nvim/mason/bin/shfmt
stylua ready (lua) /home/lucas/.local/share/nvim/mason/bin/stylua

Describe the bug

I'm trying to use rubocop to format my ruby files, i can run rubocop on the terminal but i get a timeout when running with conform. i use nvchad

What is the severity of this bug?

breaking (some functionality is broken)

Steps To Reproduce

use Rubocop to format a ruby file with conform

Expected Behavior

Format my ruby file

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

this is my config

--type conform.options
local options = {
lsp_fallback = true,

formatters_by_ft = {
lua = { "stylua" },

javascript = { "prettier" },
css = { "prettier" },
html = { "prettier" },

sh = { "shfmt" },

ruby = { "rubocop", "solargraph" },

},

-- adding same formatter for multiple filetypes can look too much work for some
-- instead of the above code you could just use a loop! the config is just a table after all!

format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_fallback = true,
},
}

require("conform").setup(options)

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