[BUG] nixvimInjections don't seem to work on nightly
| Field | Description |
|---|---|
| Plugin | treesitter |
| Nixpkgs | unstable |
- [x] I have read the FAQ and my bug is not listed there.
Description
The nixvimInjections option does not work on nighlty builds of neovim. The extraConfigLua regions do not get properly highlighted as lua code. A minor thing, but I thought it worth to report :)
Minimal, Reproducible Example (MRE)
I'm able to reproduce the behavior with this minimal flake:
{
description = "A nixvim configuration";
inputs = {
nixvim.url = "github:nix-community/nixvim";
flake-utils.url = "github:numtide/flake-utils";
nixneovimplugins.url = "github:NixNeovim/NixNeovimPlugins";
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
};
outputs = {
nixpkgs,
nixvim,
flake-utils,
nixneovimplugins,
...
} @ inputs:
flake-utils.lib.eachDefaultSystem (system: let
pkgs-nightly = import nixpkgs {
inherit system;
overlays = [
nixneovimplugins.overlays.default
inputs.neovim-nightly-overlay.overlay
];
};
pkgs = import nixpkgs {
inherit system;
overlays = [
nixneovimplugins.overlays.default
];
};
nixvim' = nixvim.legacyPackages.${system};
inject = nixvim'.makeNixvimWithModule {
inherit pkgs;
module = {
plugins.treesitter = {
enable = true;
nixvimInjections = true;
};
};
};
inject-nightly = nixvim'.makeNixvimWithModule {
pkgs = pkgs-nightly;
module = {
plugins.treesitter = {
enable = true;
nixvimInjections = true;
};
};
};
in {
packages = {
inherit inject;
inherit inject-nightly;
};
});
}
nix run ".#inject" and nix run ".#inject-nightly" for the different versions.
Opening any file with extraConfigLua should show that the nighly version does not properly highlight those regions.
Can confirm this for current nixpkgs-unstable with Neovim v0.10.0.
Should be fixed in #1843
This still doesn't work for me on latest nixvim and nixpkgs.
@zvolin you may be interested in this discussion: https://github.com/nix-community/nixvim/discussions/2093
TL;DR: the injections are working, but can be a little finicky when it comes to whitespace.
Also: ensure you have set plugins.treesitter.settings.highlight.enable = true.
thanks, highlight.enable = true did the job. I think it was working without it few months ago.
thanks,
highlight.enable = truedid the job. I think it was working without it few months ago.
We used to default to enabling them but changed to respecting plugin defaults as we’ve been refactoring. Treesitter doesn’t enable anything by default apparently.
I have the same issue. I also tried adding custom injections in after/queries/yaml/injections.scm and queries/yaml/injections.scm both through extraFiles and manually but nothing worked - treesitter doesn't pick any of the files up, like they don't exist