Skip to content

feat: completion list suggests constructor like & builder methods first#16117

Merged
bors merged 3 commits into
rust-lang:masterfrom
mustakimali:mo-order
Feb 13, 2024
Merged

feat: completion list suggests constructor like & builder methods first#16117
bors merged 3 commits into
rust-lang:masterfrom
mustakimali:mo-order

Conversation

@mustakimali

@mustakimali mustakimali commented Dec 13, 2023

Copy link
Copy Markdown
Contributor

When typing MyType:: the completion items' order could be re-ordered based on how likely we want to select those:

  • Constructors: new like functions to be able to create the type,
  • Constructors that take args: Any other function that creates Self,
  • Builder Methods: any builder methods available,
  • Regular methods & associated functions (no change there)

image

In this photo, the order is:

  • new constructor is first
  • new_builder second is a builder method
  • aaaanew is a constructor that takes arguments, is third and is irrespective of its alphabetical order among names.

Another Example using actix HttpServer shows preferring constructor without self arg first (the new method)

image

image

I've dropped my previous idea of highlighting these functions in the rustdoc (rust-lang/rust#107926)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 13, 2023
Comment thread crates/ide-completion/src/item.rs Outdated
Comment thread crates/ide-completion/src/render/function.rs Outdated
Comment thread crates/ide-completion/src/render/function.rs Outdated
@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 3, 2024
@mustakimali mustakimali requested a review from Veykril January 5, 2024 21:43
@bors

bors commented Jan 10, 2024

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #16274) made this pull request unmergeable. Please resolve the merge conflicts.

Comment thread crates/ide-completion/src/item.rs Outdated
Comment thread crates/ide-completion/src/item.rs Outdated
Comment thread crates/ide-completion/src/render/function.rs Outdated
Comment thread crates/ide-completion/src/render/function.rs Outdated
Comment thread crates/ide-completion/src/render/function.rs Outdated
@Veykril Veykril added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 10, 2024
@rustbot

rustbot commented Jan 15, 2024

Copy link
Copy Markdown
Collaborator

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git rebase -i master
$ # delete any merge commits in the editor that appears
$ git push --force-with-lease

The following commits are merge commits:

@mustakimali mustakimali requested a review from Veykril January 24, 2024 19:58
@mustakimali mustakimali changed the title feat: completion list suggests methods in the order we most likely want feat: completion list suggests constructor like & builder methods first Jan 24, 2024
@Veykril Veykril added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits labels Feb 9, 2024
Comment thread crates/ide-completion/src/render/function.rs Outdated
Comment thread crates/ide-completion/src/render/function.rs Outdated
Comment thread crates/ide-completion/src/render/function.rs Outdated
Comment thread crates/ide-completion/src/render/function.rs Outdated
@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 12, 2024
@mustakimali mustakimali force-pushed the mo-order branch 2 times, most recently from c8f9815 to ad700ed Compare February 12, 2024 22:30
@mustakimali mustakimali force-pushed the mo-order branch 2 times, most recently from 1f9e686 to 2464387 Compare February 12, 2024 23:09
@Veykril

Veykril commented Feb 13, 2024

Copy link
Copy Markdown
Member

Thanks!
@bors r+

@bors

bors commented Feb 13, 2024

Copy link
Copy Markdown
Contributor

📌 Commit 2c76104 has been approved by Veykril

It is now in the queue for this repository.

@bors

bors commented Feb 13, 2024

Copy link
Copy Markdown
Contributor

⌛ Testing commit 2c76104 with merge 3c4d642...

@bors

bors commented Feb 13, 2024

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 3c4d642 to master...

@bors bors merged commit 3c4d642 into rust-lang:master Feb 13, 2024
@mustakimali mustakimali deleted the mo-order branch February 13, 2024 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants