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

Code before:
return {
  recommended = function()
    return LazyVim.extras.wants({
      ft = { "html", "typescript" },
      root = {
        "angular.json",
        "nx.json", --support for nx workspace
      },
    })
  end,

  {
    "nvim-treesitter",
    opts = function(_, opts)
      if type(opts.ensure_installed) == "table" then
        vim.list_extend(opts.ensure_installed, { "angular", "scss" })
      end
    end,
  },

  -- angularls depends on typescript
  { import = "lazyvim.plugins.extras.lang.typescript" },

  -- LSP Servers
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        angularls = {},

Review comment (suggestion):
Can you remove the filetypes here?
Otherwise angular will show up as recommended for any typescript/html file.
Having the root dir detection is enough

Code after:
return {
  recommended = function()
    return LazyVim.extras.wants({
      root = {
        "angular.json",
        "nx.json", --support for nx workspace
      },
    })
  end,

  {
    "nvim-treesitter",
    opts = function(_, opts)
      if type(opts.ensure_installed) == "table" then
        vim.list_extend(opts.ensure_installed, { "angular", "scss" })
      end
    end,
  },

  -- angularls depends on typescript
  { import = "lazyvim.plugins.extras.lang.typescript" },

  -- LSP Servers
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        angularls = {},
      },
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/util/chezmoi.lua (Lua)

Code before:
vim.notify("Hello")
return {
  {
    -- highlighting for chezmoi files template files
    "alker0/chezmoi.vim",
    opts = {
      use_tmp_buffer = true,
      source_dir_path = os.getenv("HOME") .. "/.local/share/chezmoi",
    },
    config = function(_, opts)
      for key, value in pairs(opts) do
        vim.g["chezmoi#" .. key] = value
      end
    end,
  },
  {
    "xvzc/chezmoi.nvim",
    dependencies = { "nvim-lua/plenary.nvim" },
    keys = {
      {
        "<leader>sz",
        function()
          require("telescope").extensions.chezmoi.find_files()
        end,
        desc = "Chezmoi",
      },
    },
    opts = {
      edit = {
        watch = false,
        force = false,
      },
      notification = {
        on_open = true,
        on_apply = true,
        on_watch = false,
      },
      telescope = {
        select = { "<CR>" },

Review comment (suggestion):
`vim.g` variables usually go to the `init` function instead of config because they need to be available before the plugin loads.

Code after:
return {
  {
    -- highlighting for chezmoi files template files
    "alker0/chezmoi.vim",
    init = function()
      vim.g["chezmoi#use_tmp_buffer"] = 1
      vim.g["chezmoi#source_dir_path"] = os.getenv("HOME") .. "/.local/share/chezmoi"
    end,
  },
  {
    "xvzc/chezmoi.nvim",
    keys = {
      {
        "<leader>sz",
        function()
          require("telescope").extensions.chezmoi.find_files()
        end,
        desc = "Chezmoi",
      },
    },
    opts = {
      edit = {
        watch = false,
        force = false,
      },
      notification = {
        on_open = true,
        on_apply = true,
        on_watch = false,
      },
      telescope = {
        select = { "<CR>" },
      },
    },
    init = function()
      -- run chezmoi edit on file enter
      vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
        pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
        callback = function()
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/util/chezmoi.lua (Lua)

Code before:
    opts = {
      edit = {
        watch = false,
        force = false,
      },
      notification = {
        on_open = true,
        on_apply = true,
        on_watch = false,
      },
      telescope = {
        select = { "<CR>" },
      },
    },
    init = function()
      -- run chezmoi edit on file enter
      vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
        pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
        callback = function()
          vim.schedule(require("chezmoi.commands.__edit").watch)
        end,
      })
    end,
    config = function(_, opts)
      require("chezmoi").setup(opts)
    end,
  },
  {
    "nvimdev/dashboard-nvim",
    optional = true,
    opts = function(_, opts)
      local projects = {
        action = "Telescope chezmoi find_files",
        desc = "  Config",
        icon = "",
        key = "c",
      }

      projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc)
      projects.key_format = "  %s"

      -- remove lazyvim config property
      for i = #opts.config.center, 1, -1 do
        if opts.config.center[i].key == "c" then
          table.remove(opts.config.center, i)
        end
      end

      table.insert(opts.config.center, 5, projects)
    end,
  },

Review comment (suggestion):
```suggestion
```
This is not actually required since you already have `opts`. This `config` you do here is the default `config` that `lazy.nvim` will do on its own.

Code after:
        on_apply = true,
        on_watch = false,
      },
      telescope = {
        select = { "<CR>" },
      },
    },
    init = function()
      -- run chezmoi edit on file enter
      vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
        pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
        callback = function()
          vim.schedule(require("chezmoi.commands.__edit").watch)
        end,
      })
    end,
  },
  {
    "nvimdev/dashboard-nvim",
    optional = true,
    opts = function(_, opts)
      local projects = {
        action = "Telescope chezmoi find_files",
        desc = "  Config",
        icon = "",
        key = "c",
      }

      projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc)
      projects.key_format = "  %s"

      -- remove lazyvim config property
      for i = #opts.config.center, 1, -1 do
        if opts.config.center[i].key == "c" then
          table.remove(opts.config.center, i)
        end
      end

      table.insert(opts.config.center, 5, projects)
    end,
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/kotlin.lua (Lua)

