Skip to content

Commit e6574dd

Browse files
authored
Update for AstroNvim v6 (#180)
* feat: start migrating documentation to be applicable to AstroLSP v4 * feat(advanced_lsp): migrate more of the documentation to use the new LSP configuration settings for the `vim.lsp.config` API * feat: more documentation update of AstroNvim v6 changes * chore: update blink.cmp repository name * chore: update dependencies * feat: start working on v6 migration guide * fix: a couple typos * feat: add page for new treesitter customization options * feat: work on v6 migration guide * feat(treesitter): add documentation for available treesitter options in AstroCore * feat(v6_migration): add more v6 migration guide information * chore: remove v5 migration guide * fix: improve requirements list to match the latest `nvim-treesitter` * fix(v6_migration): improve readability of treesitter diff * fix(v6_migration): copy edits * fix(v6_migration): copy edits * chore: update to AstroJS 6 and Starlight 0.38 * fix: update start_url to be relative * fix: disable sharp builds
1 parent f416234 commit e6574dd

25 files changed

Lines changed: 1980 additions & 2058 deletions

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22
1+
24

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
nodejs 22
2-
pnpm 9
1+
nodejs 24
2+
pnpm 10

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@
1111
"upgrade": "pnpm dlx @astrojs/upgrade"
1212
},
1313
"dependencies": {
14-
"@astrojs/mdx": "^4.3.11",
15-
"@astrojs/starlight": "^0.36.2",
16-
"@astrojs/starlight-docsearch": "^0.6.1",
17-
"@astrojs/starlight-tailwind": "^4.0.2",
18-
"@expressive-code/plugin-collapsible-sections": "^0.41.3",
14+
"@astrojs/mdx": "^5.0.2",
15+
"@astrojs/starlight": "^0.38.2",
16+
"@astrojs/starlight-docsearch": "^0.7.0",
17+
"@astrojs/starlight-tailwind": "^5.0.0",
18+
"@expressive-code/plugin-collapsible-sections": "^0.41.7",
1919
"@fontsource-variable/inter": "^5.2.8",
2020
"@fontsource-variable/jetbrains-mono": "^5.2.8",
21-
"@tailwindcss/vite": "^4.1.17",
22-
"astro": "^5.15.9",
21+
"@tailwindcss/vite": "^4.2.2",
22+
"astro": "^6.0.8",
2323
"sharp": "^0.34.5",
24-
"starlight-image-zoom": "^0.13.2",
25-
"starlight-links-validator": "^0.19.1",
26-
"tailwindcss": "^4.1.17"
24+
"starlight-image-zoom": "^0.14.1",
25+
"starlight-links-validator": "^0.20.1",
26+
"tailwindcss": "^4.2.2"
2727
},
2828
"devDependencies": {
2929
"@netlify/plugin-lighthouse": "^6.0.4",
3030
"netlify-plugin-submit-sitemap": "^0.4.0",
31-
"prettier": "^3.6.2",
31+
"prettier": "^3.8.1",
3232
"prettier-plugin-astro": "^0.14.1",
33-
"prettier-plugin-tailwindcss": "^0.7.1"
33+
"prettier-plugin-tailwindcss": "^0.7.2"
3434
}
3535
}

pnpm-lock.yaml

Lines changed: 1365 additions & 1351 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
allowBuilds:
2+
esbuild: true
3+
puppeteer: true
4+
sharp: false

public/manifest.webmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "AstroNvim Documentation",
3-
"start_url": "https://docs.astronvim.com",
3+
"start_url": "./",
44
"description": "Documentation for the AstroNvim Neovim configuration.",
55
"display": "minimal-ui",
66
"background_color": "#1a1d23",
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { defineCollection } from "astro:content";
2+
import { docsLoader, i18nLoader } from "@astrojs/starlight/loaders";
23
import { docsSchema, i18nSchema } from "@astrojs/starlight/schema";
34
import { docSearchI18nSchema } from "@astrojs/starlight-docsearch/schema";
45

56
export const collections = {
6-
docs: defineCollection({ schema: docsSchema() }),
7+
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
78
i18n: defineCollection({
8-
type: "data",
9+
loader: i18nLoader(),
910
schema: i18nSchema({ extend: docSearchI18nSchema() }),
1011
}),
1112
};

src/content/docs/configuration/customizing_plugins.mdx

