ronantakizawa/codereview-bench huggingface dataset:
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/xtras.lua (Lua)

Code before:
-- Some extras need to be loaded before others
local prios = {
  ["lazyvim.plugins.extras.test.core"] = 1,
  ["lazyvim.plugins.extras.dap.core"] = 1,
  ["lazyvim.plugins.extras.ui.edgy"] = 2,
  ["lazyvim.plugins.extras.lang.typescript"] = 5,
  ["lazyvim.plugins.extras.formatting.prettier"] = 10,
  ["lazyvim.plugins.extras.lang.markdown"] = 10,
  -- default priority is 50
  ["lazyvim.plugins.extras.editor.aerial"] = 100,
  ["lazyvim.plugins.extras.editor.outline"] = 100,
}

---@type string[]
local extras = LazyVim.dedup(LazyVim.config.json.data.extras)

local version = vim.version()
local v = version.major .. "_" .. version.minor

local compat = { "0_9" }

LazyVim.plugin.save_core()
if vim.tbl_contains(compat, v) then
  table.insert(extras, 1, "lazyvim.plugins.compat.nvim-" .. v)
end

table.sort(extras, function(a, b)
  local pa = prios[a] or 50
  local pb = prios[b] or 50
  if pa == pb then
    return a < b
  end
  return pa < pb

Review comment (suggestion):
Not needed I believe? Since you removed the `opts` from `render-markdown` plugin spec? You should also test it out yourself in case I'm mistaken, but that's my assumption.

Code after:
-- Some extras need to be loaded before others
local prios = {
  ["lazyvim.plugins.extras.test.core"] = 1,
  ["lazyvim.plugins.extras.dap.core"] = 1,
  ["lazyvim.plugins.extras.coding.nvim-cmp"] = 2,
  ["lazyvim.plugins.extras.editor.neo-tree"] = 2,
  ["lazyvim.plugins.extras.ui.edgy"] = 3,
  ["lazyvim.plugins.extras.ai.copilot-native"] = 4,
  ["lazyvim.plugins.extras.coding.blink"] = 5,
  ["lazyvim.plugins.extras.lang.typescript"] = 5,
  ["lazyvim.plugins.extras.formatting.prettier"] = 10,
  -- default core extra priority is 20
  -- default priority is 50
  ["lazyvim.plugins.extras.editor.aerial"] = 100,
  ["lazyvim.plugins.extras.editor.outline"] = 100,
  ["lazyvim.plugins.extras.ui.alpha"] = 19,
  ["lazyvim.plugins.extras.ui.dashboard-nvim"] = 19,
  ["lazyvim.plugins.extras.ui.mini-starter"] = 19,
}

if vim.g.xtras_prios then
  prios = vim.tbl_deep_extend("force", prios, vim.g.xtras_prios or {})
end

local extras = {} ---@type string[]
local defaults = LazyVim.config.get_defaults()

local changed = false
local updated = {} ---@type string[]

-- Add extras from LazyExtras that are not disabled
for _, extra in ipairs(LazyVim.config.json.data.extras) do
  if LazyVim.plugin.renamed_extras[extra] then
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/ai/avante.lua (Lua)

Code before:
      },
      {
        -- Make sure to set this up properly if you have lazy=true
        "MeanderingProgrammer/render-markdown.nvim",
        optional = true,
        opts = {
          file_types = { "markdown", "Avante" },
        },
        ft = { "markdown", "Avante" },
      },
      {
        "Kaiser-Yang/blink-cmp-avante",
        lazy = true,
        specs = {
          {
            "saghen/blink.cmp",
            optional = true,
            opts = {
              sources = {
                default = { "avante" },
                providers = { avante = { module = "blink-cmp-avante", name = "Avante" } },
              },
            },
          },
        },
      },
    },
  },
}


