nixd
nixd copied to clipboard
Implementing LSP Features for devenv.sh
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:
-
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. -
Custom Flake Handling:
devenvuses its own version of nix and a custom implementation of the flake (.devenv.flake.nix). The defaultbuiltins.getFlakedoesn't work with this setup, so we need an alternative method to parse this flake. -
Custom Option Completion: While the current implementation works in case of the default
devenvoptions, but in case we are defining custom option in thedevenv.nixfile, 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 fornixd. -
Dynamic JSON Support: Another option discussed is enabling
nixdto support a JSON format that could be generated dynamically and provided to the LSP.
pinging @domenkozar @sandydoo for their input on this discussion
I'm glad to accept PRs to get language support for devenv.
- Another option discussed is enabling
nixdto 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 fornixd.
The solution LGTM, I kindly ask what is that "required data structure"?
Kindly ping @domenkozar @sandydoo, this proposal is getting stuck for a while, would you like to take a look?
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.