nixd
nixd copied to clipboard
Autocompletion does not work on the first line a configuration object
Describe the bug Opening an object doesn't offer nixd autocompletions in the first line of the object
Logs (Required)
I[13:40:09.508] 8062: <-- textDocument/didChange
I[13:40:09.508] 8062: --> notify textDocument/publishDiagnostics
I[13:40:09.526] 8062: <-- textDocument/completion(1142)
I[13:40:09.526] 8062: --> reply:textDocument/completion(1142)
I[13:40:09.769] 8062: <-- textDocument/codeAction(1143)
I[13:40:09.769] 8062: --> reply:textDocument/codeAction(1143)
I[13:40:09.808] 8062: <-- textDocument/semanticTokens/full(1144)
I[13:40:09.808] 8062: --> reply:textDocument/semanticTokens/full(1144)
I[13:40:09.859] 8062: <-- textDocument/documentSymbol(1145)
I[13:40:09.859] 8062: <-- textDocument/documentSymbol(1146)
I[13:40:09.860] 8062: --> reply:textDocument/documentSymbol(1145)
I[13:40:09.860] 8062: --> reply:textDocument/documentSymbol(1146)
I[13:40:10.509] 8062: <-- textDocument/documentLink(1147)
I[13:40:10.509] 8062: --> reply:textDocument/documentLink(1147)
I[13:40:10.759] 8062: <-- textDocument/inlayHint(1148)
I[13:40:10.759] 8062: --> call attrset/attrpathInfo(1403)
I[13:40:10.759] 8062: <-- reply(1403)
I[13:40:10.759] 8062: --> call attrset/attrpathInfo(1404)
I[13:40:10.759] 8062: <-- reply(1404)
I[13:40:10.759] 8062: --> call attrset/attrpathInfo(1405)
I[13:40:10.760] 8062: <-- reply(1405)
I[13:40:10.760] 8062: --> call attrset/attrpathInfo(1406)
I[13:40:10.760] 8062: <-- reply(1406)
I[13:40:10.760] 8062: --> call attrset/attrpathInfo(1407)
I[13:40:10.760] 8062: <-- reply(1407)
I[13:40:10.760] 8062: --> call attrset/attrpathInfo(1408)
I[13:40:10.760] 8062: <-- reply(1408)
I[13:40:10.760] 8062: --> call attrset/attrpathInfo(1409)
I[13:40:10.761] 8062: <-- reply(1409)
I[13:40:10.761] 8062: --> call attrset/attrpathInfo(1410)
I[13:40:10.761] 8062: <-- reply(1410)
I[13:40:10.761] 8062: --> call attrset/attrpathInfo(1411)
I[13:40:10.761] 8062: <-- reply(1411)
I[13:40:10.761] 8062: --> call attrset/attrpathInfo(1412)
I[13:40:10.761] 8062: <-- reply(1412)
I[13:40:10.761] 8062: --> call attrset/attrpathInfo(1413)
I[13:40:10.761] 8062: <-- reply(1413)
I[13:40:10.761] 8062: --> call attrset/attrpathInfo(1414)
I[13:40:10.762] 8062: <-- reply(1414)
I[13:40:10.762] 8062: --> call attrset/attrpathInfo(1415)
I[13:40:10.762] 8062: <-- reply(1415)
I[13:40:10.762] 8062: --> reply:textDocument/inlayHint(1148)
Configuration
"nix.serverPath": "nixd",
"nix.serverSettings": {
// settings for 'nixd' LSP
"nixd": {
"formatting": {
// This is the default if ommited.
"command": [ "nixfmt" ]
},
"options": {
// By default, this entriy will be read from `import <nixpkgs> { }`
// You can write arbitary nix expression here, to produce valid "options" declaration result.
// Tip: for flake-based configuration, utilize `builtins.getFlake`
"nixos": {
"expr": "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.nixos.options"
},
"home-manager": {
"expr": "(builtins.getFlake \"/etc/nixos\").homeConfigurations.\"niko\".options"
}
}
}
}
To Reproduce Steps to reproduce the behavior:
- type
programs.foot = { }; - type e in the brackets
- generic intellisense autocompletes are coming up instead for "enable"
Expected behavior It should show options available for the program, like it would when typing programs.foot.e
Additional context
- nixd 2.2.2
- vscode 1.9.1
- nix ide v0.3.1
That is because when you type { somename| , the construct is guessed as a part of lambda functions, while the completion lists provided by nixd are context-aware (i.e. iff the cursor is in an attribute set).
Completions are expected to work with the following snippet, though:
{
foo = 1;
ba|
}