ronantakizawa/codereview-bench huggingface dataset:
Repository: DioxusLabs/dioxus
File: packages/signals/tests/memo.rs (Rust)

Code before:
    let mut dom = VirtualDom::new(|| {
        let mut signal = use_signal(|| 0);
        let memo = use_memo(move || dbg!(signal() < 2));
        if generation() == 0 {
            assert!(memo());
            signal += 1;
        } else {
            // It should be fine to hold the write and read the memo at the same time
            let mut write = signal.write();
            println!("Memo: {:?}", memo());
            assert!(memo());
            *write = 2;
            drop(write);
            assert!(!memo());
            PASSED.store(true, std::sync::atomic::Ordering::SeqCst);
        }

        rsx! {
            div {}
        }
    });

    dom.rebuild_in_place();
    dom.mark_dirty(ScopeId::APP);
    dom.render_immediate(&mut NoOpMutations);
    assert!(PASSED.load(std::sync::atomic::Ordering::SeqCst));
}


Review comment (suggestion):
```suggestion
    assert!(PASSED.load(Ordering::SeqCst));
```

Code after:
    let mut dom = VirtualDom::new(|| {
        let mut signal = use_signal(|| 0);
        let memo = use_memo(move || dbg!(signal() < 2));
        if generation() == 0 {
            assert!(memo());
            signal += 1;
        } else {
            // It should be fine to hold the write and read the memo at the same time
            let mut write = signal.write();
            println!("Memo: {:?}", memo());
            assert!(memo());
            *write = 2;
            drop(write);
            assert!(!memo());
            PASSED.store(true, std::sync::atomic::Ordering::SeqCst);
        }

        rsx! {
            div {}
        }
    });

    dom.rebuild_in_place();
    dom.mark_dirty(ScopeId::APP);
    dom.render_immediate(&mut NoOpMutations);
    assert!(PASSED.load(Ordering::SeqCst));
}
Repository: DioxusLabs/dioxus
File: packages/web/src/events/drag.rs (Rust)

Code before:
use wasm_bindgen::JsCast;
use web_sys::{DragEvent, MouseEvent};

use super::{Synthetic, WebEventExt};

pub(crate) struct WebDragData {
    drag: Synthetic<DragEvent>,
    mouse: Synthetic<MouseEvent>,
}

impl WebDragData {
    pub fn new(raw: DragEvent) -> Self {
        let mouse = raw
            .clone()
            .dyn_into::<MouseEvent>()
            .expect("Inconceivable! DragEvent is not MouseEvent?");
        Self {
            drag: Synthetic::new(raw),
            mouse: Synthetic::new(mouse),
        }
    }
}

impl HasDragData for WebDragData {
    fn as_any(&self) -> &dyn std::any::Any {
        &self.drag.event as &dyn std::any::Any
    }
}

impl HasMouseData for WebDragData {
    fn as_any(&self) -> &dyn std::any::Any {
        &self.mouse.event as &dyn std::any::Any
    }
}

impl PointerInteraction for WebDragData {
    fn trigger_button(&self) -> Option<dioxus_html::input_data::MouseButton> {
        self.mouse.trigger_button()
    }

    fn held_buttons(&self) -> dioxus_html::input_data::MouseButtonSet {
        self.mouse.held_buttons()
    }
}

impl ModifiersInteraction for WebDragData {
    fn modifiers(&self) -> dioxus_html::prelude::Modifiers {
        self.mouse.modifiers()
    }
}


Review comment (suggestion):
Note that this is no longer simply `self.raw` or `self.drag` as it is now -- it needs to be `self.drag.event` to return the actual web_sys event that is wrapped in Synthetic.

Code after:
        PointerInteraction,
    },
    HasDragData, HasFileData, HasMouseData,
};
use web_sys::DragEvent;

impl InteractionLocation for Synthetic<DragEvent> {
    fn client_coordinates(&self) -> ClientPoint {
        ClientPoint::new(self.event.client_x().into(), self.event.client_y().into())
    }