Lines changed: 37 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,18 @@ return {
7878
},
7979
},
8080
},
81-
-- customize treesitter parsers
81+
-- customize enabled AstroLSP servers
8282
{
83-
"nvim-treesitter/nvim-treesitter",
83+
"AstroNvim/astrolsp",
8484
opts = function(_, opts)
85-
-- list like portions of a table cannot be merged naturally and require the user to merge it manually
85+
-- list like portions of a table cannot be merged naturally and may require the user to merge it manually
8686
-- check to make sure the key exists
87-
if not opts.ensure_installed then
88-
opts.ensure_installed = {}
87+
if not opts.servers then
88+
opts.servers = {}
8989
end
90-
vim.list_extend(opts.ensure_installed, {
91-
"lua",
92-
"vim",
93-
-- add more arguments for adding more treesitter parsers
90+
vim.list_extend(opts.servers, {
91+
"lua_ls",
92+
-- add more arguments for manually enabling more language servers
9493
})
9594
end,
9695
},
@@ -110,19 +109,19 @@ The `table` notation is the simplest method for configuration but does not cover
110109

111110
:::tip
112111

113-
Since [`lazy.nvim` v10.23.0](https://github.com/folke/lazy.nvim/releases/tag/v10.23.0) a new configuration option has been added called `opts_extend` which allows specifying that a part of the options passed to the `opts` table should be treated as a list that is extended rather than replaced completely as described below. Since [AstroNvim v4.9.0](https://github.com/AstroNvim/AstroNvim/releases/tag/v4.9.0) this option has been enabled out of the box for the `ensure_installed` tables for [`nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter) and [`mason-tool-installer.nvim`](https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim). This allows the user to use the basic table notation to simply add more items to these `ensure_installed` lists.
112+
Since [`lazy.nvim` v10.23.0](https://github.com/folke/lazy.nvim/releases/tag/v10.23.0) a new configuration option has been added called `opts_extend` which allows specifying that a part of the options passed to the `opts` table should be treated as a list that is extended rather than replaced completely as described below. Since [AstroNvim v4.9.0](https://github.com/AstroNvim/AstroNvim/releases/tag/v4.9.0) this option has been enabled out of the box for the `ensure_installed` tables for [`mason-tool-installer.nvim`](https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim). This allows the user to use the basic table notation to simply add more items to these `ensure_installed` lists.
114113

115114
:::
116115

117-
Let's take a closer look at these two notations with an example using [`nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter). Let's assume the default configuration for `nvim-treesitter` is:
116+
Let's take a closer look at these two notations with an example using [`mason-tool-installer.nvim`](https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim). Let's assume the default configuration for `mason-tool-installer` is:
118117

119118
```lua
120119
return {
121-
"nvim-treesitter/nvim-treesitter",
120+
"WhoIsSethDaniel/mason-tool-installer.nvim",
122121
opts = {
123-
ensure_installed = { "lua", "vim" },
124-
highlight = {
125-
enable = true,
122+
ensure_installed = { "lua_ls" },
123+
integrations = {
124+
["mason-lspconfig"] = true,
126125
},
127126
},
128127
}
@@ -132,9 +131,9 @@ With this specification the current `opts` would resolve to the table:
132131

133132
```lua
134133
opts = {
135-
ensure_installed = { "lua", "vim" },
136-
highlight = {
137-
enable = true,
134+
ensure_installed = { "lua_ls" },
135+
integrations = {
136+
["mason-lspconfig"] = true,
138137
},
139138
}
140139
```
@@ -143,67 +142,36 @@ If you use the table notation to override these fields in your configuration lik
143142

144143
```lua
145144
return {
146-
"nvim-treesitter/nvim-treesitter",
145+
"WhoIsSethDaniel/mason-tool-installer.nvim",
147146
opts = {
148-
ensure_installed = { "python" },
149-
highlight = {
150-
enable = false,
147+
ensure_installed = { "prettier" },
148+
integrations = {
149+
["mason-lspconfig"] = false,
150+
["mason-nvim-dap"] = true,
151151
},
152-
indent = {
153-
enable = false,
154-
},
155-
},
156-
}
157-
```
158-
159-
You would end up with the `opts` resolving to:
160-
161-
```lua
162-
opts = {
163-
ensure_installed = { "python" },
164-
highlight = {
165-
enable = false,
166-
},
167-
indent = {
168-
enable = false,
169152
},
170153
}
171154
```
172155

173-
The `highlight.enabled` and `indent.enabled` fields work as expected, but the `ensure_installed` table does not actually extend the list and instead simply overwrites it. This is a limitation of the table merging. To resolve this we can rewrite our `opts` as a function where the first parameter is the resolve plugin specification (this is rarely used but may be useful in very advanced cases) and the second parameter which is the current `opts` table:
174-
175-
```lua
176-
return {
177-
"nvim-treesitter/nvim-treesitter",
178-
opts = function(plugin, opts)
179-
table.insert(opts.ensure_installed, "python")
180-
end,
181-
}
182-
```
183-
184156
You would end up with the `opts` resolving to:
185157

186158
```lua
187159
opts = {
188-
ensure_installed = { "lua", "vim", "python" },
189-
highlight = {
190-
enable = true,
160+
ensure_installed = { "prettier" },
161+
integrations = {
162+
["mason-lspconfig"] = false,
163+
["mason-nvim-dap"] = true,
191164
},
192165
}
193166
```
194167

195-
One thing to watch out for (that `table` merging handles automatically, but the function notation does not) is the creation of nested/parent keys. When using a function to modify `opts`, you’re responsible for ensuring that nested tables exist before setting any values on them. For example, if we want to set `indent.enable = true` in our `opts` with the function notation, it would look something like this:
168+
The `integrations.mason-lspconfig` and `integrations.mason-nvim-dap` fields work as expected, but the `ensure_installed` table does not actually extend the list and instead simply overwrites it. This is a limitation of the table merging. To resolve this we can rewrite our `opts` as a function where the first parameter is the resolve plugin specification (this is rarely used but may be useful in very advanced cases) and the second parameter which is the current `opts` table:
196169

197170
```lua
198171
return {
199-
"nvim-treesitter/nvim-treesitter",
172+
"WhoIsSethDaniel/mason-tool-installer.nvim",
200173
opts = function(plugin, opts)
201-
-- check if an `indent` table exists, if not, create it
202-
if not opts.indent then
203-
opts.indent = {}
204-
end
205-
-- once we know it is created, we can set the sub-keys
206-
opts.indent.enable = true
174+
table.insert(opts.ensure_installed, "prettier")
207175
end,
208176
}
209177
```
@@ -212,12 +180,9 @@ You would end up with the `opts` resolving to:
212180

213181
```lua
214182
opts = {
215-
ensure_installed = { "lua", "vim", "python" },
216-
highlight = {
217-
enable = true,
218-
},
219-
indent = {
220-
enable = true,
183+
ensure_installed = { "lua_ls", "prettier" },
184+
integrations = {
185+
["mason-lspconfig"] = true,
221186
},
222187
}
223188
```
@@ -226,7 +191,7 @@ Notice how we didn't return anything from this function. In Lua, tables are pass
226191

227192
```lua
228193
return {
229-
"nvim-treesitter/nvim-treesitter",
194+
"WhoIsSethDaniel/mason-tool-installer.nvim",
230195
opts = function(plugin, opts)
231196
return {}
232197
end,
@@ -239,7 +204,7 @@ You would end up with the `opts` resolving to:
239204
opts = {}
240205
```
241206

242-
The last thing that this function notation provides is the ability to `require` modules safely even with lazy loading. `nvim-treesitter` isn't a great example of this, so here is a simple example with `nvim-cmp`. `nvim-cmp` allows the configuration of mappings and provides helper functions to make setting these mappings easy. Because `nvim-cmp` is lazy loaded, the function notation is required in this situation so that we don't break the lazy loading:
207+
The last thing that this function notation provides is the ability to `require` modules safely even with lazy loading. `mason-tool-installer.nvim` isn't a great example of this, so here is a simple example with `nvim-cmp`. `nvim-cmp` allows the configuration of mappings and provides helper functions to make setting these mappings easy. Because `nvim-cmp` is lazy loaded, the function notation is required in this situation so that we don't break the lazy loading:
243208

244209
```lua
245210
return {
@@ -293,17 +258,17 @@ return {
293258

294259
##### `list_insert_unique`
295260

296-
Other times when you do list inserting you want to safely insert new entries into a list but skip over values that already exist. This is useful if you are importing lots of language packs in AstroCommunity. Here is the previous `nvim-treesitter` example above using this function:
261+
Other times when you do list inserting you want to safely insert new entries into a list but skip over values that already exist. This is useful if you are importing lots of language packs in AstroCommunity. Here is the previous `mason-tool-installer` example above using this function:
297262

298263
```lua
299264
return {
300-
"nvim-treesitter/nvim-treesitter",
265+
"WhoIsSethDaniel/mason-tool-installer.nvim",
301266
opts = function(plugin, opts)
302267
-- `list_insert_unique` is in place, so it will modify
303268
-- the first parameter table if provided
304269
require("astrocore").list_insert_unique(
305270
opts.ensure_installed,
306-
{ "python", "vim" }
271+
{ "lua_ls", "prettier" }
307272
)
308273
end,
309274
}

src/content/docs/configuration/lua_completion.mdx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,6 @@ return {
2828
}
2929
```
3030

31-
:::tip
32-
33-
AstroLSP allows for language server configuration completion by utilizing types exposed by the `nvim-lspconfig` plugin. One downside is the type does complain that "fields are missing" even though they are not actually required. To work around this, it can be useful and less noisy if you add
34-
35-
```
36-
---@diagnostic disable: missing-fields
37-
```
38-
39-
before the `config` table. Here is an example:
40-
41-
```lua title="lua/plugins/astrolsp.lua" {5}
42-
return {
43-
"AstroNvim/astrolsp",
44-
---@type AstroLSPOpts
45-
opts = {
46-
---@diagnostic disable: missing-fields
47-
config = {
48-
-- LSP options and server configuration go here...
49-
},
50-
},
51-
}
52-
```
53-
54-
:::
55-
5631
### `opts` Function
5732

5833
Other times a function may be required if you want to include any sort of special logic for calculating the table or for handling cases that table merging doesn't deal with properly such as list-like tables. Here you need to specify the type of the parameter in the function.

0 commit comments

Comments
 (0)