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

bug: Helix: Incorrect TOML Configuration Generated #2907

Closed
1 task done
billksun opened this issue Apr 22, 2022 · 5 comments
Closed
1 task done

bug: Helix: Incorrect TOML Configuration Generated #2907

billksun opened this issue Apr 22, 2022 · 5 comments
Assignees
Labels
bug triage Issues or feature request that have not been triaged yet

Comments

@billksun
Copy link
Contributor

billksun commented Apr 22, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Issue description

I am trying to override the language configuration for Helix. I want to produce the following languages.toml:

[[language]]
name = "haskell"
language-server = { command = "haskell-language-server", args = [] }

I have the following in my home-nix:

  programs.helix = {
    enable = true;
    languages = [
      {
        name = "haskell";
        language-server = { 
          command = "haskell-language-server";
          args = [];
        };
      }      
    ];
  };

But it instead produces this in languages.toml:

[[language]]
name = "haskell"

[language.language-server]
args = []
command = "haskell-language-server"

Maintainer CC

@Philipp-M

System information

 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.34, NixOS, 22.05 (Quokka), 22.05pre369988.1ffba9f2f68`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.0pre20220411_f7276bc`
 - channels(root): `"nixos"`
 - channels(bill): `"home-manager"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@billksun billksun added bug triage Issues or feature request that have not been triaged yet labels Apr 22, 2022
@Philipp-M
Copy link
Contributor

[[language]]
name = "haskell"
language-server = { command = "haskell-language-server", args = [] }

and

[[language]]
name = "haskell"

[language.language-server]
args = []
command = "haskell-language-server"

is actually equivalent in what is interpreted by helix. Is there any issue with it?

Might this: helix-editor/helix#1000 be related?

Other issues/PRs regarding this issue:
helix-editor/helix#2145
helix-editor/helix#2215

@billksun
Copy link
Contributor Author

billksun commented Apr 22, 2022

Oh, I didn't know that! But indeed Helix seem to be okay with that config.

I'm not too familiar with TOML, but how does the parser know to apply the haskell-language-server config to haskell and not another language? I assumed they needed to be in the same block. Or is the ordering here significant as well? For example, if I had:

[[language]]
name = "haskell"

[language.language-server]
args = []
command = "python-lsp-server"

[[language]]
name = "python"

[language.language-server]
args = []
command = "haskell-language-server"

The Python language server would be grouped with haskell and the Haskell language server would be grouped with python?

@Philipp-M
Copy link
Contributor

It's in the TOML spec:
https://toml.io/en/v1.0.0#array-of-tables

So yeah, for your example the order is relevant.

@berbiche
Copy link
Member

nixpkgs' pkgs.formats.toml uses https://github.com/dbohdan/remarshal I believe to convert the JSON representation of the nix expression to TOML.

An issue should be opened against https://github.com/dbohdan/remarshal with the sample generated JSON for your languages entry: {"languages":[{"language-server":{"args":[],"command":"haskell-language-server"},"name":"haskell"}]}, and another issue should be opened on nixpkgs to track the issue.

@billksun
Copy link
Contributor Author

@Philipp-M, thank you for the information and links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Issues or feature request that have not been triaged yet
Projects
None yet
Development

No branches or pull requests

5 participants