This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 3c4d642
committed
Auto merge of rust-lang#16117 - mustakimali:mo-order, r=Veykril
feat: completion list suggests constructor like & builder methods first
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)

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)


I've dropped my previous idea of highlighting these functions in the rustdoc (rust-lang#107926)File tree
3 files changed
+438
-4
lines changed- crates/ide-completion/src
- render
3 files changed
+438
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
| |||
207 | 209 | | |
208 | 210 | | |
209 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
210 | 230 | | |
211 | 231 | | |
212 | 232 | | |
| |||
231 | 251 | | |
232 | 252 | | |
233 | 253 | | |
| 254 | + | |
234 | 255 | | |
235 | 256 | | |
236 | 257 | | |
| |||
275 | 296 | | |
276 | 297 | | |
277 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
278 | 326 | | |
279 | 327 | | |
280 | 328 | | |
| |||
0 commit comments