Giter VIP home page Giter VIP logo

Comments (14)

mjlbach avatar mjlbach commented on June 26, 2024 1

Yes, if you're using a non-nixos system, this will guarantee that the runtime treesitter ABI and parser's ABI match

from neovim-nightly-overlay.

mjlbach avatar mjlbach commented on June 26, 2024

How are you compiling your tree-sitter parsers? Are they built by nix? I have the following in my HM config:

  xdg.configFile."nvim/parser/c.so".source = "${pkgs.tree-sitter.builtGrammars.tree-sitter-c}/parser";
  xdg.configFile."nvim/parser/lua.so".source = "${pkgs.tree-sitter.builtGrammars.tree-sitter-lua}/parser";
  xdg.configFile."nvim/parser/rust.so".source = "${pkgs.tree-sitter.builtGrammars.tree-sitter-rust}/parser";
  xdg.configFile."nvim/parser/python.so".source = "${pkgs.tree-sitter.builtGrammars.tree-sitter-python}/parser";

The version of TS used to compile them needs to match the runtime version linked by neovim

from neovim-nightly-overlay.

AusCyberman avatar AusCyberman commented on June 26, 2024

i have that config and the default, neither work, both say neovim is compiled with version 12 and the parser is 13

from neovim-nightly-overlay.

AusCyberman avatar AusCyberman commented on June 26, 2024

The problem has fixed itself, after i switched to unstable from master

from neovim-nightly-overlay.

mjlbach avatar mjlbach commented on June 26, 2024

Teto also bumped the flake in core/contrib, which this repo wraps

from neovim-nightly-overlay.

scalavision avatar scalavision commented on June 26, 2024

I still have this problem after a fresh install of home-manager. I get this when opening a nix file:

Error detected while processing FileType Autocommands for "*":
E5108: Error executing lua ...ghtly/share/nvim/runtime/lua/vim/treesitter/language.lua:33: ABI version mismatch : supported between 9 and 12, found 1

I have this config related to neovim:

  nixpkgs.overlays = [    
    (import (builtins.fetchTarball {    
      url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;    
    }))    
  ];

and enabling neovim (excerpt from the config):

in        
{              
  programs.neovim = {
    enable = true;
#    package = unstable.pkgs.neovim;
    package = pkgs.neovim-nightly;

    # install needed binaries here
    extraPackages = with pkgs; [
      # used to compile tree-sitter grammar
      tree-sitter
    ];

    plugins = with pkgs.vimPlugins; [
      # you can use plugins from the pkgs
      vim-which-key
      lspsaga-nvim

   ];
 
  };

}

I tried using the unstable channel, but since I am on NixOS using the stable channel, that was not working.

I think treesitter installed automatically by itself when opening a project.

It seems to me that 0.4 is still used by home-manager, is it possible to install the 0.5 release somehow, maybe using some kind of overlay? I am not that accustomed to home-manager yet. I think it could be a great option if possible, since I don't need to stay on the bleeding edge / nightly build of neovim anymore.

Thanks for making this available by the way!

from neovim-nightly-overlay.

mjlbach avatar mjlbach commented on June 26, 2024

It seems to me that 0.4 is still used by home-manager, is it possible to install the 0.5 release somehow, maybe using some kind of overlay? I am not that accustomed to home-manager yet. I think it could be a great option if possible, since I don't need to stay on the bleeding edge / nightly build of neovim anymore.

This is the overlay. FWIW tree-sitter is not guaranteed to work with 0.5, and nvim-treesitter (the plugin) may break compatibility with 0.5 at any time. 0.5 should be in nixpkgs-unstable now.

You shouldn't let tree-sitter install the parsers. You should install them from nixpkgs. Make sure you clear all parsers/disable automatic parser installation with treesitter (rm -rf ~/.local/share/nvim/parse) and then add the following to HM:

  xdg.configFile."nvim/parser/c.so".source = "${pkgs.tree-sitter.builtGrammars.tree-sitter-c}/parser";
  xdg.configFile."nvim/parser/lua.so".source = "${pkgs.tree-sitter.builtGrammars.tree-sitter-lua}/parser";
  xdg.configFile."nvim/parser/rust.so".source = "${pkgs.tree-sitter.builtGrammars.tree-sitter-rust}/parser";
  xdg.configFile."nvim/parser/python.so".source = "${pkgs.tree-sitter.builtGrammars.tree-sitter-python}/parser";

from neovim-nightly-overlay.

jacksonludwig avatar jacksonludwig commented on June 26, 2024

@mjlbach when you say not to let tree-sitter install parsers, do you mean don't do stuff like :TSInstall x in neovim, and instead install the desired parsers as you have given in you example?
Thanks.

from neovim-nightly-overlay.

scalavision avatar scalavision commented on June 26, 2024

Thanks @mjlbach , seems my problem is that the version of tree-sitter is 0.19+ in nixpkgs, while the supported version is 0.18+, not sure if this this something in my plugins or in neovim itself.

I tried to override these in my home.nix as follows:

  nixpkgs.overlays = [    
  (self: super: {    
    
    tree-sitter-updated = super.tree-sitter.overrideAttrs(oldAttrs: {    
    
      version = "0.18.3";    
      sha256 = "sha256-uQs80rxcPX7Q46irJYv2FfvuppwonSS4HVClFujaP+U=";    
      cargoSha256 = "sha256-fonlxLNh7KyewCj7G4vxa7cM/DlcHNFbQpp0SwVQ3j3=";    
    
      postInstall = ''    
        PREFIX=$out make install    
      '';    
    
    });    
    
    neovim-release-5 = super.neovim-unwrapped.overrideAttrs (oldAttrs: rec {    
      name = "neovim";    
      version = "0.5.0";    
      src = self.fetchurl {    
        url = "https://github.com/neovim/neovim/releases/download/v0.5.0/nvim-linux64.tar.gz";    
#        url = "https://github.com/neovim/neovim/archive/master.zip";    
        sha256 = "0zbkjfgws26dia58ynr0v5b3q0yw6y7brb7x7kjaf3ry2j2yhnfd";    
      };    
    
      nativeBuildInputs = with self.pkgs; [ unzip cmake pkgconfig gettext tree-sitter-updated ];    
    
    });    
    
   })    
    
  ];

But it seems to drag in tree-sitter 0.19 nevertheless:

$ home-manager switch              
these derivations will be built:
  /nix/store/nh4lzcvfh8ghzqfsm5rlj3vx3nksxsha-tree-sitter-0.18.3.drv
  /nix/store/372b1zdcvlk9m90niynln1j057y1n8mf-neovim.drv
  /nix/store/182cq002m51fp20r1gxjdm3cyxmwirk0-neovim-0.5.0.drv
  /nix/store/hdi5ya73hrjhmar35g0bfh9y9ldk5rjc-home-manager-path.drv
  /nix/store/j2ljh01r3pbab2agcy1fn3ih7w484ncg-activation-script.drv
  /nix/store/lk0v94ym8gg1f3x16v6g2jpxrnmvm5dv-hm_fontconfigconf.d10hmfonts.conf.drv
  /nix/store/jm5iwvkdp24k9jv1ajqgia6l48c47h8j-home-manager-files.drv
  /nix/store/4wfkiyc8va9pd0llygg82b1cmq7l8gy5-home-manager-generation.drv
building '/nix/store/nh4lzcvfh8ghzqfsm5rlj3vx3nksxsha-tree-sitter-0.18.3.drv'...
unpacking sources
unpacking source archive /nix/store/mcxwrpp3pvjx9xfpkphj7draylyavz1p-source
source root is source
Executing cargoSetupPostUnpackHook
unpacking source archive /nix/store/03d3p02b3ig3ql3kfp1s7qgi1qrs54z6-tree-sitter-0.19.3-vendor.tar.gz
Finished cargoSetupPostUnpackHook
patching sources
Executing cargoSetupPostPatchHook
Validating consistency between /build/source//Cargo.lock and /build/tree-sitter-0.19.3-vendor.tar.gz/Cargo.lock
Finished cargoSetupPostPatchHook
configuring
building
Executing cargoBuildHook
++ env CC_x86_64-unknown-linux-gnu=/nix/store/74kv08wjf06ifgk4dxrnra4qhzr5s1w4-gcc-wrapper-10.3.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/74kv08wjf06ifgk4dxrnra4qhzr5s1w4-gcc-wrapper-10.3.0/bin/c++ CC_x86_64-unknown-linux-gnu=/nix/store/74kv08wjf06ifgk4dxrnra4qhzr5s1w4-gcc-wrapper-10.3.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/74kv08wjf06ifgk4dxrnra4qhzr5s1w4-gcc-wrapper-10.3.0/bin/c++ cargo build -j 8 --target x86_64-unknown-linux-gnu --frozen --release

I might not be able to override the neovim build setup correctly I guess. Maybe there should be an override possibility to select custom version of tree-sitter used by neovim?

I've stumbled into this before and it seems to be a reoccurring problem.

from neovim-nightly-overlay.

AusCyberman avatar AusCyberman commented on June 26, 2024

again i come back, as neovim is linked to glibc 2.32, however treesitter requires, and the current glibc version is 2.33

from neovim-nightly-overlay.

AusCyberman avatar AusCyberman commented on June 26, 2024

i managed to just override the buildInputs to use the current nixpkgs gcc and glibc

from neovim-nightly-overlay.

jacksonludwig avatar jacksonludwig commented on June 26, 2024

Yes, if you're using a non-nixos system, this will guarantee that the runtime treesitter ABI and parser's ABI match

Should I be able to do this for all parsers? NBD but I noticed

xdg.configFile."nvim/parser/comment.so".source = "${pkgs.tree-sitter.builtGrammars.tree-sitter-comment}/parser";

results in

error: attribute 'tree-sitter-comment' missing

from neovim-nightly-overlay.

nixos-discourse avatar nixos-discourse commented on June 26, 2024

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-get-nvim-treesitter-working-for-latex-files/18908/1

from neovim-nightly-overlay.

marcelarie avatar marcelarie commented on June 26, 2024

i managed to just override the buildInputs to use the current nixpkgs gcc and glibc

can you show how you did this?

from neovim-nightly-overlay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.