|
| 1 | +/** |
| 2 | + * An item processed by the picker. |
| 3 | + */ |
1 | 4 | export type IdItem<T> = { |
2 | 5 | /** |
3 | | - * The unique identifier of the item. |
| 6 | + * Unique identifier for the item. |
4 | 7 | */ |
5 | | - readonly id: number; |
| 8 | + readonly id: unknown; |
6 | 9 |
|
7 | 10 | /** |
8 | | - * The value of the item. |
| 11 | + * Item's primary value. |
9 | 12 | */ |
10 | 13 | readonly value: string; |
11 | 14 |
|
12 | 15 | /** |
13 | | - * The detailed information of the item. |
| 16 | + * Detailed information about the item. |
14 | 17 | * |
15 | | - * This information is used in further processing. |
16 | | - * Developers should verify if the `detail` has the expected structure before using it |
17 | | - * and ignore the item if it does not. |
| 18 | + * Used for further processing. |
18 | 19 | */ |
19 | 20 | readonly detail: T; |
20 | 21 |
|
21 | 22 | /** |
22 | | - * The display label of the item. |
| 23 | + * Display label for the item in the picker. |
23 | 24 | * |
24 | | - * This label is used to display the item in the picker. |
25 | | - * If not specified, `value` is used. |
| 25 | + * If not specified, `value` is used as the label. |
26 | 26 | */ |
27 | 27 | label?: string; |
28 | 28 |
|
29 | 29 | /** |
30 | | - * Decorations to be applied to the line of the item in the picker. |
| 30 | + * Decorations applied to the item's line in the picker. |
31 | 31 | * |
32 | | - * These decorations highlight the matched part of the item, or are used for better visualization. |
33 | | - * Developers should respect existing `decorations` and extend them. |
| 32 | + * These decorations highlight matched parts or improve visualization. |
| 33 | + * Developers should respect and extend existing `decorations`. |
34 | 34 | * |
35 | | - * Note: If `highlight` is not specified, the picker will use the default highlight group |
36 | | - * for highlighting the matched part. |
| 35 | + * Note: If `highlight` is unspecified, the picker uses a default highlight |
| 36 | + * group to emphasize matched parts. |
37 | 37 | */ |
38 | 38 | decorations?: readonly ItemDecoration[]; |
39 | 39 | }; |
40 | 40 |
|
| 41 | +/** |
| 42 | + * An item displayed in the picker. |
| 43 | + */ |
41 | 44 | export type DisplayItem<T> = IdItem<T> & { |
42 | 45 | /** |
43 | | - * The display label of the item. |
| 46 | + * Display label for the item in the picker. |
44 | 47 | * |
45 | | - * This label is used to display the item in the picker. |
46 | | - * If not specified, `value` is used. |
| 48 | + * If unspecified, `value` is used as the label. |
47 | 49 | */ |
48 | 50 | label: string; |
49 | 51 |
|
50 | 52 | /** |
51 | | - * Decorations to be applied to the line of the item in the picker. |
| 53 | + * Decorations applied to the item's line in the picker. |
52 | 54 | * |
53 | | - * These decorations highlight the matched part of the item, or are used for better visualization. |
54 | | - * Developers should respect existing `decorations` and extend them. |
| 55 | + * These decorations highlight matched parts or improve visualization. |
| 56 | + * Developers should respect and extend existing `decorations`. |
55 | 57 | * |
56 | | - * Note: If `highlight` is not specified, the picker will use the default highlight group |
57 | | - * for highlighting the matched part. |
| 58 | + * Note: If `highlight` is unspecified, the picker uses a default highlight |
| 59 | + * group to emphasize matched parts. |
58 | 60 | */ |
59 | 61 | decorations: readonly ItemDecoration[]; |
60 | 62 | }; |
61 | 63 |
|
| 64 | +/** |
| 65 | + * An item used for previewing content in the picker. |
| 66 | + */ |
62 | 67 | export type PreviewItem = { |
63 | 68 | /** |
64 | | - * The content to preview. |
| 69 | + * Content to preview. |
65 | 70 | */ |
66 | 71 | readonly content: string[]; |
67 | 72 | /** |
68 | | - * The line number to jump to. |
| 73 | + * Line number to jump to. |
69 | 74 | */ |
70 | 75 | readonly line?: number; |
71 | 76 | /** |
72 | | - * The column number to jump to. |
| 77 | + * Column number to jump to. |
73 | 78 | */ |
74 | 79 | readonly column?: number; |
75 | 80 | /** |
76 | | - * The filetype used for highlighting. |
| 81 | + * Filetype for syntax highlighting. |
77 | 82 | */ |
78 | 83 | readonly filetype?: string; |
79 | 84 | /** |
80 | | - * The filename used in the buffer name. |
| 85 | + * Filename displayed in the buffer name. |
81 | 86 | */ |
82 | 87 | readonly filename?: string; |
83 | 88 | }; |
84 | 89 |
|
| 90 | +/** |
| 91 | + * Decoration applied to an item's line in the picker. |
| 92 | + */ |
85 | 93 | export type ItemDecoration = { |
86 | 94 | /** |
87 | | - * Column number (bytes) |
| 95 | + * Column number (in bytes). |
88 | 96 | */ |
89 | 97 | readonly column: number; |
90 | 98 | /** |
91 | | - * Length (bytes) |
| 99 | + * Length of the decoration (in bytes). |
92 | 100 | */ |
93 | 101 | readonly length: number; |
94 | 102 | /** |
95 | | - * Highlight name |
| 103 | + * Name of the highlight group. |
96 | 104 | */ |
97 | 105 | readonly highlight?: string; |
98 | 106 | }; |
0 commit comments