Skip to content

Completion fixes #698

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

oandrew
Copy link

@oandrew oandrew commented Jun 23, 2025

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
Copy link
Member

@inclyc inclyc left a comment

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
Copy link
Member

@inclyc inclyc left a comment

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.

@@ -52,7 +52,15 @@
CHECK-NEXT: "jsonrpc": "2.0",
CHECK-NEXT: "result": {
CHECK-NEXT: "isIncomplete": false,
CHECK-NEXT: "items": []
CHECK-NEXT: "items": [
Copy link
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.

@@ -14,7 +14,7 @@ using namespace lspserver;

namespace {

constexpr int MaxItems = 30;
constexpr int MaxItems = 1000;
Copy link
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
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."

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
2 participants