Code before:
return {
  -- Add linting, debug adapter, language server
  {
    "williamboman/mason.nvim",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed or {}, {
        "ktlint",
        "kotlin-language-server",
        "kotlin-debug-adapter",
      })
    end,
  },
  -- Add syntax highlighting
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed or {}, { "kotlin" })
    end,
  },
  -- Add language server
  {
    "neovim/nvim-lspconfig",
    dependencies = "williamboman/mason.nvim",
    opts = {
      servers = {
        kotlin_language_server = {},
      },
    },
  },
  -- Add linting
  {
    "mfussenegger/nvim-lint",
    dependencies = "williamboman/mason.nvim",

Review comment (suggestion):
```suggestion
```
I believe this can be removed, as every server that is defined in `nvim-lspconfig.opts.servers` will be automatically installed.

Code after:
return {
  -- Add packages(linting, debug adapter)
  {
    "williamboman/mason.nvim",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed or {}, { "ktlint", "kotlin-debug-adapter" })
    end,
  },
  -- Add syntax highlighting
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed or {}, { "kotlin" })
    end,
  },
  -- Add language server
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        kotlin_language_server = {},
      },
    },
  },
  -- Add linting as optional
  {
    "mfussenegger/nvim-lint",
    optional = true,
    dependencies = "williamboman/mason.nvim",
    opts = {
      linters_by_ft = { kotlin = { "ktlint" } },
    },
  },
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/kotlin.lua (Lua)