    fn page_coordinates(&self) -> PagePoint {
        PagePoint::new(self.event.page_x().into(), self.event.page_y().into())
    }

    fn screen_coordinates(&self) -> ScreenPoint {
        ScreenPoint::new(self.event.screen_x().into(), self.event.screen_y().into())
    }
}

impl InteractionElementOffset for Synthetic<DragEvent> {
    fn element_coordinates(&self) -> ElementPoint {
        ElementPoint::new(self.event.offset_x().into(), self.event.offset_y().into())
    }
}

impl ModifiersInteraction for Synthetic<DragEvent> {
    fn modifiers(&self) -> Modifiers {
        let mut modifiers = Modifiers::empty();

        if self.event.alt_key() {
            modifiers.insert(Modifiers::ALT);
        }
        if self.event.ctrl_key() {
            modifiers.insert(Modifiers::CONTROL);
        }
        if self.event.meta_key() {
            modifiers.insert(Modifiers::META);
        }
        if self.event.shift_key() {
            modifiers.insert(Modifiers::SHIFT);
        }

        modifiers
    }
}

impl PointerInteraction for Synthetic<DragEvent> {
    fn held_buttons(&self) -> dioxus_html::input_data::MouseButtonSet {
        decode_mouse_button_set(self.event.buttons())
    }
Repository: DioxusLabs/dioxus
File: packages/cli/src/config/app.rs (Rust)

Code before:
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct ApplicationConfig {
    #[serde(default = "asset_dir_default")]
    pub(crate) asset_dir: PathBuf,

    #[serde(default)]
    pub(crate) sub_package: Option<String>,

    #[serde(default = "out_dir_default")]
    pub(crate) out_dir: PathBuf,
}

pub(crate) fn asset_dir_default() -> PathBuf {
    PathBuf::from("assets")
}

pub(crate) fn out_dir_default() -> PathBuf {
    PathBuf::from("dist")  
}

Review comment (suggestion):
It may break the deployment script due to changing default build artifact directory. How about returning PathBuf for `target/dx`, which is current out directory described in `dioxus_crate.rs:100`

Code after:
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct ApplicationConfig {
    #[serde(default)]
    pub(crate) out_dir: Option<PathBuf>,

    #[serde(default)]
    pub(crate) tailwind_input: Option<PathBuf>,

    #[serde(default)]
    pub(crate) tailwind_output: Option<PathBuf>,

    /// Use this file for the info.plist associated with the iOS app.
    /// `dx` will merge any required settings into this file required to build the app
    #[serde(default)]
    pub(crate) ios_info_plist: Option<PathBuf>,

    /// Use this file for the info.plist associated with the macOS app.
    /// `dx` will merge any required settings into this file required to build the app
    #[serde(default)]
    pub(crate) macos_info_plist: Option<PathBuf>,

    /// Use this file for the entitlements.plist associated with the iOS app.
    #[serde(default)]
    pub(crate) ios_entitlements: Option<PathBuf>,

    /// Use this file for the entitlements.plist associated with the macOS app.
    #[serde(default)]
    pub(crate) macos_entitlements: Option<PathBuf>,

    /// Use this file for the AndroidManifest.xml associated with the Android app.
    /// `dx` will merge any required settings into this file required to build the app
    #[serde(default)]
    pub(crate) android_manifest: Option<PathBuf>,
}
Repository: DioxusLabs/dioxus
File: packages/router/src/hooks/use_route.rs (Rust)

Code before:
///     rsx! {
///         h1 { "App" }
///         Router::<Route> {}
///     }
/// }
///
/// #[component]
/// fn Index() -> Element {
///     let path: Route = use_route();
///     rsx! {
///         h2 { "Current Path" }
///         p { "{path}" }
///     }
/// }
/// #
/// # let mut vdom = VirtualDom::new(App);
/// # vdom.rebuild_in_place();
/// # assert_eq!(dioxus_ssr::render(&vdom), "<h1>App</h1><h2>Current Path</h2><p>/</p>")
/// ```
#[doc(alias = "use_url")]
#[must_use]
pub fn use_route<R: Routable + Clone>() -> R
where
    <R as std::str::FromStr>::Err: std::fmt::Display,
{
    match use_router_internal() {
        Some(r) => r.current(),
        None => {
            panic!("`use_route` must be called in a descendant of a Router component")
        }
    }
}


Review comment (security):
the `<R as std::str::FromStr>...` stuff is infectious to all these APIs. Is there a way we can implement this without having to go around changing all our APIs?

The built-in Rust error type already has the display bound, why can't that just be on the Routable bound implicitly?

We also don't even need to display the error - I imagine developers might want to emit specific error strings rather than let whatever implicit error they're cascading potentially leak sensitive information.

https://doc.rust-lang.org/std/error/trait.Error.html

Code after:
///     rsx! {
///         h1 { "App" }
///         Router::<Route> {}
///     }
/// }
///
/// #[component]
/// fn Index() -> Element {
///     let path: Route = use_route();
///     rsx! {
///         h2 { "Current Path" }
///         p { "{path}" }
///     }
/// }
/// #
/// # let mut vdom = VirtualDom::new(App);
/// # vdom.rebuild_in_place();
/// # assert_eq!(dioxus_ssr::render(&vdom), "<h1>App</h1><h2>Current Path</h2><p>/</p>")
/// ```
#[doc(alias = "use_url")]
#[must_use]
pub fn use_route<R: Routable + Clone>() -> R {
    match use_router_internal() {
        Some(r) => r.current(),
        None => {
            panic!("`use_route` must be called in a descendant of a Router component")
        }
    }
}
Repository: FiloSottile/mkcert
File: main.go (Go)

Code before:
	}

	if m.csrPath != "" {
		m.makeCertFromCSR()
		return
	}

	if len(args) == 0 {
		flag.Usage()
		return
	}

	hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
	for i, name := range args {
		if ip := net.ParseIP(name); ip != nil {
			continue
		}
		if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
			continue
		}
		if uriName, err := url.Parse(name); err == nil && uriName.Scheme != "" && uriName.Host != "" {
			continue
		}
		punycode, err := idna.ToASCII(name)
		if err != nil {
			log.Fatalf("ERROR: %q is not a valid hostname, IP, spiffe URI or email: %s", name, err)
		}
		args[i] = punycode
		if !hostnameRegexp.MatchString(punycode) {
			log.Fatalf("ERROR: %q is not a valid hostname, IP, spiffe URI or email", name)
		}
	}

	m.makeCert(args)
}