Review comment (suggestion):
```suggestion
      {
        "saghen/blink.cmp",
        optional = true,
        dependencies = {
          "Kaiser-Yang/blink-cmp-avante",
        },
        opts = {
          sources = {
            default = { "avante" },
            providers = { avante = { module = "blink-cmp-avante", name = "Avante" } },
          },
        },
      },
```
This will pull in `blink-cmp-avante` even if someone enabled the `coding.nvim-cmp` Extra, which should not be the case. If you change it like this, the dependency will only be pulled when `blink.cmp` is enabled.

Code after:
    },
  },

  -- support for image pasting
  {
    "HakonHarnes/img-clip.nvim",
    event = "VeryLazy",
    optional = true,
    opts = {
      -- recommended settings
      default = {
        embed_image_as_base64 = false,
        prompt_for_file_name = false,
        drag_and_drop = {
          insert_mode = true,
        },
        -- required for Windows users
        use_absolute_path = true,
      },
    },
  },

  -- Make sure to set this up properly if you have lazy=true
  {
    "MeanderingProgrammer/render-markdown.nvim",
    optional = true,
    opts = {
      file_types = { "markdown", "Avante" },
    },
    ft = { "markdown", "Avante" },
  },

  -- blink.cmp source for avante.nvim
  {
    "saghen/blink.cmp",
    optional = true,
    specs = { "Kaiser-Yang/blink-cmp-avante" },
    opts = {
      sources = {
        default = { "avante" },
        providers = { avante = { module = "blink-cmp-avante", name = "Avante" } },
      },
    },
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/formatting/biome.lua (Lua)

Code before:
  "typescriptreact",
  "vue",
  -- "yaml",
}

return {
  {
    "williamboman/mason.nvim",
    opts = { ensure_installed = { "biome" } },
  },

  {
    "stevearc/conform.nvim",
    optional = true,
    ---@param opts ConformOpts
    opts = function(_, opts)
      opts.formatters_by_ft = opts.formatters_by_ft or {}
      for _, ft in ipairs(supported) do
        opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {}
        table.insert(opts.formatters_by_ft[ft], "biome")
      end

      opts.formatters = opts.formatters or {}
      opts.formatters.biome = {
        condition = function(_, ctx)
          return vim.fs.find({ "biome.json", "biome.jsonc" }, { path = ctx.filename, upward = true })[1]
        end,
      }
    end,
  },

  -- none-ls support
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.formatting.biome)
    end,
  },
}


Review comment (suggestion):
You could also use this: https://github.com/stevearc/conform.nvim/blob/6a28c90082a67f62a323ab90d988e000a718a8c7/lua/conform/formatters/biome.lua#L11-L14

And just set:

```lua
opts.formatters.biome = {
  require_cwd = true,
}
```

Code after:
  "typescriptreact",
  "vue",
  -- "yaml",
}

return {
  {
    "williamboman/mason.nvim",
    opts = { ensure_installed = { "biome" } },
  },

  {
    "stevearc/conform.nvim",
    optional = true,
    ---@param opts ConformOpts
    opts = function(_, opts)
      opts.formatters_by_ft = opts.formatters_by_ft or {}
      for _, ft in ipairs(supported) do
        opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {}
        table.insert(opts.formatters_by_ft[ft], "biome")
      end

      opts.formatters = opts.formatters or {}
      opts.formatters.biome = {
        require_cwd = true,
      }
    end,
  },

  -- none-ls support
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.formatting.biome)
    end,
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/ai/codeium.lua (Lua)

Code before:
        group_index = 1,
        priority = 100,
      })
    end,
  },

  {
    "nvim-lualine/lualine.nvim",
    optional = true,
    event = "VeryLazy",
    opts = function(_, opts)
      table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("codeium"))
    end,
  },

  {
    "saghen/blink.cmp",
    optional = true,
    opts = {
      sources = {
        compat = vim.g.ai_cmp and { "codeium" } or nil,
      },
    },
    dependencies = {
      "codeium.nvim",
      vim.g.ai_cmp and { "saghen/blink.compat" } or {},
    },
  },
}


Review comment (suggestion):
@folke Please take a look at [this comment](https://github.com/Saghen/blink.compat/pull/6#discussion_r1828128222). The maintainer of `blink-compat` says that it should not be in `blink.cmp`'s dependencies. And when I tested it, I also put it as a plugin spec on its own, not a dependency. Not sure if it actually affects anything, just thought I should let you know about this.

Code after:
  },

  -- codeium cmp source
  {
    "nvim-cmp",
    optional = true,
    dependencies = { "codeium.nvim" },
    opts = function(_, opts)
      table.insert(opts.sources, 1, {
        name = "codeium",
        group_index = 1,
        priority = 100,
      })
    end,
  },

  {
    "nvim-lualine/lualine.nvim",
    optional = true,
    event = "VeryLazy",
    opts = function(_, opts)
      table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("codeium"))
    end,
  },

  {
    "saghen/blink.cmp",
    optional = true,
    opts = {
      sources = {
        compat = vim.g.ai_cmp and { "codeium" } or nil,
      },
    },
    dependencies = {
      "codeium.nvim",
      vim.g.ai_cmp and "saghen/blink.compat" or nil,
    },
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/twig.lua (Lua)

Code before:
return {
  recommended = {
    ft = "twig",
  },
  {
    "nvim-treesitter/nvim-treesitter",
    opts = { ensure_installed = { "twig" } },
  },
  {
    "williamboman/mason.nvim",
    opts = {
      ensure_installed = {
        "twiggy-language-server",
        "twigcs",
        "twig-cs-fixer",
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        ["twiggy_language_server"] = {
          enabled = true,
        },
      },
    },
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.diagnostics.twigcs)
      -- Twig-CS-Fixer builtin not available in none-ls
    end,
  },

Review comment (bug):
You could remove that, since it's not necessary because the LSP servers that are defined in `nvim-lspconfig` plugin spec get automatically resolved and installed. That will also give you the green light in the current test that's failing.

Code after:
return {
  recommended = function()
    return LazyVim.extras.wants({
      ft = "twig",
    })
  end,
  {
    "nvim-treesitter/nvim-treesitter",
    opts = { ensure_installed = { "twig" } },
  },
  {
    "williamboman/mason.nvim",
    opts = {
      ensure_installed = {
        "twigcs",
        "twig-cs-fixer",
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        twiggy_language_server = {
          enabled = true,
        },
      },
    },
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.diagnostics.twigcs)
      -- Twig-CS-Fixer builtin not available in none-ls
    end,
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/twig.lua (Lua)

Code before:
return {
  recommended = {
    ft = "twig",
  },
  {
    "nvim-treesitter/nvim-treesitter",
    opts = { ensure_installed = { "twig" } },
  },
  {
    "williamboman/mason.nvim",
    opts = {
      ensure_installed = {
        "twiggy-language-server",
        "twigcs",
        "twig-cs-fixer",
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        ["twiggy_language_server"] = {
          enabled = true,
        },
      },
    },
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.diagnostics.twigcs)
      -- Twig-CS-Fixer builtin not available in none-ls
    end,
  },
  {
    "mfussenegger/nvim-lint",
    optional = true,
    opts = {
      linters_by_ft = {
        twig = { "twigcs" },
      },
    },
  },
  {

Review comment (suggestion):
```suggestion
        twiggy_language_server = {
```
should do it because it doesn't contain any invalid string characters to be enclosed in square brackets. Underscores are valid in strings.

Code after:
return {
  recommended = function()
    return LazyVim.extras.wants({
      ft = "twig",
    })
  end,
  {
    "nvim-treesitter/nvim-treesitter",
    opts = { ensure_installed = { "twig" } },
  },
  {
    "williamboman/mason.nvim",
    opts = {
      ensure_installed = {
        "twigcs",
        "twig-cs-fixer",
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        twiggy_language_server = {
          enabled = true,
        },
      },
    },
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.diagnostics.twigcs)
      -- Twig-CS-Fixer builtin not available in none-ls
    end,
  },
  {
    "mfussenegger/nvim-lint",
    optional = true,
    opts = {
      linters_by_ft = {
        twig = { "twigcs" },
      },
    },
  },
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/twig.lua (Lua)

Code before:
return {
  recommended = {
    ft = "twig",
    root = { }
  },
  {
    "nvim-treesitter/nvim-treesitter",
    opts = { ensure_installed = { "twig" } },
  },
  {
    "williamboman/mason.nvim",
    opts = {
      ensure_installed = {
        "twiggy-language-server",
        "twigcs",
        "twig-cs-fixer",
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        ["twiggy_language_server"] = {
          enabled = true,
        },
      },
    },
  },

Review comment (suggestion):
You should at least provide the recommended root by [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/blob/b4d65bce97795438ab6e1974b3672c17a4865e3c/lua/lspconfig/configs/twiggy_language_server.lua#L7). I've no idea if more are needed, since I'm not familiar with php. It's up to you.

Code after:
return {
  recommended = function()
    return LazyVim.extras.wants({
      ft = "twig",
    })
  end,
  {
    "nvim-treesitter/nvim-treesitter",
    opts = { ensure_installed = { "twig" } },
  },
  {
    "williamboman/mason.nvim",
    opts = {
      ensure_installed = {
        "twigcs",
        "twig-cs-fixer",
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        twiggy_language_server = {
          enabled = true,
        },
      },
    },
  },
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/php.lua (Lua)

Code before:
        },
        intelephense = {
          enabled = lsp == "intelephense",
        },
        [lsp] = {
          enabled = true,
        },
      },
    },
  },

  {
    "mason-org/mason.nvim",
    opts = {
      ensure_installed = {
        "phpcs",
        "php-cs-fixer",
      },
    },
  },
  {
    "mfussenegger/nvim-dap",
    optional = true,
    opts = function()
      local dap = require("dap")
      local path = LazyVim.get_pkg_path("php-debug-adapter")
      dap.adapters.php = {
        type = "executable",
        command = "node",
        args = { path .. "/extension/out/phpDebug.js" },
      }
    end,
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.formatting.phpcsfixer)
      table.insert(opts.sources, nls.builtins.diagnostics.phpcs)
    end,
  },
  {
    "mfussenegger/nvim-lint",
    optional = true,
    opts = {
      linters_by_ft = {
        php = { "phpcs" },
      },
    },

Review comment (bug):
This can just be:

```lua
dap.adapters.php = {
  type = "executable",
  command = "php-debug-adapter",
  args = {}
}
```

Code after:
        },
        intelephense = {
          enabled = lsp == "intelephense",
        },
        [lsp] = {
          enabled = true,
        },
      },
    },
  },

  {
    "mason-org/mason.nvim",
    opts = {
      ensure_installed = {
        "phpcs",
        "php-cs-fixer",
      },
    },
  },
  {
    "mfussenegger/nvim-dap",
    optional = true,
    opts = function()
      local dap = require("dap")
      dap.adapters.php = {
        type = "executable",
        command = "php-debug-adapter",
        args = {},
      }
    end,
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.formatting.phpcsfixer)
      table.insert(opts.sources, nls.builtins.diagnostics.phpcs)
    end,
  },
  {
    "mfussenegger/nvim-lint",
    optional = true,
    opts = {
      linters_by_ft = {
        php = { "phpcs" },
      },
    },
  },
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/php.lua (Lua)