Code before:
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed or {}, { "kotlin" })
    end,
  },
  -- Add language server
  {
    "neovim/nvim-lspconfig",
    dependencies = "williamboman/mason.nvim",
    opts = {
      servers = {
        kotlin_language_server = {},
      },
    },
  },
  -- Add linting
  {
    "mfussenegger/nvim-lint",
    dependencies = "williamboman/mason.nvim",
    opts = {
      linters_by_ft = { kotlin = { "ktlint" } },
    },
  },
  -- Add formatting
  {
    "stevearc/conform.nvim",
    dependencies = "williamboman/mason.nvim",
    opts = {
      formatters_by_ft = { kotlin = { "ktlint" } },
    },
  },
  -- Add debugger
  {
    "mfussenegger/nvim-dap",
    dependencies = "williamboman/mason.nvim",

    opts = function()
      local dap = require("dap")
      if not dap.adapters.kotlin then
        require("dap").adapters.kotlin = {
          type = "executable",
          command = "kotlin-debug-adapter",
          options = { auto_continue_if_many_stopped = false },
        }
      end

      dap.configurations.kotlin = {
        {
          type = "kotlin",
          request = "launch",
          name = "This file",
          -- may differ, when in doubt, whatever your project structure may be,

Review comment (suggestion):
```suggestion
    "stevearc/conform.nvim",
    optional = true,
```
`dependencies` are already defined for the plugin. `optional = true` in case someone might choose to use the Extra `none-ls`. It would also be good if you could provide a similar configuration for `none-ls` if possible for formatting.

Code after:
  -- Add language server
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        kotlin_language_server = {},
      },
    },
  },
  -- Add linting as optional
  {
    "mfussenegger/nvim-lint",
    optional = true,
    dependencies = "williamboman/mason.nvim",
    opts = {
      linters_by_ft = { kotlin = { "ktlint" } },
    },
  },
  -- Add formatting as optional
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = { kotlin = { "ktlint" } },
    },
  },
  -- Add formatting and linting as optional
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = vim.list_extend(opts.sources or {}, {
        nls.builtins.formatting.ktlint,
        nls.builtins.diagnostics.ktlint,
      })
    end,
  },
  -- Add debugger
  {
    "mfussenegger/nvim-dap",
    optional = true,
    dependencies = "williamboman/mason.nvim",
    opts = function()
      local dap = require("dap")
      if not dap.adapters.kotlin then
        require("dap").adapters.kotlin = {
          type = "executable",
          command = "kotlin-debug-adapter",
          options = { auto_continue_if_many_stopped = false },
        }
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/kotlin.lua (Lua)

Code before:
return {
  -- Add linting, debug adapter, language server
  {
    "williamboman/mason.nvim",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed or {}, {
        "ktlint",
        "kotlin-language-server",
        "kotlin-debug-adapter",
      })
    end,
  },
  -- Add syntax highlighting
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed or {}, { "kotlin" })
    end,
  },
  -- Add language server
  {
    "neovim/nvim-lspconfig",
    dependencies = "williamboman/mason.nvim",
    opts = {
      servers = {
        kotlin_language_server = {},
      },
    },
  },
  -- Add linting
  {
    "mfussenegger/nvim-lint",
    dependencies = "williamboman/mason.nvim",
    opts = {
      linters_by_ft = { kotlin = { "ktlint" } },
    },
  },
  -- Add formatting
  {
    "stevearc/conform.nvim",
    dependencies = "williamboman/mason.nvim",
    opts = {
      formatters_by_ft = { kotlin = { "ktlint" } },
    },
  },
  -- Add debugger
  {
    "mfussenegger/nvim-dap",

Review comment (suggestion):
```suggestion
```
`dependencies` already defined.

Code after:
return {
  -- Add packages(linting, debug adapter)
  {
    "williamboman/mason.nvim",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed or {}, { "ktlint", "kotlin-debug-adapter" })
    end,
  },
  -- Add syntax highlighting
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed or {}, { "kotlin" })
    end,
  },
  -- Add language server
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        kotlin_language_server = {},
      },
    },
  },
  -- Add linting as optional
  {
    "mfussenegger/nvim-lint",
    optional = true,
    dependencies = "williamboman/mason.nvim",
    opts = {
      linters_by_ft = { kotlin = { "ktlint" } },
    },
  },
  -- Add formatting as optional
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = { kotlin = { "ktlint" } },
    },
  },
  -- Add formatting and linting as optional
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require("null-ls")
      opts.sources = vim.list_extend(opts.sources or {}, {
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/nix.lua (Lua)

Code before:
return {
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      opts.ensure_installed = opts.ensure_installed or {}
      vim.list_extend(opts.ensure_installed, { "nix" })
    end,
  },
  {
    "williamboman/mason.nvim",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed, {
        "nixpkgs-fmt",
        "nil",
      })
    end,
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        ["nil"] = {},
      },
    },
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        nix = { "nixfmt" },
      },
    },
  },
}


Review comment (suggestion):
Both of these concerns (formatter, LSP) have at least two successful, widespread community options and are highly subjective choices, particularly the formatter. I know a lot of folks really like `alejandra` for example and it produces _very_ different outcomes than `nixpkgs-fmt`. For flakes-based projects, IMO it's better to set `outputs.formatter.${system}` to the preferred package and not have an $EDITOR-wide selection at all.

There's also an open RFC attempting to implement a one-true-formatting-standard outcome:

https://github.com/NixOS/rfcs/pull/166

All that to say I don't think having this extra choose one particular option for these concerns is going to satisfy a great cross-section of Nix users.

Code after:
return {
  recommended = {
    ft = "nix",
    root = "flake.nix",
  },
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      opts.ensure_installed = opts.ensure_installed or {}
      vim.list_extend(opts.ensure_installed, { "nix" })
    end,
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        nil_ls = {},
      },
    },
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        nix = { "nixfmt" },
      },
    },
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/nix.lua (Lua)

Code before:
return {
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      opts.ensure_installed = opts.ensure_installed or {}
      vim.list_extend(opts.ensure_installed, { "nix" })
    end,
  },
  {
    "williamboman/mason.nvim",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed, {
        "nixpkgs-fmt",
        "nil",
      })
    end,
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        ["nil"] = {},
      },
    },
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        nix = { "nixfmt" },
      },
    },
  },
}


Review comment (suggestion):
From what I'm seeing in [lspconfig docs](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#nil_ls), the name of the server is `nil_ls`. That also means that you don't need to specify it in Mason any more, since it will be installed automatically when declared in `nvim-lspconfig` configuration.

Code after:
return {
  recommended = {
    ft = "nix",
    root = "flake.nix",
  },
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      opts.ensure_installed = opts.ensure_installed or {}
      vim.list_extend(opts.ensure_installed, { "nix" })
    end,
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        nil_ls = {},
      },
    },
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        nix = { "nixfmt" },
      },
    },
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/nix.lua (Lua)

Code before:
return {
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      opts.ensure_installed = opts.ensure_installed or {}
      vim.list_extend(opts.ensure_installed, { "nix" })
    end,
  },
  {
    "williamboman/mason.nvim",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed, {
        "nil",
      })
    end,
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        nix = { "nixfmt" },
      },
    },
  },
}


Review comment (suggestion):
```suggestion
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        nil_ls = {},
      },
    },
  },
```
This is my suggestion, so that there are no misunderstandings.

Code after:
return {
  recommended = {
    ft = "nix",
    root = "flake.nix",
  },
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      opts.ensure_installed = opts.ensure_installed or {}
      vim.list_extend(opts.ensure_installed, { "nix" })
    end,
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        nil_ls = {},
      },
    },
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        nix = { "nixfmt" },
      },
    },
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/editor/refactoring.lua (Lua)

Code before:
      },
    },
    opts = {
      prompt_func_return_type = {
        go = false,
        java = false,
        cpp = false,
        c = false,
        h = false,
        hpp = false,
        cxx = false,
      },
      prompt_func_param_type = {
        go = false,
        java = false,
        cpp = false,
        c = false,
        h = false,
        hpp = false,
        cxx = false,
      },
      printf_statements = {},
      print_var_statements = {},
    },
    config = function(_, options)
      require("refactoring").setup(options)
      require("telescope").load_extension("refactoring")
    end,
  },
}


Review comment (refactor):
```suggestion
    config = function(_, opts)
      require("refactoring").setup(opts)
```

Code after:
      },
    },
    opts = {
      prompt_func_return_type = {
        go = false,
        java = false,
        cpp = false,
        c = false,
        h = false,
        hpp = false,
        cxx = false,
      },
      prompt_func_param_type = {
        go = false,
        java = false,
        cpp = false,
        c = false,
        h = false,
        hpp = false,
        cxx = false,
      },
      printf_statements = {},
      print_var_statements = {},
    },
    config = function(_, opts)
      require("refactoring").setup(opts)
      if LazyVim.has("telescope.nvim") then
        LazyVim.on_load("telescope.nvim", function()
          require("telescope").load_extension("refactoring")
        end)
      end
    end,
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/editor/refactoring.lua (Lua)

