-
-
Notifications
You must be signed in to change notification settings - Fork 58
nixd/Completion: fix isIncomplete flag handling #784
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
base: main
Are you sure you want to change the base?
Conversation
inclyc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how this fixes the issue. Also, regression tests should be added to ensure that the fix is verified.
|
This fixes the issue by checking the size of the vector after adding the last element. What was happening before this was that, there were only 30 Items, because the size was checked before adding a element the max size of Items was 29 and so never hit the 30 need to throw the error. |
|
I ran the regression test locally, they all passed. I do not know how to add them here sry. |
I see, then let's write some regression tests (like |
The code you modified appears to emplace items regardless of size. If the addItem method is called unconditionally, shouldn't the vector continue to grow unless an error is explicitly thrown? |
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.
72a3bf8 to
86c2238
Compare
|
I just wrote the tests for you, no worries. |
|
Ty I was struggling with that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests passed anyway however I think the real problem here is nixd/lib/Eval/AttrSetProvider.cpp where the options list is truncated but it does not notify the Controller the list is truncated.
nixd/nixd/lib/Eval/AttrSetProvider.cpp
Lines 366 to 368 in a6dfbbe
| // We set this a very limited number as to speedup | |
| if (Response.size() >= MaxItems) | |
| break; |
|
Regarding the unconditionally growth, the |
So maybe the correct fix is to add a |
|
Sounds reasonable, then you could remove the redundant |
No, because not only attrset provider may add items into the completion list. |
|
Okay didn't know that. So in that case the |
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.