Skip to content

Commit 62faa31

Browse files
committed
feat(v6_migration): add more v6 migration guide information
1 parent bc19d9b commit 62faa31

File tree

1 file changed

+126
-8
lines changed

1 file changed

+126
-8
lines changed

src/content/docs/configuration/v6_migration.mdx

Lines changed: 126 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Each "Migrating" section below has an link to documentation and/or an example co
7676

7777
The [plugin configuration files.](https://github.com/AstroNvim/AstroNvim/tree/main/lua%2Fastronvim%2Fplugins) in the AstroNvim codebase itself are also a good reference to learn how to configure.
7878

79-
**Please also read the [Other Breaking Changes section](#other-breaking-changes)** - there are a number of changes that are not just "move some config from one place to another". For example, _TODO_
79+
**Please also read the [Other Breaking Changes section](#other-breaking-changes)** - there are a number of changes that are not just "move some config from one place to another". For example, updating default plugins to new releases with breaking changes which may require configuration changes if the user has modified them.
8080

8181
If you get stuck, people on the [Discord](https://discord.astronvim.com/) forum are active and friendly! Like all humans, sometimes they are grumpy, so be nice to them! The best place to post is most likely the `#help-forum`, but poke around a few of the other channels, you never know what you will find that is useful.
8282

@@ -99,11 +99,12 @@ A few plugins have been updated to a new name due to changes in the plugin repos
9999

100100
A few plugins have been removed due to being replaced with core Neovim functions or no longer support the new Neovim APIs.
101101

102-
| Old Plugin Name | Reason |
103-
| --------------------------------------------- | ------------------------------------------------------ |
104-
| `JoosepAlviste/nvim-ts-context-commentstring` | Not necessary in Neovim v0.11+ and built in commenting |
105-
| `folke/neoconf.nvim` | Does not support `vim.lsp.config` |
106-
| `kevinhwang91/nvim-ufo` | Replaced with built in `foldexpr` |
102+
| Old Plugin Name | Reason |
103+
| --------------------------------------------- | ---------------------------------------------------------- |
104+
| `JoosepAlviste/nvim-ts-context-commentstring` | Not necessary in Neovim v0.11+ and built in commenting |
105+
| `folke/neoconf.nvim` | Does not support `vim.lsp.config` |
106+
| `kevinhwang91/nvim-ufo` | Replaced with built in `foldexpr` |
107+
| `RRethy/vim-illuminate` | Replaced with `snacks.words` module in `folke/snacks.nvim` |
107108

108109
#### Details
109110

@@ -116,9 +117,102 @@ A few plugins have been removed due to being replaced with core Neovim functions
116117

117118
- Configuration of Treesitter features in Neovim. With the latest development of the `nvim-treesitter` plugin, the plugin has moved to simply being a download utility for treesitter parsers and it is up to the user to configure treesitter features such as highlighting and folding. This also applies to `nvim-treesitter-textobjects` which now is simply a plugin that provides an API for manually creating key mappings. AstroCore has added a new `treesitter` module to help aid with this and can be configured through the plugin configuration `opts`. This configuration table includes the ability to configure both `nvim-treesitter` and `nvim-treesitter-textobjects` in a similar format to how they were configured before. If you have custom configuration for either plugins you will need to migrate those plugin configurations to AstroCore. For more details, checkout the new [Treesitter Configuration Documentation](/recipes/treesitter)
118119

120+
```lua title="lua/plugins/astrocore_treesitter.lua del={2-15} ins={16-32}"
121+
return {
122+
{
123+
"nvim-treesitter/nvim-treesitter",
124+
opts = {
125+
ensure_installed = { "vim", "lua" },
126+
highlight = { enable = true },
127+
textobjects = {
128+
select = {
129+
keymaps = {
130+
["ak"] = { query = "@block.outer", desc = "around block" },
131+
},
132+
},
133+
},
134+
},
135+
},
136+
{
137+
"AstroNvim/astrocore",
138+
---@type AstroCoreOpts
139+
opts = {
140+
treesitter = {
141+
ensure_installed = { "vim", "lua" },
142+
highlight = true,
143+
textobjects = {
144+
select = {
145+
select_textobject = {
146+
["ak"] = { query = "@block.outer", desc = "around block" },
147+
},
148+
},
149+
},
150+
},
151+
},
152+
},
153+
}
154+
```
155+
119156
#### AstroLSP
120157

121-
- TODO
158+
The biggest change for AstroLSP is the migration to using `vim.lsp.config` as the backend for language server configuration. In general, this doesn't change all that much of the configuration. The `config` and `handlers` tables can still be used for configuring language server options as well as how they are actually enabled, but now each table has a `["*"]` key for defining defaults. Below is a walk through of each major configuration change:
159+
160+
- `config["*"]` is now used for the default language server options which in turn call `vim.lsp.config("*", config_table)`. Previously this was done with separate `capabilities` and `flags` tables at the root of the AstroLSP opts. If you have anything in the `capabilities` or `flags` tables, they should be moved to `config["*"].capabilities` and `config["*"].flags` respectively.
161+
162+
```lua title="lua/plugins/astroui_default_config.lua del={5-12} ins={13-24}"
163+
return {
164+
"AstroNvim/astrolsp",
165+
---@type AstroLSPOpts
166+
opts = {
167+
capabilities = {
168+
textDocument = {
169+
foldingRange = { dynamicRegistration = false },
170+
},
171+
},
172+
flags = {
173+
exit_timeout = 5000,
174+
},
175+
config = {
176+
["*"] = {
177+
capabilities = {
178+
textDocument = {
179+
foldingRange = { dynamicRegistration = false },
180+
},
181+
},
182+
flags = {
183+
exit_timeout = 5000,
184+
},
185+
},
186+
},
187+
},
188+
}
189+
```
190+
191+
- The `handlers` table default handler is no longer done through the first entry with no key which blended list like and dictionary like tables. This is now done with the `"*"` key. This makes it clearer to the user which handler is the global one and cleaner to define. The other change is the default handler is now `vim.lsp.enable` by default. Lastly, handler functions here simply provide the server name as a parameter and no longer pass in the server options. Users should use the new `vim.lsp.config[server_name]` built in Neovim LSP API for accessing the resolved language server configuration table.
192+
193+
```lua title="lua/plugins/astroui_default_handler.lua del={6-8} ins={9-14}"
194+
return {
195+
"AstroNvim/astrolsp",
196+
---@type AstroLSPOpts
197+
opts = {
198+
handlers = {
199+
function(server, opts)
200+
require("lspconfig")[server].setup(opts)
201+
end,
202+
["*"] = function(server)
203+
-- If you need the LSP options for a server use `vim.lsp.config` table
204+
-- This is useful for cases of setting up language server specific plugins
205+
local opts = vim.lsp.config[server]
206+
vim.lsp.enable(server)
207+
end,
208+
},
209+
},
210+
}
211+
```
212+
213+
- `require("astrolsp").lsp_opts(server_name)` function has been removed, users should replace all usages with `vim.lsp.config[server_name]`. This typically comes up when configuring language server specific plugins. For migration of language server specific plugins, you should also verify with each plugin to make sure they have support for the new `vim.lsp.config` APIs and Neovim v0.11+. Some plugins that are no longer actively maintained may still rely on old `nvim-lspconfig` APIs that are no longer available. Be sure to check out the update [Advanced LSP Setup Documentation](/recipes/advanced_lsp).
214+
215+
- Previously we had a relatively undocumented configuration table for `mason_lspconfig` which allowed hot patching mason-lspconfig to recognize packages that didn't define their language servers. This is no longer necessary as the Mason Registry maintenance has been improved and the registry provides the mapping to language servers rather than `mason-lspconfig` maintaining the mapping. This configuration table and functionality has been removed, if you happen to use it you should remove all usages.
122216

123217
#### AstroUI
124218

@@ -127,7 +221,31 @@ A few plugins have been removed due to being replaced with core Neovim functions
127221
### Other Breaking Changes
128222

129223
- Drop support for Neovim v0.9
224+
- `nvim-treesitter/nvim-treesitter` has been updated to the new (and default) `main` branch with the latest rewrite and development. Verify that user installed treesitter based plugins are updated to use this new version rather than the removed module system of the previous `nvim-treesitter` release.
225+
- `nvim-treesitter/nvim-treesitter-textobjects` has been updated to the new (and default) `main` branch. This refactors it to no longer be a module for `nvim-treesitter`. If you are doing configuration of this plugin in your user configuration, make sure to follow the AstroCore changes detailed above.
226+
- `mason-org/mason-lspconfig.nvim` has been updated to v2 which utilizes the new `vim.lsp.config` APIs as well as Mason packages self registering as language servers. Make sure language server specific plugins are not reliant on `mason-lspconfig` v1 if they have any sort of integration.
227+
- `:LspInfo`, `:LspLog`, `:LspStart`, `:LspRestart`, `:LspStop` commands from `nvim-lspconfig` are removed in Neovim v0.12 and are replaced with the built in `:lsp` command (`:h lsp-commands`). If you are using these commands in your configuration make sure to update them accordingly.
130228

131229
### New Features
132230

133-
- TODO
231+
- Full adoption of `vim.lsp.config` which includes support for configuring language servers with `lsp/<server_name>.lua` (`:h lsp-config` for more details)
232+
- Migration to using `winborder` Neovim option for specifying window border settings. This provides a single option for choosing to remove borders from floating windows.
233+
234+
```lua title="lua/plugins/disable_borders.lua"
235+
return {
236+
{
237+
"AstroNvim/astrocore",
238+
---@type AstroCoreOpts
239+
opts = {
240+
options = {
241+
opt = {
242+
winborder = "none",
243+
},
244+
},
245+
},
246+
},
247+
}
248+
```
249+
250+
- New mappings:
251+
- `<Leader>lw` - Workspace diagnostics (Neovim v0.12+ only)

0 commit comments

Comments
 (0)