Skip to content

Completion fixes#698

Open
oandrew wants to merge 3 commits into
nix-community:mainfrom
oandrew:completion-fixes
Open

Completion fixes#698
oandrew wants to merge 3 commits into
nix-community:mainfrom
oandrew:completion-fixes

Conversation

@oandrew

@oandrew oandrew commented Jun 23, 2025

Copy link
Copy Markdown

fixes #653

  • show completions when no text under cursor
  • increase number of returned completions to 1000
  • remove prefix filtering to let vscode do fuzzy matching i.e. typing networking.net will also suggest useNetworkd.

quick video:

nixd.mov

@oandrew oandrew requested a review from inclyc as a code owner June 23, 2025 17:44

@inclyc inclyc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix regression tests.

oandrew added 3 commits June 24, 2025 17:59
Display all available completion options within the current attrset even if it's empty or there is no text under the cursor.
@oandrew oandrew force-pushed the completion-fixes branch from c34567c to 4cd9d17 Compare June 25, 2025 01:05

@inclyc inclyc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I think:

  • The current approach also provides completion suggestions within comment content, which I believe is undesirable.
  • We should develop a parser that preserves the position of comments, so that we can check whether the location of the "completion" is inside a comment when performing it.

CHECK-NEXT: "result": {
CHECK-NEXT: "isIncomplete": false,
CHECK-NEXT: "items": []
CHECK-NEXT: "items": [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the previous version gave more accurate results because the current "completion" feature is essentially providing completions within the "comments," which might confuse users.

namespace {

constexpr int MaxItems = 30;
constexpr int MaxItems = 1000;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the motivation or necessity behind this?


const auto *Desc = AST->descend({Pos, Pos});
CheckDefault(Desc && Desc->children().empty());
CheckDefault(Desc);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line of code previously protected us from providing code completions within "comments."

@bolives-hax

Copy link
Copy Markdown

Very nice

@DerRockWolf

Copy link
Copy Markdown

@oandrew friendly ping 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display full completion list when inside attribute set

4 participants