nix-community / tree-sitter-nix

Nix grammar for tree-sitter [maintainer=@cstrahan]
MIT License
179 stars 31 forks source link

Language injections might block access to the file #48

Open CertainLach opened 10 months ago

CertainLach commented 10 months ago

Having a following fragment in the file:

[
  #"alpha=https://[${fleet.alpha.services.fleetKubernetes.externalIp}]:2380"
  "beta=https://[${fleet.beta.services.fleetKubernetes.externalIp}]:2380"
]

(Etcd peer list, where the first entry is commented)

Causes neovim to be stuck in loop with E79: Cannot expand wildcards; Press ENTER or type command to continue every time the file is changed, making it impossible to do anything without disabled highlight (:TSDisable highlight), except quitting vim via hard reset, caused by "alpha=https://[${fleet.alpha.services.fleetKubernetes.externalIp}]:2380" being interpreted as language name, and trying to find matching parser:

Executing command: "vimglob() { while [ $# -ge 1 ]; do echo "$1"; shift; done }; vimglob >/tmp/nvim.lach/C9dClA/41 /nix/store/b9c39jpv0pciszc2bsjw72yjvgyk58ig-vim-pack-dir/pack/myNeovimPackages/start/rainbow-delimiters.nvim/parser/#\"alpha=https://[${fleet.alpha.services.fleetKubernetes.externalIp}]:2380\".*"

E79: Cannot expand wildcards

Executing command: "vimglob() { while [ $# -ge 1 ]; do echo "$1"; shift; done }; vimglob >/tmp/nvim.lach/C9dClA/42 /nix/store/b9c39jpv0pciszc2bsjw72yjvgyk58ig-vim-pack-dir/pack/myNeovimPackages/start/rust-tools.nvim/parser/#\"alpha=https://[${fleet.alpha.services.fleetKubernetes.externalIp}]:2380\".*"

E79: Cannot expand wildcards

Executing command: "vimglob() { while [ $# -ge 1 ]; do echo "$1"; shift; done }; vimglob >/tmp/nvim.lach/C9dClA/43 /nix/store/b9c39jpv0pciszc2bsjw72yjvgyk58ig-vim-pack-dir/pack/myNeovimPackages/start/telescope-manix/parser/#\"alpha=https://[${fleet.alpha.services.fleetKubernetes.externalIp}]:2380\".*"

E79: Cannot expand wildcards

Executing command: "vimglob() { while [ $# -ge 1 ]; do echo "$1"; shift; done }; vimglob >/tmp/nvim.lach/C9dClA/44 /nix/store/b9c39jpv0pciszc2bsjw72yjvgyk58ig-vim-pack-dir/pack/myNeovimPackages/start/telescope-symbols.nvim/parser/#\"alpha=https://[${fleet.alpha.services.fleetKubernetes.externalIp}]:2380\".*"

E79: Cannot expand wildcards

I'm not sure who is responsible for escaping glob here, might escalate this issue to neovim itself, but for this grammar plugin, maybe not every comment should be parsed as language identifier? https://github.com/nix-community/tree-sitter-nix/blob/master/queries/injections.scm#L2

CertainLach commented 9 months ago

Can also be triggered on nixpkgs, e.g on this file: https://github.com/NixOS/nixpkgs/blob/612f97239e2cc474c13c9dafa0df378058c5ad8d/pkgs/development/python-modules/werkzeug/default.nix