nix-community / nix-ts-mode

An Emacs major mode for editing Nix expressions, powered by tree-sitter [maintainer=@remi-gelinas]
https://github.com/nix-community/nix-ts-mode
Other
50 stars 9 forks source link

Use SMIE indentation like nix-mode #39

Closed arthsmn closed 1 month ago

arthsmn commented 1 month ago

I found some problems with indentation that I couldn't find in nix-mode, and it seems that they use SMIE as the indentation engine, while having a fallback for the old behaviour. Also, there's a PR to unify the methods and just fallback to the old one if SMIE isn't suitable.

Relevant PRs: https://github.com/NixOS/nix-mode/pull/79 https://github.com/NixOS/nix-mode/pull/80 https://github.com/NixOS/nix-mode/pull/86 https://github.com/NixOS/nix-mode/pull/198

Related link: https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE.html

purcell commented 1 month ago

SMIE is the most recent – and probably best – mechanism for encoding indentation in regular Emacs major modes. However, we wouldn't use SMIE here because treesitter allows even better indentation support, and that's kinda the point of nix-ts-mode. If there are specific indentation issues you've observed with nix-ts-mode, feel free to open an issue (or re-title/edit this one). See also #27. Now that nixpkgs is heading towards standardising on nixfmt, I strongly feel we should aim to match its behaviour here.

arthsmn commented 1 month ago

@purcell thanks for the explanation! This issue isn't related to my problem, so I'll open a PR to address this.