nixd icon indicating copy to clipboard operation
nixd copied to clipboard

Implementing LSP Features for devenv.sh

Open k3yss opened this issue 1 year ago • 1 comments

I've been working on implementing LSP features for devenv.sh and have submitted the following proof-of-concept PRs: PR 1 and PR 2. While the current implementation works, it has the following issues:

  1. Version Compatibility: The flake is fetched from the latest master branch. This approach can cause issues for users on older versions of devenv, as they won't receive the correct completions for their version.

  2. Custom Flake Handling: devenv uses its own version of nix and a custom implementation of the flake (.devenv.flake.nix). The default builtins.getFlake doesn't work with this setup, so we need an alternative method to parse this flake.

  3. Custom Option Completion: While the current implementation works in case of the default devenv options, but in case we are defining custom option in the devenv.nix file, it won't load. The only probable solution to this, is to parse the devenv flake (.devenv.flake.nix)

Desired Solution

After discussions with the maintainers of devenv, a probable solution has been identified:

  • Autocomplete Command: We could introduce a command, such as devenv autocomplete-options, that generates the required data structure for nixd.

  • Dynamic JSON Support: Another option discussed is enabling nixd to support a JSON format that could be generated dynamically and provided to the LSP.

pinging @domenkozar @sandydoo for their input on this discussion

k3yss avatar Aug 21 '24 17:08 k3yss

I'm glad to accept PRs to get language support for devenv.

  • Another option discussed is enabling nixd to support a JSON format that could be generated dynamically and provided to the LSP.

I don't think it is a good idea to open general dynamic settings in configuration, otherwise finally we will invent a broken LISP interpreter. If this is necessary, then it should be devenv-specific at first.

  • We could introduce a command, such as devenv autocomplete-options, that generates the required data structure for nixd.

The solution LGTM, I kindly ask what is that "required data structure"?

inclyc avatar Aug 27 '24 11:08 inclyc

Kindly ping @domenkozar @sandydoo, this proposal is getting stuck for a while, would you like to take a look?

inclyc avatar Oct 14 '24 08:10 inclyc

Sorry, I forgot to close this. We are now working on our own implementation of a lsp as the current implementation doesn't aligns with the project goals.

k3yss avatar Oct 14 '24 11:10 k3yss