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

No completion available in flakes #567

Open
antoineco opened this issue Aug 3, 2024 · 6 comments
Open

No completion available in flakes #567

antoineco opened this issue Aug 3, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@antoineco
Copy link

antoineco commented Aug 3, 2024

Describe the bug

Inside Neovim, I am not seeing any relevant completion, or even hover information, while editing a flake.

I do see LSP progress events emitted by nixd (below), but no relevant LSP feature seems to be functional.

# lsp progress
nixd [evaluating nixpkgs entries]
nixd [evaluating nixos options]
nixd [evaluating nixpkgs entries] evaluated nixpkgs entries
nixd [evaluating nixos options] evaluated nixos options

Logs (Required)

[START][2024-08-03 10:21:29] LSP logging initiated
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I["
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:29.372] 81282: <-- "
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"initialize(1)\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.372] 81282: --> reply:initialize(1)\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.372] 81282: --> call window/workDoneProgress/create(1)\nI[10:21:29.373] 81282: --> notify $/progress\nI[10:21:29.373] 81282: --> call attrset/evalExpr(1)\nI[10:21:29.373] 81282: --> call window/workDoneProgress/create(2)\nI[10:21:29.373] 81282: --> notify $/progress\nI[10:21:29.373] 81282: --> call attrset/evalExpr(1)\nI[10:21:29.373"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"] 81282: --> call workspace/configuration(3)\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.373] 81282: <-- initialized\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.373] 81282: <-- textDocument/didOpen\nI[10:21:29.373] 81282: --> notify textDocument/publishDiagnostics\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.373] 81282: <-- textDocument/semanticTokens/full(2)\nI[10:21:29.373] 81282: --> reply:textDocument/semanticTokens/full(2)\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.374] 81282: <-- reply(1)\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.374] 81282: <-- reply(2)\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.374] 81282: <-- reply(3)\nE[10:21:29.374] 81282: workspace/configuration: parse error expected object\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.662] 81282: <-- reply(1)\n"
[ERROR][2024-08-03 10:21:29] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:29.662] 81282: --> notify $/progress\n"
[ERROR][2024-08-03 10:21:30] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:30.065] 81282: <-- reply(1)\n"
[ERROR][2024-08-03 10:21:30] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:30.065] 81282: --> notify $/progress\n"
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I["
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:34.603] 81282: <-- textDocument/didChange\n"
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:34.603] 81282: --> notify textDocument/publishDiagnostics\n"
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:34.652"
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"] 81282: <-- textDocument/semanticTokens/full(3)\nI[10:21:34.653] 81282: --> reply:textDocument/semanticTokens/full(3)\n"
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:34.669] 81282: <-- textDocument/didChange\nI[10:21:34.669] 81282: --> notify textDocument/publishDiagnostics\nI[10:21:34.669] 81282: <-- textDocument/completion(4)\nI[10:21:34.669] 81282: --> call attrset/optionComplete(2)\nI[10:21:34.670] 81282: <-- reply(2)\nI[10:21:34.670] 81282: --> reply:textDocument/completion(4)\n"
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I["
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:34.819] 81282: <-- textDocument/didChange\n"
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:34.820] 81282: "
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"--> notify textDocument/publishDiagnostics\n"
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I["
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:34.972] 81282: <-- textDocument/semanticTokens/full(5)\nI[10:21:34.972] 81282: --> reply:textDocument/semanticTokens/full(5)\n"
[ERROR][2024-08-03 10:21:34] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:34.985] 81282: <-- textDocument/didChange\nI[10:21:34.985] 81282: --> notify textDocument/publishDiagnostics\n"
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I["
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:35.135] 81282: <-- textDocument/didChange\n"
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:35.135] 81282: "
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"--> notify textDocument/publishDiagnostics\n"
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:35.271] 81282: <-- textDocument/semanticTokens/full(6)\nI[10:21:35.271] 81282: --> reply:textDocument/semanticTokens/full"
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"(6)\n"
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I["
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:35.285] 81282: <-- textDocument/didChange\nI[10:21:35.285] 81282: --> notify textDocument/publishDiagnostics\n"
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I["
[ERROR][2024-08-03 10:21:35] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:35.473] 81282: <-- textDocument/semanticTokens/full(7)\nI[10:21:35.473] 81282: --> reply:textDocument/semanticTokens/full(7)\n"
[ERROR][2024-08-03 10:21:36] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:36.549] 81282: <-- textDocument/completion(8)\nI[10:21:36.550] 81282: --> call attrset/optionComplete(3)\nI["
[ERROR][2024-08-03 10:21:36] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:36.550] 81282: <-- reply(3)\nI[10:21:36.551] 81282: --> reply:textDocument/completion(8)\n"
[ERROR][2024-08-03 10:21:38] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:38.688] 81282: <-- textDocument/didChange\n"
[ERROR][2024-08-03 10:21:38] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:38.689] 81282: --> notify textDocument/publishDiagnostics\n"
[ERROR][2024-08-03 10:21:38] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I["
[ERROR][2024-08-03 10:21:38] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:38.838] 81282: <-- textDocument/didChange\n"
[ERROR][2024-08-03 10:21:38] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:38.838] 81282: --> notify textDocument/publishDiagnostics"
[ERROR][2024-08-03 10:21:38] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"\n"
[ERROR][2024-08-03 10:21:38] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I["
[ERROR][2024-08-03 10:21:38] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"10:21:38.889] 81282: <-- textDocument/semanticTokens/full(9)\nI[10:21:38.889] 81282: --> reply:textDocument/semanticTokens/full(9)\n"
[ERROR][2024-08-03 10:21:39] .../vim/lsp/rpc.lua:772	"rpc"	"/nix/store/9y0zng78x996v0i0fh1yys87z9ysils1-nixd-2.3.0/bin/nixd"	"stderr"	"I[10:21:39.558] 81282: <-- shutdown(10)\nI[10:21:39.558] 81282: --> reply:shutdown(10)\n"

Configuration

None (nvim-lspconfig's default)

To Reproduce

  1. Open a Nix shell that includes the nixd package from Nixpkgs:

    $ nix shell 'nixpkgs#nixd'
  2. Add the following line to Neovim's init.lua, assuming that the neovim/nvim-lspconfig plugin is installed:

    require "lspconfig".nixd.setup {}
  3. Open the following flake.nix at https://github.com/antoineco/dotfiles/blob/ae64add/nix/flakes/shells/go in Neovim.

  4. Attempt to complete something from the nixpkgs input variable, or to hover an attribute from it.

Expected behavior

  • The language server offers completion options for the flake's inputs and outputs attributes.
  • The language server offers information about attributes upon performing a LSP hover.

Screenshots

Example: no completion of nixpkgs.outputs.lib or nixpkgs.outputs.legacyPackages:
Screenshot 2024-08-03 at 10 15 17

Additional context

-

@antoineco antoineco added the bug Something isn't working label Aug 3, 2024
@antoineco
Copy link
Author

As an additional information, I am observing the same behaviour using the output of github:nix-community/nixd#nvim (nvim-lsp command) in a development shell:

Screenshot 2024-08-03 at 10 28 53

@inclyc
Copy link
Member

inclyc commented Aug 3, 2024

Seems to be an unimplemented feature.

@inclyc inclyc added enhancement New feature or request and removed bug Something isn't working labels Aug 3, 2024
@antoineco
Copy link
Author

Ah right, I just stumbled upon https://github.com/nix-community/nixd/blob/2.3.0/nixd/docs/features.md. I did not understand that nixd was only providing inlay hints and semantic highlights. Sorry for the noise!

@antoineco antoineco closed this as not planned Won't fix, can't repro, duplicate, stale Aug 3, 2024
@antoineco
Copy link
Author

Note that https://www.reddit.com/r/NixOS/s/Tsp4msODn3 is claiming that these features are in fact implemented, just to provide context about where I'm coming from.

@inclyc
Copy link
Member

inclyc commented Aug 3, 2024

Note that https://www.reddit.com/r/NixOS/s/Tsp4msODn3 is claiming that these features are in fact implemented, just to provide context about where I'm coming from.

Currently only some idioms in Nix language are implemented. So it can be expected that nixd cannot deal with the general case (at least for now).

I'd like to reopen this issue because the reporting is valid and maybe we'd like to have this feature in the future.

@inclyc inclyc reopened this Aug 3, 2024
@fzakaria
Copy link

fzakaria commented Aug 3, 2024

I noticed this in my VsCode as well; my project is flake based and it only seems to go to definition of where it's declared in my flake not any further.

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

No branches or pull requests

3 participants