From 86c2238a006ea6e351b196db0fa4e4aef06f415c Mon Sep 17 00:00:00 2001 From: steinlu Date: Mon, 9 Feb 2026 01:46:33 +0100 Subject: [PATCH] nixd/Completion: fix isIncomplete flag handling When typing a attribute like services.x only the first 30 solutions would be displayed and the isIncomplete flag was always set to false. Moving the bounds check fixed this and isincomplete can now be true. --- nixd/lib/Controller/Completion.cpp | 2 +- nixd/tools/nixd/test/completion/options-incomplete.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nixd/lib/Controller/Completion.cpp b/nixd/lib/Controller/Completion.cpp index bea1e3e56..6956898ae 100644 --- a/nixd/lib/Controller/Completion.cpp +++ b/nixd/lib/Controller/Completion.cpp @@ -42,10 +42,10 @@ struct ExceedSizeError : std::exception { }; void addItem(std::vector &Items, CompletionItem Item) { + Items.emplace_back(std::move(Item)); if (Items.size() >= MaxCompletionSize) { throw ExceedSizeError(); } - Items.emplace_back(std::move(Item)); } class VLACompletionProvider { diff --git a/nixd/tools/nixd/test/completion/options-incomplete.md b/nixd/tools/nixd/test/completion/options-incomplete.md index 2381ad118..490b82e3d 100644 --- a/nixd/tools/nixd/test/completion/options-incomplete.md +++ b/nixd/tools/nixd/test/completion/options-incomplete.md @@ -62,7 +62,7 @@ CHECK: "id": 1, CHECK-NEXT: "jsonrpc": "2.0", CHECK-NEXT: "result": { -CHECK-NEXT: "isIncomplete": false, +CHECK-NEXT: "isIncomplete": true, ```