(kind: Node['kind'])
| 386 | * Functions and classes are typically more relevant than variables/imports |
| 387 | */ |
| 388 | export function kindBonus(kind: Node['kind']): number { |
| 389 | const bonuses: Record<string, number> = { |
| 390 | function: 10, |
| 391 | method: 10, |
| 392 | class: 8, |
| 393 | interface: 9, |
| 394 | type_alias: 6, |
| 395 | struct: 6, |
| 396 | trait: 9, |
| 397 | enum: 5, |
| 398 | component: 8, |
| 399 | route: 9, |
| 400 | module: 4, |
| 401 | property: 3, |
| 402 | field: 3, |
| 403 | variable: 2, |
| 404 | constant: 3, |
| 405 | import: 1, |
| 406 | export: 1, |
| 407 | parameter: 0, |
| 408 | namespace: 4, |
| 409 | file: 0, |
| 410 | protocol: 9, |
| 411 | enum_member: 3, |
| 412 | }; |
| 413 | return bonuses[kind] ?? 0; |
| 414 | } |
| 415 | |
| 416 | /** |
| 417 | * Whether a query token looks like a code identifier the user deliberately typed |