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

none-ls: Add ability to specify custom servers #768

Closed
alesauce opened this issue Dec 2, 2023 · 2 comments · Fixed by #1169
Closed

none-ls: Add ability to specify custom servers #768

alesauce opened this issue Dec 2, 2023 · 2 comments · Fixed by #1169
Labels
enhancement New feature or request

Comments

@alesauce
Copy link

alesauce commented Dec 2, 2023

Plugin: none-ls
Plugin repository: URL to the repository of the plugin
Is the plugin on nixpkgs: Yes

Extra information

Issue #97 was created in late 2022 with a request to add ability to specify custom servers for null-ls. It was closed due to null-ls being archived, but now that the none-ls fork has been created and is used in the Nixvim plugin ecosystem, I'd like to reopen the request to add the ability to specify custom servers.

Unrelated - thank you to everyone who has contributed on this project! Your hard work is very much appreciated!!

@alesauce alesauce added the enhancement New feature or request label Dec 2, 2023
@garaiza-93
Copy link
Contributor

If it's using a builtin without configuring it further, it shouldn't be impossible to implement. It's basically the name of the source and its functionality and inserting that into the list of sources.

What's concerning though is configuring each source. Looking at docs it's not entirely consistent. Note how some sources have specific options. But I think we could have more control by having an option for configuring the source.

What i imagine is that a type could be made that's an attribute set of options for the name and functionality of a source. Optionally, a configure option that takes in a raw Lua string.

But idk how I would take that data and transform it into Lua code :(

Here's something I came up with

  extraSourceOption = types.submodule {
    #what would we need to add a source?
    #name, functionality, optional configuration, package
    #user can add package themselves.
    options = {
      name = mkOption {
        type = types.str;
        description = "Name of source";
      };
      functionality = mkOption {
        type = types.enum [
          "code_actions"
          "completion"
          "diagnostics"
          "formatting"
          "hover"
        ];
        description = "Functionality of source";
      };
      withConfig = helpers.mkNullOrOption helpers.nixvimTypes.rawLua ''
        Configuration that will be inserted into with().
        See [none-ls docs](https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTINS.md)
      '';
    };
  };

@garaiza-93
Copy link
Contributor

Actually, looking at the helpers for none-ls, a lot of the heavy lifting has already been done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants