LnL7 / vim-nix

Vim configuration files for Nix http://nixos.org/nix
MIT License
287 stars 26 forks source link

syntax/nix: autogenerate namespaced builtins from `nix __dump-language` #59

Closed Ma27 closed 4 months ago

Ma27 commented 4 months ago

We had quite a bunch of changes in the past that added builtins to get them highlighted properly[1].

Nowadays it's possible to get this from Nix itself by running nix __dump-language. This was done on a recent Nix and includes all experimental features by default[2] which seems fine to me since this is not an LSP, but only an approximation.

This patch adds a few new builtins, e.g. break and flakeRefToString and a script to regenerate the list.

This doesn't include non-scoped builtins (e.g. map, baseNameOf etc.), but those are added far less frequent, so this seems OK to me.

Also, there are a few hidden builtins, most notably unsafe* and scopedImport. I think this was done on purpose by upstream and I'm wondering if we should adhere to that approach. If we still want to keep those, I think we should add those to a custom highlighting group that's maintained manually.

[1] #44, #42, #36, #32, 711aaf7edfd1d04bb981871f53ffec2b62f79b15 [2] https://github.com/NixOS/nix/blob/2.20.1/src/nix/main.cc#L372

cc @LnL7 @aszlig for opinions