func getCAROOT() string {
	if env := os.Getenv("CAROOT"); env != "" {
		return env
	}

	var dir string
	switch {
	case runtime.GOOS == "windows":
		dir = os.Getenv("LocalAppData")
	case os.Getenv("XDG_DATA_HOME") != "":
		dir = os.Getenv("XDG_DATA_HOME")
	case runtime.GOOS == "darwin":
		dir = os.Getenv("HOME")
		if dir == "" {
			return ""

Review comment (suggestion):
```suggestion
			log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email: %s", name, err)
```

Code after:
	}

	if m.csrPath != "" {
		m.makeCertFromCSR()
		return
	}

	if len(args) == 0 {
		flag.Usage()
		return
	}

	hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
	for i, name := range args {
		if ip := net.ParseIP(name); ip != nil {
			continue
		}
		if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
			continue
		}
		if uriName, err := url.Parse(name); err == nil && uriName.Scheme != "" && uriName.Host != "" {
			continue
		}
		punycode, err := idna.ToASCII(name)
		if err != nil {
			log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email: %s", name, err)
		}
		args[i] = punycode
		if !hostnameRegexp.MatchString(punycode) {
			log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email", name)
		}
	}

	m.makeCert(args)
}

func getCAROOT() string {
	if env := os.Getenv("CAROOT"); env != "" {
		return env
	}

	var dir string
	switch {
	case runtime.GOOS == "windows":
		dir = os.Getenv("LocalAppData")
	case os.Getenv("XDG_DATA_HOME") != "":
		dir = os.Getenv("XDG_DATA_HOME")
	case runtime.GOOS == "darwin":
		dir = os.Getenv("HOME")
		if dir == "" {
			return ""
Repository: FiloSottile/mkcert
File: main.go (Go)

Code before:
		return
	}

	if len(args) == 0 {
		flag.Usage()
		return
	}

	hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
	for i, name := range args {
		if ip := net.ParseIP(name); ip != nil {
			continue
		}
		if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
			continue
		}
		if uriName, err := url.Parse(name); err == nil && uriName.Scheme != "" && uriName.Host != "" {
			continue
		}
		punycode, err := idna.ToASCII(name)
		if err != nil {
			log.Fatalf("ERROR: %q is not a valid hostname, IP, spiffe URI or email: %s", name, err)
		}
		args[i] = punycode
		if !hostnameRegexp.MatchString(punycode) {
			log.Fatalf("ERROR: %q is not a valid hostname, IP, spiffe URI or email", name)
		}
	}

	m.makeCert(args)
}

