nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.68k stars 1.75k forks source link

bug: helix doesn't support absolute paths for language servers #4525

Open zoedsoupe opened 11 months ago

zoedsoupe commented 11 months ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

Helix languages config options module documentation wrongly uses absolute paths for languages servers, which is not supported by Helix yet.

https://nix-community.github.io/home-manager/options.html#opt-programs.helix.languages

Setting up like the docs above gives the following error on Helix (elixir-ls in this example):

$ hx --health elixir

Configured language server: elixir-ls
Binary for language server: 'elixir-ls' not found in $PATH
Configured debug adapter: None
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓

More information can be found on a discussion thread created on the helix repo: https://github.com/helix-editor/helix/discussions/8457

Maintainer CC

No response

System information

- system: `"aarch64-darwin"`
 - host os: `Darwin 23.0.0, macOS 14.0`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.18.0`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
zoedsoupe commented 11 months ago

Solution is to add LSP clients packages directly on the home.packages attr or symlink those paths and wrap the helix executable manually.

zoedsoupe commented 11 months ago

maybe will be closed with https://github.com/helix-editor/helix/pull/8511

zoedsoupe commented 11 months ago

that’s strange because it actually does support absolute paths. but something is wrong when running and setting up helix with home manager…

I really need help with this because I don’t know where to start to search about this “bug"

mschwaig commented 10 months ago

I'm using an absolute path in my config, but I've found it difficult to write that config based on the few examples I found online.

Here's what I'm doing: https://github.com/mschwaig/nixos-config/blob/68df68e3b218627b283aad1fcbe08d7056500b5b/home/text/default.nix#L28-L37

Does this help you?

zoedsoupe commented 10 months ago

that’s exactly what i’m doing… using the flake that the helix provides seems to work fine with aboslute paths. however with the default derivation of home-manager it seems the package tries to read other config than the generated one. I’ll investigate but is a weid behaviour…

MOIS3Y commented 10 months ago

@zoedsoupe It looks like the helix version is 23.05 (7f5940be) the way of adding LSP has been changed since it refuses to accept the parameter

language-servers = [ "foo" "bar" ];
 hx test.nix
Bad language config: unknown field `language-servers`, expected one of `name`, `scope`, `file-types`, `shebangs`, `roots`, `comment-token`, `text-width`, `soft-wrap`, `config`, `auto-format`, `formatter`, `diagnostic-severity`, `grammar`, `injection-regex`, `language-server`, `indent`, `debugger`, `auto-pairs`, `rulers`, `workspace-lsp-roots`
in `language`

Now the configuration should look something like this:

# ...
languages = {
  language = [
    {
      name = "nix";
      auto-format = false;
      language-server = {
        name = "nil";
        command = "${pkgs.nil}/bin/nil";
        config = {};  # <-- important I don’t know why(
      };
    }
    # ... add more languages here:
  ];
};

Result healthcheck:

╰─➤  hx --health nix
Configured language server: /nix/store/v0y8i3wqjfjdpmavwndz8wrrknqql9k1-nil-2023-08-09/bin/nil
Binary for language server: /nix/store/v0y8i3wqjfjdpmavwndz8wrrknqql9k1-nil-2023-08-09/bin/nil
Configured debug adapter: None
Highlight queries: ✓
Textobject queries: ✘
Indent queries: ✘

╰─➤  hx --health python
Configured language server: /nix/store/2rrkscyqvfbg0wql8nj08yaril8scm3q-pyright-1.1.329/bin/pyright-langserver
Binary for language server: /nix/store/2rrkscyqvfbg0wql8nj08yaril8scm3q-pyright-1.1.329/bin/pyright-langserver
Configured debug adapter: None
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓
╭─stepan@workstation ~

2023-10-27_01-42

zoedsoupe commented 10 months ago

@MOIS3Y that makes sense but i'm building the flake from version 23.05 from their repo too and i can configure multiple language servers, as I already set up nextls and elixir-la for elixir.

i don't think this is the issue. i will try to build from home manager again and try to understand why is picking the wrong/default config and not the generated one.

stale[bot] commented 7 months ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.