lazyvim/lua/lazyvim/plugins/extras/lang
Iordanis Petkakis 773f28b491
fix(mason): migrate to mason v2 (#6053)
## Description
`mason-lspconfig` v2 made changes to conform with latest Neovim
`vim.lsp.config`/`vim.lsp.enable` API.

- Lock `mason` and `mason-lspconfig` to v1 versions for Neovim <0.11 and
latest HEAD for Neovim >=0.11.
- Change `:get_install_path()` method in LazyVim to use
`LazyVim.get_pkg_path()` and also update name references to new ones.
- Change `nvim-lspconfig` from `LazyFile` to `{ "BufReadPre",
"BufNewFile", "BufWritePre" }` for Neovim >=0.11, since on `BufReadPost`
the LSP would not attach on the first buffer. Previously the
`setup.handlers()` function from `mason-lspconfig` would take care of
that, but that has been removed on v2. I fail to think if there's a
better way to handle this.

Most of the changes in `/lsp/init.lua` are thanks to @williamboman
comment
[here](https://github.com/LazyVim/LazyVim/pull/6041#issuecomment-2857266471).

I've also seen that both `mason-lspconfig` and `rustaceanvim` now have
as minimum requirements Neovim >=0.11.
As such I would suggest, instead of all the conditional checks for
Neovim versions to create a stable release where we pin `mason` and
`mason-lspconfig` to v1 versions and then only incorporate William's
suggestions in a new release and mention in the README that users who
are on Neovim <0.11 should use the stable release where the plugin
versions are pinned to v1. Not sure how you want to tackle this, so this
is merely just a suggestion from my part.

Both #6041 and #6045 tackle only with the new name references and the
offending line that was causing the error, but don't take into
consideration the LSP servers configurations. `opts.setup` would not
execute on both, since that was handled by `setup_handlers()` function
in the past. I checked with Typescript lang and with those PRs there are
no Javascript settings in `vtsls` (by checking with
`:=LazyVim.opts("nvim-lspconfig").servers.vtsls`).
#6045 also tried to change the method `:get_install_pkg()` by using
`vim.fn.exepath`, but to my understanding that only returns the binary
path not the package installation path and that is later concatenated to
find other paths, which I believe is not correct.

PS: There are 2 commits, because my LazyVim fork was not up to date and
updated it and then merged the branch I had into a new branch. Sorry if
that causes any inconvenience.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
Fixes #6039
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
Co-authored-by: William Boman <william@redwill.se>
Co-authored-by: Luis Durão <kpvrzlzzx@mozmail.com>
2025-09-15 12:08:19 +02:00
..
angular.lua feat(lang.angular): configure prettier as formatter for angular templates (#4345) 2024-11-08 13:45:53 +01:00
ansible.lua fix(mason): rename and pin to v1 2025-05-12 10:39:04 +02:00
astro.lua fix(vue): ensure css treesitter installed (#4308) 2024-09-18 08:22:05 +02:00
clangd.lua fix(mason): rename and pin to v1 2025-05-12 10:39:04 +02:00
clojure.lua fix(clojure): removed rainbow delimiters and fixed some plugin setups. Closes #3530 2024-06-07 23:10:40 +02:00
cmake.lua refactor: use lazy's new opts_extend functionality for treesitter and mason 2024-06-07 09:03:59 +02:00
docker.lua refactor: use lazy's new opts_extend functionality for treesitter and mason 2024-06-07 09:03:59 +02:00
elixir.lua feat(elixir): add support for livebook files (*.livemd) (#4184) 2024-11-08 14:10:11 +01:00
elm.lua fix(mason): rename and pin to v1 2025-05-12 10:39:04 +02:00
erlang.lua feat(erlang): add Erlang language (#3911) 2024-07-04 20:47:33 +02:00
git.lua fix: fqn for nvim-cmp 2024-12-12 14:45:47 +01:00
gleam.lua refactor: use lazy's new opts_extend functionality for treesitter and mason 2024-06-07 09:03:59 +02:00
go.lua fix(mini): update mini plugin references from echasnovski to nvim-mini (#6374) 2025-09-15 11:45:00 +02:00
haskell.lua fix(mason): rename and pin to v1 2025-05-12 10:39:04 +02:00
helm.lua fix(helm): missing dependency (#3546) 2024-06-09 07:33:59 +02:00
java.lua fix(mason): migrate to mason v2 (#6053) 2025-09-15 12:08:19 +02:00
json.lua refactor: use lazy's new opts_extend functionality for treesitter and mason 2024-06-07 09:03:59 +02:00
kotlin.lua fix(mason): rename and pin to v1 2025-05-12 10:39:04 +02:00
lean.lua fix(extras): rename lspconfig.server_configurations to lspconfig.configs (#4518) 2024-10-02 09:24:02 +02:00
markdown.lua fix(mason): rename and pin to v1 2025-05-12 10:39:04 +02:00
nix.lua refactor: use lazy's new opts_extend functionality for treesitter and mason 2024-06-07 09:03:59 +02:00
nushell.lua feat(extras.nushell): update to upstream treesitter (#4715) 2024-11-07 16:11:59 +01:00
ocaml.lua fix(ocaml): get_language_id (#4327) 2024-09-18 08:20:43 +02:00
omnisharp.lua fix(mason): rename and pin to v1 2025-05-12 10:39:04 +02:00
php.lua fix(mason): migrate to mason v2 (#6053) 2025-09-15 12:08:19 +02:00
prisma.lua feat(extra): add prisma support and config (#3684) 2024-06-18 19:03:19 +02:00
python.lua fix(lang.python): enable venv-selector even when telescope is not available (#5829) 2025-09-15 07:18:00 +02:00
r.lua fix(lang/r): make keymaps in which-key menu available in visual mode (#4565) 2024-11-08 13:26:31 +01:00
rego.lua feat(extras): rego language support (#4297) 2024-11-08 13:44:59 +01:00
ruby.lua refactor: remove all <0.11 compat code 2025-09-15 11:16:53 +02:00
rust.lua fix(mason): migrate to mason v2 (#6053) 2025-09-15 12:08:19 +02:00
scala.lua feat(scala): add key for worksheet hover (#3853) 2024-11-08 14:09:17 +01:00
sql.lua fix(mason): rename and pin to v1 2025-05-12 10:39:04 +02:00
svelte.lua refactor: remove all <0.11 compat code 2025-09-15 11:16:53 +02:00
tailwind.lua refactor(cmp): add optional where necessary (#4557) 2024-10-23 11:44:27 +02:00
terraform.lua fix(mason): rename and pin to v1 2025-05-12 10:39:04 +02:00
tex.lua fix(tex): specify filetype for <localleader>l (#4905) 2024-12-05 09:11:11 +01:00
thrift.lua refactor: use lazy's new opts_extend functionality for treesitter and mason 2024-06-07 09:03:59 +02:00
toml.lua fix: cleanup unnecessary treesitter langs and mason lsp servers 2024-06-05 18:07:01 +02:00
typescript.lua fix(mini): update mini plugin references from echasnovski to nvim-mini (#6374) 2025-09-15 11:45:00 +02:00
vue.lua fix(vue): ensure css treesitter installed (#4308) 2024-09-18 08:22:05 +02:00
yaml.lua refactor: remove all <0.11 compat code 2025-09-15 11:16:53 +02:00
zig.lua feat(extras): lang/zig (#4437) 2024-11-07 16:40:06 +01:00