func getCAROOT() string {
	if env := os.Getenv("CAROOT"); env != "" {
		return env
	}

	var dir string
	switch {
	case runtime.GOOS == "windows":
		dir = os.Getenv("LocalAppData")
	case os.Getenv("XDG_DATA_HOME") != "":
		dir = os.Getenv("XDG_DATA_HOME")
	case runtime.GOOS == "darwin":
		dir = os.Getenv("HOME")
		if dir == "" {
			return ""
		}
		dir = filepath.Join(dir, "Library", "Application Support")
	default: // Unix
		dir = os.Getenv("HOME")

Review comment (suggestion):
```suggestion
			log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email", name)
```

Code after:
		return
	}

	if len(args) == 0 {
		flag.Usage()
		return
	}

	hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
	for i, name := range args {
		if ip := net.ParseIP(name); ip != nil {
			continue
		}
		if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
			continue
		}
		if uriName, err := url.Parse(name); err == nil && uriName.Scheme != "" && uriName.Host != "" {
			continue
		}
		punycode, err := idna.ToASCII(name)
		if err != nil {
			log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email: %s", name, err)
		}
		args[i] = punycode
		if !hostnameRegexp.MatchString(punycode) {
			log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email", name)
		}
	}

	m.makeCert(args)
}

func getCAROOT() string {
	if env := os.Getenv("CAROOT"); env != "" {
		return env
	}

	var dir string
	switch {
	case runtime.GOOS == "windows":
		dir = os.Getenv("LocalAppData")
	case os.Getenv("XDG_DATA_HOME") != "":
		dir = os.Getenv("XDG_DATA_HOME")
	case runtime.GOOS == "darwin":
		dir = os.Getenv("HOME")
		if dir == "" {
			return ""
		}
		dir = filepath.Join(dir, "Library", "Application Support")
	default: // Unix
		dir = os.Getenv("HOME")
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/markdown.lua (Lua)

Code before:
  },
  {
    "mfussenegger/nvim-lint",
    optional = true,
    opts = {
      linters_by_ft = {
        markdown = { "markdownlint" },
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        marksman = {},
      },
    },
  },
  {
    "iamcco/markdown-preview.nvim",
    cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
    ft = { "markdown" },
    build = function()
      vim.fn["mkdp#util#install"]()
    end,
  },
}


Review comment (suggestion):
I would suggest `peek.nvim` instead, which is a lua plugin that provides similar functionality, but better in my opinion.

```lua
  -- markdown preview
  {
    "toppair/peek.nvim",
    build = "deno task --quiet build:fast",
    keys = {
      {
        "<leader>cp",
        ft = "markdown",
        function()
          local peek = require("peek")
          if peek.is_open() then
            peek.close()
          else
            peek.open()
          end
        end,
        desc = "Peek (Markdown Preview)",
      },
    },
    opts = { theme = "light" },
  },
```

Code after:
  },
  {
    "mfussenegger/nvim-lint",
    optional = true,
    opts = {
      linters_by_ft = {
        markdown = { "markdownlint" },
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        marksman = {},
      },
    },
  },

  -- Markdown preview
  {
    "iamcco/markdown-preview.nvim",
    cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
    build = function()
      vim.fn["mkdp#util#install"]()
    end,
    keys = {
      {
        "<leader>cp",
        ft = "markdown",
        "<cmd>MarkdownPreviewToggle<cr>",
        desc = "Peek (Markdown Preview)",
      },
    },
    config = function()
      vim.cmd([[do FileType]])
    end,
  },
}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/clojure.lua (Lua)

Code before:
return {
  recommended = function()
    return LazyVim.extras.wants({
      ft = { "clojure", "edn" },
      root = { "project.clj", "deps.edn", "build.boot", "shadow-cljs.edn", "bb.edn" },
    })
  end,

  -- Add Clojure & related to treesitter
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      opts.ensure_installed = opts.ensure_installed or {}
      vim.list_extend(opts.ensure_installed, { "clojure" })
    end,
  },

  -- Extend auto completion
  {
    "hrsh7th/nvim-cmp",
    optional = true,
    dependencies = {
      "PaterJason/cmp-conjure",
    },
    opts = function(_, opts)
      if type(opts.sources) == "table" then
        vim.list_extend(opts.sources, { name = "clojure" })
      end
    end,
  },

  -- Enable rainbow parenthesis
  { "HiPhish/rainbow-delimiters.nvim" },

  -- Add s-exp mappings
  { "PaterJason/nvim-treesitter-sexp" },

  -- Colorize the output of the log buffer
  {
    "m00qek/baleia.nvim",
    config = function()

Review comment (suggestion):
```suggestion
    opts = { ensure_installed = { "clojure" } },
```
With the new changes in `lazy.nvim` this is not needed any more. You can directly use `ensure_installed` without `vim.list_extend`.

Code after:
return {
  recommended = function()
    return LazyVim.extras.wants({
      ft = { "clojure", "edn" },
      root = { "project.clj", "deps.edn", "build.boot", "shadow-cljs.edn", "bb.edn" },
    })
  end,

  -- Add Clojure & related to treesitter
  {
    "nvim-treesitter/nvim-treesitter",
    opts = { ensure_installed = { "clojure" } },
  },

  -- Extend auto completion
  {
    "hrsh7th/nvim-cmp",
    optional = true,
    dependencies = {
      "PaterJason/cmp-conjure",
    },
    opts = function(_, opts)
      if type(opts.sources) == "table" then
        vim.list_extend(opts.sources, { name = "clojure" })
      end
    end,
  },

  -- Enable rainbow parenthesis
  { "HiPhish/rainbow-delimiters.nvim" },

  -- Add s-exp mappings
  { "PaterJason/nvim-treesitter-sexp" },

  -- Colorize the output of the log buffer
  {
    "m00qek/baleia.nvim",
    config = function()
      vim.g.conjure_baleia = require("baleia").setup({ line_starts_at = 3 })

      vim.api.nvim_create_user_command("BaleiaColorize", function()
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/rust.lua (Lua)

Code before:
                runBuildScripts = true,
              },
              -- Add clippy lints for Rust.
              checkOnSave = {
                allFeatures = true,
                command = "clippy",
                extraArgs = { "--no-deps" },
              },
              procMacro = {
                enable = true,
                ignored = {
                  ["async-trait"] = { "async_trait" },
                  ["napi-derive"] = { "napi" },
                  ["async-recursion"] = { "async_recursion" },
                },
              },
            },
          },
        },
        taplo = {
          keys = {
            {
              "K",
              function()
                if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
                  require("crates").show_popup()
                else
                  vim.lsp.buf.hover()
                end
              end,
              desc = "Show Crate Documentation",
            },
          },
        },
      },
      setup = {
        rust_analyzer = function(_, opts)
          local rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim")
          require("rust-tools").setup(vim.tbl_deep_extend("force", rust_tools_opts or {}, { server = opts }))
          return true
        end,
      },
    },
  },

  {
    "nvim-neotest/neotest",
    optional = true,
    dependencies = {
      "rouge8/neotest-rust",
    },

Review comment (suggestion):
This may want to be moved to the `dependencies` section of `mrcjkb/rustaceanvim`. 

Currently rustaceanvim will only use neotest as it's `test_executor` if the `rustaceanvim.neotest` module was loaded prior to rustaceanvim being configured. (https://github.com/mrcjkb/rustaceanvim/blob/4.7.0/lua/rustaceanvim/config/internal.lua#L42-L48)

Code after:
                else
                  vim.lsp.buf.hover()
                end
              end,
              desc = "Show Crate Documentation",
            },
          },
        },
      },
      setup = {
        rust_analyzer = function()
          return true
        end,
      },
    },
  },

  {
    "nvim-neotest/neotest",
    optional = true,
    opts = function(_, opts)
      opts.adapters = opts.adapters or {}
      vim.list_extend(opts.adapters, {
        require('rustaceanvim.neotest'),
      })
    end
  },

}
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/helm.lua (Lua)