Code before:
    },
    opts = {
      prompt_func_return_type = {
        go = false,
        java = false,
        cpp = false,
        c = false,
        h = false,
        hpp = false,
        cxx = false,
      },
      prompt_func_param_type = {
        go = false,
        java = false,
        cpp = false,
        c = false,
        h = false,
        hpp = false,
        cxx = false,
      },
      printf_statements = {},
      print_var_statements = {},
    },
    config = function(_, options)
      require("refactoring").setup(options)
      require("telescope").load_extension("refactoring")
    end,
  },
}


Review comment (refactor):
```suggestion
      if LazyVim.has("telescope.nvim") then
	      LazyVim.on_load("telescope.nvim", function()	
		      require("telescope").load_extension("refactoring")
		  end)
	  end
```

Code after:
    },
    opts = {
      prompt_func_return_type = {
        go = false,
        java = false,
        cpp = false,
        c = false,
        h = false,
        hpp = false,
        cxx = false,
      },
      prompt_func_param_type = {
        go = false,
        java = false,
        cpp = false,
        c = false,
        h = false,
        hpp = false,
        cxx = false,
      },
      printf_statements = {},
      print_var_statements = {},
    },
    config = function(_, opts)
      require("refactoring").setup(opts)
      if LazyVim.has("telescope.nvim") then
        LazyVim.on_load("telescope.nvim", function()
          require("telescope").load_extension("refactoring")
        end)
      end
    end,
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/sql.lua (Lua)

Code before:
if lazyvim_docs then
  -- Automatically configure connections without needing to manually input them each time.
  vim.g.dbs = {
    dev = "Replace with your database connection URL.",
    staging = "Replace with your database connection URL.",
  }
  -- or
  vim.g.dbs = {
    { name = "dev", url = "Replace with your database connection URL." },
    { name = "staging", url = "Replace with your database connection URL." },
  }

  -- You can set your secrets directly through a Lua table. For example:
  -- Create a secrets/db-env.lua file and return the connection table.
  -- Or
  -- Replace `secrets/db-env` with your own module path.
  local ok, dbs = pcall(require, "secrests/db-env")
  if ok then
    vim.g.dbs = dbs
  else
    vim.g.dbs = {}
  end

  -- Alternatively, you can also use other ways to inject your environment variables.

  -- After all, please make sure to protect your secrets and add them to your `.gitignore` file.
end

local sql_ft = { "sql", "mysql", "plsql" }

return {
  recommended = function()
    return LazyVim.extras.wants({
      ft = sql_ft,
    })
  end,

  {
    "tpope/vim-dadbod",
    cmd = "DB",
  },


Review comment (suggestion):
Maybe refer to a `.lazy.lua` file per project?

```lua
vim.g.dbs {...}

return {}
```


Code after:
if lazyvim_docs then
  -- The setup below will automatically configure connections without the need for manual input each time.

  -- Example configuration using dictionary with keys:
  --    vim.g.dbs = {
  --      dev = "Replace with your database connection URL.",
  --      staging = "Replace with your database connection URL.",
  --    }
  -- or
  -- Example configuration using a list of dictionaries:
  --    vim.g.dbs = {
  --      { name = "dev", url = "Replace with your database connection URL." },
  --      { name = "staging", url = "Replace with your database connection URL." },
  --    }

  -- or
  -- Create a `.lazy.lua` file in your project and set your connections like this:
  -- ```lua
  --    vim.g.dbs = {...}
  --
  --    return {}
  -- ```

  -- Alternatively, you can also use other methods to inject your environment variables.

  -- Finally, please make sure to add `.lazy.lua` to your `.gitignore` file to protect your secrets.
end

local sql_ft = { "sql", "mysql", "plsql" }

return {
  recommended = function()
    return LazyVim.extras.wants({
      ft = sql_ft,
    })
  end,

  {
    "tpope/vim-dadbod",
    cmd = "DB",
  },