Skip to content

Commit e0f6fe7

Browse files
thamenatoNotAShelf
andauthored
treesitter: attempt to adapt to (breaking) Nixpkgs changes (#1315)
* feat: update from builtGrammars to grammarPlugins * fix: renamed packages * chore: revert back the configs part * wip: try using config * chore: update flake * docs: update release-note --------- Co-authored-by: raf <[email protected]>
1 parent 1bf7576 commit e0f6fe7

File tree

12 files changed

+26
-15
lines changed

12 files changed

+26
-15
lines changed

docs/manual/release-notes/rl-0.9.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
# Release 0.9 {#sec-release-0-9}
22

3+
## Breaking changes
4+
5+
- Nixpkgs merged a full and incompatible rewrite of vimPlugins.nvim-treesitter.
6+
The changes affected how grammars are built and it caused issues when neovim
7+
attempted to load languages and could not find files in expected locations.
8+
39
## Changelog {#sec-release-0-9-changelog}
410

511
[suimong](https://github.com/suimong):
612

713
- Fix `vim.tabline.nvimBufferline` where `setupOpts.options.hover` requires
814
`vim.opt.mousemoveevent` to be set.
915

16+
[thamenato](https://github.com/thamenato):
17+
18+
- Attempt to adapt nvim-treesitter to (breaking) Nixpkgs changes. Some treesitte grammars
19+
were changed to prefer `grammarPlugins` over `builtGrammars`.
20+
1021
[jfeo](https://github.com/jfeo):
1122

1223
[ccc.nvim]: https://github.com/uga-rosa/ccc.nvim

flake.lock

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

lib/types/languages.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
mkGrammarOption = pkgs: grammar:
3232
mkPackageOption pkgs ["${grammar} treesitter"] {
33-
default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar];
33+
default = ["vimPlugins" "nvim-treesitter" "grammarPlugins" grammar];
3434
};
3535
in {
3636
inherit diagnostics diagnosticSubmodule mkGrammarOption;

modules/plugins/languages/csharp.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ in {
178178

179179
treesitter = {
180180
enable = mkEnableOption "C# treesitter" // {default = config.vim.languages.enableTreesitter;};
181-
package = mkGrammarOption pkgs "c-sharp";
181+
package = mkGrammarOption pkgs "c_sharp";
182182
};
183183

184184
lsp = {

modules/plugins/languages/markdown.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ in {
6363
description = "Enable Markdown treesitter";
6464
};
6565
mdPackage = mkGrammarOption pkgs "markdown";
66-
mdInlinePackage = mkGrammarOption pkgs "markdown-inline";
66+
mdInlinePackage = mkGrammarOption pkgs "markdown_inline";
6767
};
6868

6969
lsp = {

modules/plugins/languages/python.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ in {
228228
package = mkOption {
229229
description = "Python treesitter grammar to use";
230230
type = package;
231-
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.python;
231+
default = pkgs.vimPlugins.nvim-treesitter.grammarPlugins.python;
232232
};
233233
};
234234

modules/plugins/languages/sql.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ in {
6666

6767
package = mkOption {
6868
type = package;
69-
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.sql;
69+
default = pkgs.vimPlugins.nvim-treesitter.grammarPlugins.sql;
7070
description = "SQL treesitter grammar to use";
7171
};
7272
};

modules/plugins/notes/orgmode/config.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ in {
2121

2222
pluginRC.orgmode = entryAnywhere ''
2323
-- Treesitter configuration
24-
require('nvim-treesitter.configs').setup {
24+
require('nvim-treesitter.config').setup {
2525
2626
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
2727
-- highlighting will fallback to default Vim syntax highlighting

modules/plugins/treesitter/config.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ in {
5252
'');
5353

5454
pluginRC.treesitter = entryAfter ["basic"] ''
55-
require('nvim-treesitter.configs').setup {
55+
require('nvim-treesitter.config').setup {
5656
-- Disable imperative treesitter options that would attempt to fetch
5757
-- grammars into the read-only Nix store. To add additional grammars here
5858
-- you must use the `config.vim.treesitter.grammars` option.

modules/plugins/treesitter/treesitter.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ in {
2525
type = listOf package;
2626
default = [];
2727
example = literalExpression ''
28-
with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
28+
with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [
2929
regex
3030
kdl
3131
];
3232
'';
3333
description = ''
3434
List of treesitter grammars to install. For grammars to be installed properly,
35-
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`.
35+
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.grammarPlugins`.
3636
You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars.
3737
3838
For languages already supported by nvf, you may use
@@ -56,7 +56,7 @@ in {
5656
internal = true;
5757
readOnly = true;
5858
type = listOf package;
59-
default = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [c lua vim vimdoc query];
59+
default = with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [c lua vim vimdoc query];
6060
description = ''
6161
A list of treesitter grammars that will be installed by default
6262
if treesitter has been enabled and {option}`vim.treeesitter.addDefaultGrammars`

0 commit comments

Comments
 (0)