Code before:
require("lazyvim.util.lsp").on_attach(function(client, buffer)
  if client.name == "docker_compose_language_service" then
    if vim.api.nvim_buf_get_option(buffer, "filetype") == "helm" then
      vim.schedule(function()
        vim.cmd("LspStop ++force docker_compose_language_service")
      end)
    end
  end
end)

return {
  "towolf/vim-helm",
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        docker_compose_language_service = {},
        helm_ls = {},
      },
    },
  },
}


Review comment (suggestion):
The `require("lazyvim.util.lsp").on_attach` is deprecated. I think it's better to use this instead.

```lua
require("lazyvim.util.lsp").lsp.on_attach
```

Also, the `vim.api.nvim_buf_get_option` is deprecated. My take is to use this.

```lua
vim.api.nvim_get_option_value("filetype", { buf = buffer })
```

Code after:
require("lazyvim.util").lsp.on_attach(function(client, buffer)
  if client.name == "yamlls" then
    if vim.api.nvim_get_option_value("filetype", { buf = buffer }) == "helm" then
      vim.schedule(function()
        vim.cmd("LspStop ++force yamlls")
      end)
    end
  end
end)

return {
  { "towolf/vim-helm", ft = "helm" },
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        yamlls = {},
        helm_ls = {},
      },
    },
  },
  {
    "williamboman/mason.nvim",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed, {
        "helm-ls",
      })
    end,
Repository: LazyVim/LazyVim
File: lua/lazyvim/plugins/extras/lang/gleam.lua (Lua)

Code before:
return {
  {
    "nvim-treesitter/nvim-treesitter",
    opts = function(_, opts)
      if type(opts.ensure_installed) == "table" then
        vim.list_extend(opts.ensure_installed, { "gleam" })
      end
    end,
  },

  {
    "neovim/nvim-lspconfig",
    init = function()
      require("lspconfig").gleam.setup({})
    end,
  },
}


Review comment (suggestion):
```suggestion
	opts = {
    	servers = {
    		gleam = {},
    	},
    },
```
This way the server will also get auto-installed by Mason. 

Code after:
return {
  recommended = {
    ft = "gleam",
    root = "gleam.toml",
  },

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

  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        gleam = {},
      },
    },
  },
}