Code before:
      servers = {
        phpactor = {
          enabled = lsp == "phpactor",
        },
        intelephense = {
          enabled = lsp == "intelephense",
        },
        [lsp] = {
          enabled = true,
        },
      },
    },
  },

  {
    "mason-org/mason.nvim",
    opts = {
      ensure_installed = {
        "phpcs",
        "php-cs-fixer",
      },
    },
  },
  {
    "mfussenegger/nvim-dap",
    optional = true,
    opts = function()
      local dap = require("dap")
      local path = LazyVim.get_pkg_path("php-debug-adapter")
      dap.adapters.php = {
        type = "executable",
        command = "node",
        args = { path .. "/extension/out/phpDebug.js" },
      }
    end,
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.formatting.phpcsfixer)
      table.insert(opts.sources, nls.builtins.diagnostics.phpcs)
    end,
  },
  {
    "mfussenegger/nvim-lint",
    optional = true,
    opts = {
      linters_by_ft = {

Review comment (bug):
I did a repo search for "php-debug-adapter" and its only occurrence is here, so it isn't added to mason's `ensure_installed` anywhere. Adding it as a spec here, it'll only be installed if both the `dap.core` and `lang.php` extras are installed.

```suggestion
    optional = true,
    specs = {
      {
        "mason-org/mason.nvim",
        opts = {
          ensure_installed = {
            "php-debug-adapter",
          },
        },
      },
    },
```

Code after:
      servers = {
        phpactor = {
          enabled = lsp == "phpactor",
        },
        intelephense = {
          enabled = lsp == "intelephense",
        },
        [lsp] = {
          enabled = true,
        },
      },
    },
  },

  {
    "mason-org/mason.nvim",
    opts = {
      ensure_installed = {
        "phpcs",
        "php-cs-fixer",
      },
    },
  },
  {
    "mfussenegger/nvim-dap",
    optional = true,
    opts = function()
      local dap = require("dap")
      dap.adapters.php = {
        type = "executable",
        command = "php-debug-adapter",
        args = {},
      }
    end,
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = opts.sources or {}
      table.insert(opts.sources, nls.builtins.formatting.phpcsfixer)
      table.insert(opts.sources, nls.builtins.diagnostics.phpcs)
    end,
  },
  {
    "mfussenegger/nvim-lint",
    optional = true,
    opts = {
      linters_by_ft = {
        php = { "phpcs" },
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/haskell.lua (Lua)

Code before:
    version = false,
    ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
    dependencies = {
      { "nvim-telescope/telescope.nvim", optional = true },
    },
    keys = {
      {
        "<leader>ce",
        ft = "haskell",
        "<cmd>HlsEvalAll<cr>",
        desc = "Haskell Evaluate All",
      },
      {
        "<leader>so",
        ft = "haskell",
        function()
          require("haskell-tools").hoogle.hoogle_signature()
        end,
        desc = "Hoogle (Function Signature)",
      },
      {
        "<leader>sO",
        ft = "haskell",
        "<cmd>Telescope hoogle<cr>",
        desc = "Hoogle (Global)",
      },
      {
        "<leader>fl",
        ft = "haskell",
        function()
          require("haskell-tools").repl.toggle()
        end,
        desc = "GHCi REPL (Package)",
      },
      {
        "<leader>fL",
        ft = "haskell",
        function()
          require("haskell-tools").repl.toggle(vim.api.nvim_buf_get_name(0))
        end,
        desc = "GHCi REPL (Current File)",
      },
    },
    config = function()
      local ok, telescope = pcall(require, "telescope")
      if ok then
        telescope.load_extension("ht")
      end
    end,
  },


Review comment (suggestion):
This will potentially throw an error if Telescope is not installed by the user, since you correctly included it as an `optional` dependency.

Code after:
    version = false,
    ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
    keys = {
      {
        "<localleader>e",
        "<cmd>HlsEvalAll<cr>",
        ft = "haskell",
        desc = "Evaluate All",
      },
      {
        "<localleader>h",
        function()
          require("haskell-tools").hoogle.hoogle_signature()
        end,
        ft = "haskell",
        desc = "Hoogle Signature",
      },
      {
        "<localleader>r",
        function()
          require("haskell-tools").repl.toggle()
        end,
        ft = "haskell",
        desc = "REPL (Package)",
      },
      {
        "<localleader>R",
        function()
          require("haskell-tools").repl.toggle(vim.api.nvim_buf_get_name(0))
        end,
        ft = "haskell",
        desc = "REPL (Buffer)",
      },
    },
  },

  {
    "mason-org/mason.nvim",
    opts = { ensure_installed = { "haskell-language-server" } },
  },

  {
    "mfussenegger/nvim-dap",
    optional = true,
    dependencies = {
      {
        "mason-org/mason.nvim",
        opts = { ensure_installed = { "haskell-debug-adapter" } },
      },
    },
  },