Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompletion options for Nix (nixd) #4593

Merged
merged 3 commits into from
Oct 25, 2024
Merged

Conversation

breitnw
Copy link
Contributor

@breitnw breitnw commented Oct 24, 2024

This PR adds more comprehensive options for the nixd language server, including those necessary for formatting and completion. As mentioned in #4592, these options were previously absent.

The options added include:

  • lsp-nix-nixd-nixpkgs-expr, which provides completion for nixpkgs
  • lsp-nix-nixd-nixos-options-expr, which provides completion for NixOS options
  • lsp-nix-nixd-home-manager-options-expr, which provides completion for Home Manager options
  • lsp-nix-nixd-formatting-command, which sets the formatter used by nixd

An example configuration in Doom:

(after! lsp-mode
  (setq lsp-nix-nixd-formatting-command [ "nixfmt" ]
        lsp-nix-nixd-nixpkgs-expr "import <nixpkgs> { }"
        lsp-nix-nixd-nixos-options-expr "(builtins.getFlake \"/home/breitnw/Documents/code/nixos\").nixosConfigurations.mnd.options"
        lsp-nix-nixd-home-manager-options-expr "(builtins.getFlake \"/home/breitnw/Documents/code/nixos\").homeConfigurations.\"breitnw@mnd\".options"))

(add-hook! 'nix-mode-hook
           (setq company-idle-delay 0.1))

@github-actions github-actions bot added the client One or more of lsp-mode language clients label Oct 24, 2024
@breitnw breitnw changed the title Autocompletion options for Nix (nixd Autocompletion options for Nix (nixd) Oct 24, 2024
@psibi psibi merged commit 1c407ec into emacs-lsp:master Oct 25, 2024
11 of 13 checks passed
@psibi
Copy link
Member

psibi commented Oct 25, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client One or more of lsp-mode language clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants