@adecore/editor-react 0.41.1 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/CallHierarchyPanel.js +177 -181
  2. package/dist/EditorContextMenu.js +118 -105
  3. package/dist/EditorView.js +7 -1
  4. package/dist/LanguagePopups.js +7 -0
  5. package/dist/PickPopup.js +190 -70
  6. package/dist/WrapCard.d.ts +8 -0
  7. package/dist/WrapCard.js +172 -0
  8. package/dist/call-hierarchy-model.d.ts +4 -2
  9. package/dist/call-hierarchy-model.js +20 -0
  10. package/dist/call-hierarchy.d.ts +3 -0
  11. package/dist/call-hierarchy.js +54 -22
  12. package/dist/clipboard-history.d.ts +31 -0
  13. package/dist/clipboard-history.js +70 -0
  14. package/dist/code-actions.d.ts +3 -1
  15. package/dist/code-actions.js +50 -10
  16. package/dist/code-vision.js +2 -3
  17. package/dist/completion.js +10 -15
  18. package/dist/context-menu-rows.d.ts +1 -1
  19. package/dist/context-menu-rows.js +4 -0
  20. package/dist/definition-link.js +15 -5
  21. package/dist/document-colors.d.ts +24 -0
  22. package/dist/document-colors.js +194 -0
  23. package/dist/document-links.d.ts +22 -0
  24. package/dist/document-links.js +133 -0
  25. package/dist/document-query.d.ts +15 -0
  26. package/dist/document-query.js +54 -0
  27. package/dist/edit-locations.d.ts +20 -0
  28. package/dist/edit-locations.js +136 -0
  29. package/dist/editor-language.d.ts +19 -1
  30. package/dist/editor-language.js +77 -2
  31. package/dist/emmet.d.ts +13 -0
  32. package/dist/emmet.js +62 -0
  33. package/dist/folding.js +2 -3
  34. package/dist/format-on-type.js +3 -5
  35. package/dist/highlights.js +2 -3
  36. package/dist/history.d.ts +7 -0
  37. package/dist/history.js +79 -1
  38. package/dist/host-types.d.ts +6 -0
  39. package/dist/index.d.ts +11 -2
  40. package/dist/index.js +8 -0
  41. package/dist/inlay-hints.js +2 -2
  42. package/dist/inline-completion.d.ts +39 -0
  43. package/dist/inline-completion.js +221 -0
  44. package/dist/key-priority.d.ts +8 -5
  45. package/dist/key-priority.js +9 -6
  46. package/dist/linked-editing.d.ts +26 -0
  47. package/dist/linked-editing.js +215 -0
  48. package/dist/locales/en.json +31 -2
  49. package/dist/locales/nl.json +31 -2
  50. package/dist/markup-context.d.ts +37 -0
  51. package/dist/markup-context.js +291 -0
  52. package/dist/markup.d.ts +36 -0
  53. package/dist/markup.js +453 -0
  54. package/dist/navigation.js +4 -6
  55. package/dist/paste-history.d.ts +7 -0
  56. package/dist/paste-history.js +104 -0
  57. package/dist/peek.js +3 -4
  58. package/dist/pick.d.ts +20 -2
  59. package/dist/pick.js +141 -18
  60. package/dist/popups.d.ts +9 -0
  61. package/dist/popups.js +2 -1
  62. package/dist/project-language.d.ts +18 -1
  63. package/dist/project-language.js +129 -18
  64. package/dist/rename.js +8 -11
  65. package/dist/rendered-docs.js +1 -2
  66. package/dist/selection-ranges.js +2 -3
  67. package/dist/shortcut-keys.d.ts +27 -0
  68. package/dist/signature.js +3 -6
  69. package/dist/snippet-session.d.ts +2 -2
  70. package/dist/snippet-session.js +3 -3
  71. package/dist/symbol-picker.js +4 -6
  72. package/dist/symbols.js +22 -3
  73. package/dist/testing.d.ts +23 -1
  74. package/dist/testing.js +114 -0
  75. package/package.json +7 -6
  76. package/src/CallHierarchyPanel.tsx +26 -11
  77. package/src/EditorContextMenu.tsx +7 -0
  78. package/src/EditorView.tsx +9 -0
  79. package/src/LanguagePopups.tsx +4 -0
  80. package/src/PickPopup.tsx +40 -5
  81. package/src/WrapCard.tsx +64 -0
  82. package/src/call-hierarchy-model.ts +25 -3
  83. package/src/call-hierarchy.ts +62 -20
  84. package/src/clipboard-history.ts +102 -0
  85. package/src/code-actions.ts +48 -11
  86. package/src/code-vision.ts +3 -3
  87. package/src/completion.ts +15 -15
  88. package/src/context-menu-rows.ts +3 -2
  89. package/src/definition-link.ts +17 -5
  90. package/src/document-colors.ts +189 -0
  91. package/src/document-links.ts +129 -0
  92. package/src/document-query.ts +71 -0
  93. package/src/edit-locations.ts +162 -0
  94. package/src/editor-language.ts +80 -3
  95. package/src/emmet-module.d.ts +44 -0
  96. package/src/emmet.ts +73 -0
  97. package/src/folding.ts +3 -3
  98. package/src/format-on-type.ts +5 -5
  99. package/src/highlights.ts +3 -3
  100. package/src/history.ts +81 -1
  101. package/src/host-types.ts +10 -0
  102. package/src/index.ts +12 -3
  103. package/src/inlay-hints.ts +2 -2
  104. package/src/inline-completion.ts +221 -0
  105. package/src/key-priority.ts +9 -6
  106. package/src/linked-editing.ts +199 -0
  107. package/src/locales/en.json +31 -2
  108. package/src/locales/nl.json +31 -2
  109. package/src/markup-context.ts +262 -0
  110. package/src/markup.ts +367 -0
  111. package/src/navigation.ts +6 -6
  112. package/src/paste-history.ts +111 -0
  113. package/src/peek.ts +4 -4
  114. package/src/pick.ts +201 -19
  115. package/src/popups.ts +19 -1
  116. package/src/project-language.ts +136 -19
  117. package/src/rename.ts +11 -11
  118. package/src/rendered-docs.ts +2 -2
  119. package/src/selection-ranges.ts +3 -3
  120. package/src/signature.ts +6 -6
  121. package/src/snippet-session.ts +9 -4
  122. package/src/symbol-picker.ts +6 -6
  123. package/src/symbols.ts +30 -4
  124. package/src/testing.ts +126 -1
package/dist/PickPopup.js CHANGED
@@ -4,65 +4,164 @@ import { createPortal } from 'react-dom';
4
4
  import { PathText } from "./PathText.js";
5
5
  import { keepFocusOutOfList, useInputPopup } from './popup-focus.js';
6
6
  import { placePopup } from './popup-placement.js';
7
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const CARD = 'fixed top-0 left-0 z-(--z-popup) flex w-[420px] flex-col overflow-hidden rounded-lg border border-border bg-surface-raised text-text shadow-(--float-shadow)';
9
+ /* The label with the part a query matched marked, whatever the case. */
10
+ function MatchedLabel(t0) {
11
+ const $ = _c(18);
12
+ const {
13
+ label,
14
+ query
15
+ } = t0;
16
+ let start;
17
+ let t1;
18
+ let t2;
19
+ let t3;
20
+ let t4;
21
+ if ($[0] !== label || $[1] !== query) {
22
+ t4 = Symbol.for("react.early_return_sentinel");
23
+ bb0: {
24
+ start = query === null || query === "" ? -1 : label.toLowerCase().indexOf(query.toLowerCase());
25
+ if (query === null || start < 0) {
26
+ t4 = label;
27
+ break bb0;
28
+ }
29
+ t3 = label.slice(0, start);
30
+ t1 = "bg-transparent font-semibold text-accent";
31
+ t2 = label.slice(start, start + query.length);
32
+ }
33
+ $[0] = label;
34
+ $[1] = query;
35
+ $[2] = start;
36
+ $[3] = t1;
37
+ $[4] = t2;
38
+ $[5] = t3;
39
+ $[6] = t4;
40
+ } else {
41
+ start = $[2];
42
+ t1 = $[3];
43
+ t2 = $[4];
44
+ t3 = $[5];
45
+ t4 = $[6];
46
+ }
47
+ if (t4 !== Symbol.for("react.early_return_sentinel")) {
48
+ return t4;
49
+ }
50
+ let t5;
51
+ if ($[7] !== t1 || $[8] !== t2) {
52
+ t5 = /*#__PURE__*/_jsx("mark", {
53
+ className: t1,
54
+ children: t2
55
+ });
56
+ $[7] = t1;
57
+ $[8] = t2;
58
+ $[9] = t5;
59
+ } else {
60
+ t5 = $[9];
61
+ }
62
+ let t6;
63
+ if ($[10] !== label || $[11] !== query.length || $[12] !== start) {
64
+ t6 = label.slice(start + query.length);
65
+ $[10] = label;
66
+ $[11] = query.length;
67
+ $[12] = start;
68
+ $[13] = t6;
69
+ } else {
70
+ t6 = $[13];
71
+ }
72
+ let t7;
73
+ if ($[14] !== t3 || $[15] !== t5 || $[16] !== t6) {
74
+ t7 = /*#__PURE__*/_jsxs(_Fragment, {
75
+ children: [t3, t5, t6]
76
+ });
77
+ $[14] = t3;
78
+ $[15] = t5;
79
+ $[16] = t6;
80
+ $[17] = t7;
81
+ } else {
82
+ t7 = $[17];
83
+ }
84
+ return t7;
85
+ }
9
86
  function PreviewLines(t0) {
10
- const $ = _c(13);
87
+ const $ = _c(17);
11
88
  const {
12
89
  preview
13
90
  } = t0;
91
+ if (preview.kind === "text") {
92
+ let t1;
93
+ if ($[0] !== preview.added) {
94
+ t1 = preview.added.map(_temp);
95
+ $[0] = preview.added;
96
+ $[1] = t1;
97
+ } else {
98
+ t1 = $[1];
99
+ }
100
+ let t2;
101
+ if ($[2] !== t1) {
102
+ t2 = /*#__PURE__*/_jsx("div", {
103
+ className: "max-h-48 overflow-auto border-t border-border p-2 font-mono text-code whitespace-pre",
104
+ children: t1
105
+ });
106
+ $[2] = t1;
107
+ $[3] = t2;
108
+ } else {
109
+ t2 = $[3];
110
+ }
111
+ return t2;
112
+ }
14
113
  let t1;
15
- if ($[0] !== preview.removed) {
16
- t1 = preview.removed.map(_temp);
17
- $[0] = preview.removed;
18
- $[1] = t1;
114
+ if ($[4] !== preview.removed) {
115
+ t1 = preview.removed.map(_temp2);
116
+ $[4] = preview.removed;
117
+ $[5] = t1;
19
118
  } else {
20
- t1 = $[1];
119
+ t1 = $[5];
21
120
  }
22
121
  let t2;
23
- if ($[2] !== preview.added) {
24
- t2 = preview.added.map(_temp2);
25
- $[2] = preview.added;
26
- $[3] = t2;
122
+ if ($[6] !== preview.added) {
123
+ t2 = preview.added.map(_temp3);
124
+ $[6] = preview.added;
125
+ $[7] = t2;
27
126
  } else {
28
- t2 = $[3];
127
+ t2 = $[7];
29
128
  }
30
129
  let t3;
31
- if ($[4] !== preview.note) {
130
+ if ($[8] !== preview.note) {
32
131
  t3 = preview.note !== null && /*#__PURE__*/_jsx("div", {
33
132
  className: "px-1.5 font-sans text-xs text-text-muted",
34
133
  children: preview.note
35
134
  });
36
- $[4] = preview.note;
37
- $[5] = t3;
135
+ $[8] = preview.note;
136
+ $[9] = t3;
38
137
  } else {
39
- t3 = $[5];
138
+ t3 = $[9];
40
139
  }
41
140
  let t4;
42
- if ($[6] !== preview.refusal) {
141
+ if ($[10] !== preview.refusal) {
43
142
  t4 = preview.refusal !== undefined && /*#__PURE__*/_jsx("div", {
44
143
  role: "alert",
45
144
  className: "px-1.5 py-0.5 font-sans text-xs text-status-error",
46
145
  children: preview.refusal
47
146
  });
48
- $[6] = preview.refusal;
49
- $[7] = t4;
147
+ $[10] = preview.refusal;
148
+ $[11] = t4;
50
149
  } else {
51
- t4 = $[7];
150
+ t4 = $[11];
52
151
  }
53
152
  let t5;
54
- if ($[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
153
+ if ($[12] !== t1 || $[13] !== t2 || $[14] !== t3 || $[15] !== t4) {
55
154
  t5 = /*#__PURE__*/_jsxs("div", {
56
155
  className: "flex flex-col gap-px border-t border-border p-1 font-mono text-code",
57
156
  children: [t1, t2, t3, t4]
58
157
  });
59
- $[8] = t1;
60
- $[9] = t2;
61
- $[10] = t3;
62
- $[11] = t4;
63
- $[12] = t5;
158
+ $[12] = t1;
159
+ $[13] = t2;
160
+ $[14] = t3;
161
+ $[15] = t4;
162
+ $[16] = t5;
64
163
  } else {
65
- t5 = $[12];
164
+ t5 = $[16];
66
165
  }
67
166
  return t5;
68
167
  }
@@ -70,7 +169,7 @@ function PreviewLines(t0) {
70
169
  * The list of an editor's pick feature under the character it belongs to. A press on a row never takes
71
170
  * the focus from the editor, so the keys keep going to it while the list is open.
72
171
  */
73
- function _temp2(line_0, index_0) {
172
+ function _temp3(line_1, index_1) {
74
173
  return /*#__PURE__*/_jsxs("div", {
75
174
  className: "flex gap-2 rounded-sm bg-status-idle/10 px-1.5 whitespace-pre",
76
175
  children: [/*#__PURE__*/_jsx("span", {
@@ -78,11 +177,11 @@ function _temp2(line_0, index_0) {
78
177
  children: "+"
79
178
  }), /*#__PURE__*/_jsx("span", {
80
179
  className: "min-w-0 truncate",
81
- children: line_0
180
+ children: line_1
82
181
  })]
83
- }, `+${index_0}`);
182
+ }, `+${index_1}`);
84
183
  }
85
- function _temp(line, index) {
184
+ function _temp2(line_0, index_0) {
86
185
  return /*#__PURE__*/_jsxs("div", {
87
186
  className: "flex gap-2 rounded-sm bg-status-error/10 px-1.5 whitespace-pre",
88
187
  children: [/*#__PURE__*/_jsx("span", {
@@ -90,12 +189,17 @@ function _temp(line, index) {
90
189
  children: "\u2212"
91
190
  }), /*#__PURE__*/_jsx("span", {
92
191
  className: "min-w-0 truncate",
93
- children: line
192
+ children: line_0
94
193
  })]
95
- }, `-${index}`);
194
+ }, `-${index_0}`);
195
+ }
196
+ function _temp(line, index) {
197
+ return /*#__PURE__*/_jsx("div", {
198
+ children: line === "" ? " " : line
199
+ }, index);
96
200
  }
97
201
  export function PickPopup(t0) {
98
- const $ = _c(31);
202
+ const $ = _c(34);
99
203
  const {
100
204
  language,
101
205
  view,
@@ -194,18 +298,25 @@ export function PickPopup(t0) {
194
298
  t6 = $[13];
195
299
  }
196
300
  let t7;
197
- if ($[14] !== view.title) {
198
- t7 = view.title !== null && /*#__PURE__*/_jsx("div", {
199
- className: "border-b border-border px-3 py-1.5 text-xs text-text-muted",
200
- children: view.title
301
+ if ($[14] !== view.query || $[15] !== view.title) {
302
+ t7 = (view.title !== null || view.query !== null) && /*#__PURE__*/_jsxs("div", {
303
+ className: "flex items-baseline gap-2 border-b border-border px-3 py-1.5 text-xs text-text-muted",
304
+ children: [/*#__PURE__*/_jsx("span", {
305
+ className: "min-w-0 truncate",
306
+ children: view.title
307
+ }), view.query !== null && view.query !== "" && /*#__PURE__*/_jsx("span", {
308
+ className: "ml-auto shrink-0 font-mono text-text",
309
+ children: view.query
310
+ })]
201
311
  });
202
- $[14] = view.title;
203
- $[15] = t7;
312
+ $[14] = view.query;
313
+ $[15] = view.title;
314
+ $[16] = t7;
204
315
  } else {
205
- t7 = $[15];
316
+ t7 = $[16];
206
317
  }
207
318
  let t8;
208
- if ($[16] !== language || $[17] !== optionIds || $[18] !== view.active || $[19] !== view.groups) {
319
+ if ($[17] !== language || $[18] !== optionIds || $[19] !== view.active || $[20] !== view.chosen || $[21] !== view.groups || $[22] !== view.query) {
209
320
  t8 = view.groups.map((group_0, groupIndex) => /*#__PURE__*/_jsxs("div", {
210
321
  role: "group",
211
322
  className: "flex flex-col",
@@ -218,13 +329,20 @@ export function PickPopup(t0) {
218
329
  type: "button",
219
330
  role: "option",
220
331
  tabIndex: -1,
221
- "aria-selected": row_0.id === view.active,
332
+ "aria-selected": row_0.id === view.active || view.chosen.includes(row_0.id),
222
333
  "data-active": row_0.id === view.active,
223
- className: "flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-xs cursor-row",
224
- onClick: () => language.pick.choose(row_0.id),
334
+ "data-chosen": view.chosen.includes(row_0.id),
335
+ className: "flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-xs cursor-row data-[chosen=true]:bg-accent/15",
336
+ onClick: event_0 => language.pick.choose(row_0.id, {
337
+ toggle: event_0.metaKey || event_0.ctrlKey,
338
+ range: event_0.shiftKey
339
+ }),
225
340
  children: [/*#__PURE__*/_jsx("span", {
226
341
  className: row_0.path ? "shrink-0" : "min-w-0 truncate",
227
- children: row_0.label
342
+ children: /*#__PURE__*/_jsx(MatchedLabel, {
343
+ label: row_0.label,
344
+ query: view.query
345
+ })
228
346
  }), row_0.path ? /*#__PURE__*/_jsx(PathText, {
229
347
  path: row_0.detail,
230
348
  className: "ml-auto font-mono text-text-faint"
@@ -234,58 +352,60 @@ export function PickPopup(t0) {
234
352
  })]
235
353
  }, row_0.id))]
236
354
  }, group_0.title ?? groupIndex));
237
- $[16] = language;
238
- $[17] = optionIds;
239
- $[18] = view.active;
240
- $[19] = view.groups;
241
- $[20] = t8;
355
+ $[17] = language;
356
+ $[18] = optionIds;
357
+ $[19] = view.active;
358
+ $[20] = view.chosen;
359
+ $[21] = view.groups;
360
+ $[22] = view.query;
361
+ $[23] = t8;
242
362
  } else {
243
- t8 = $[20];
363
+ t8 = $[23];
244
364
  }
245
365
  let t9;
246
- if ($[21] !== listId || $[22] !== t8) {
366
+ if ($[24] !== listId || $[25] !== t8) {
247
367
  t9 = /*#__PURE__*/_jsx("div", {
248
368
  id: listId,
249
369
  role: "listbox",
250
370
  className: "min-h-0 flex-1 overflow-y-auto p-1",
251
371
  children: t8
252
372
  });
253
- $[21] = listId;
254
- $[22] = t8;
255
- $[23] = t9;
373
+ $[24] = listId;
374
+ $[25] = t8;
375
+ $[26] = t9;
256
376
  } else {
257
- t9 = $[23];
377
+ t9 = $[26];
258
378
  }
259
379
  let t10;
260
- if ($[24] !== view.preview) {
380
+ if ($[27] !== view.preview) {
261
381
  t10 = view.preview !== null && /*#__PURE__*/_jsx(PreviewLines, {
262
382
  preview: view.preview
263
383
  });
264
- $[24] = view.preview;
265
- $[25] = t10;
384
+ $[27] = view.preview;
385
+ $[28] = t10;
266
386
  } else {
267
- t10 = $[25];
387
+ t10 = $[28];
268
388
  }
269
389
  let t11;
270
- if ($[26] !== t10 || $[27] !== t6 || $[28] !== t7 || $[29] !== t9) {
390
+ if ($[29] !== t10 || $[30] !== t6 || $[31] !== t7 || $[32] !== t9) {
271
391
  t11 = createPortal(/*#__PURE__*/_jsxs("div", {
272
392
  ref: card,
273
393
  className: CARD,
274
394
  style: t5,
275
- onPointerDown: _temp3,
395
+ onPointerDown: _temp4,
276
396
  ...t6,
277
397
  children: [t7, t9, t10]
278
398
  }), document.body);
279
- $[26] = t10;
280
- $[27] = t6;
281
- $[28] = t7;
282
- $[29] = t9;
283
- $[30] = t11;
399
+ $[29] = t10;
400
+ $[30] = t6;
401
+ $[31] = t7;
402
+ $[32] = t9;
403
+ $[33] = t11;
284
404
  } else {
285
- t11 = $[30];
405
+ t11 = $[33];
286
406
  }
287
407
  return t11;
288
408
  }
289
- function _temp3(event) {
409
+ function _temp4(event) {
290
410
  return event.preventDefault();
291
411
  }
@@ -0,0 +1,8 @@
1
+ import type { EditorRect } from '@adecore/editor';
2
+ import type { EditorLanguage } from './editor-language.ts';
3
+ import type { WrapView } from './popups.ts';
4
+ export declare function WrapCard({ language, view, rect }: {
5
+ language: EditorLanguage;
6
+ view: WrapView;
7
+ rect: EditorRect;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,172 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useLayoutEffect, useRef, useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Input } from '@adecore/ui';
5
+ import { AnchoredPopup } from "./AnchoredPopup.js";
6
+ /* The field for the abbreviation a selection is wrapped in: Enter wraps, Escape or leaving the field cancels. */
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ export function WrapCard(t0) {
9
+ const $ = _c(30);
10
+ const {
11
+ language,
12
+ view,
13
+ rect
14
+ } = t0;
15
+ const {
16
+ t
17
+ } = useTranslation("editor");
18
+ const input = useRef(null);
19
+ const [value, setValue] = useState("");
20
+ let t1;
21
+ let t2;
22
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23
+ t1 = () => {
24
+ input.current?.focus();
25
+ };
26
+ t2 = [];
27
+ $[0] = t1;
28
+ $[1] = t2;
29
+ } else {
30
+ t1 = $[0];
31
+ t2 = $[1];
32
+ }
33
+ useLayoutEffect(t1, t2);
34
+ let t3;
35
+ if ($[2] !== language.editor || $[3] !== language.markup || $[4] !== value) {
36
+ t3 = function onKeyDown(event) {
37
+ if (event.nativeEvent.isComposing) {
38
+ return;
39
+ }
40
+ if (event.key === "Escape") {
41
+ event.preventDefault();
42
+ event.stopPropagation();
43
+ language.markup.cancelWrap();
44
+ language.editor.focus();
45
+ } else {
46
+ if (event.key === "Enter") {
47
+ event.preventDefault();
48
+ event.stopPropagation();
49
+ if (value.trim() !== "") {
50
+ language.markup.submitWrap(value);
51
+ }
52
+ }
53
+ }
54
+ };
55
+ $[2] = language.editor;
56
+ $[3] = language.markup;
57
+ $[4] = value;
58
+ $[5] = t3;
59
+ } else {
60
+ t3 = $[5];
61
+ }
62
+ const onKeyDown = t3;
63
+ let t4;
64
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
65
+ t4 = {
66
+ prefer: "above"
67
+ };
68
+ $[6] = t4;
69
+ } else {
70
+ t4 = $[6];
71
+ }
72
+ let t5;
73
+ if ($[7] !== t) {
74
+ t5 = t("language.markup.wrap");
75
+ $[7] = t;
76
+ $[8] = t5;
77
+ } else {
78
+ t5 = $[8];
79
+ }
80
+ const t6 = view.error !== null;
81
+ let t7;
82
+ if ($[9] !== t) {
83
+ t7 = t("language.markup.placeholder");
84
+ $[9] = t;
85
+ $[10] = t7;
86
+ } else {
87
+ t7 = $[10];
88
+ }
89
+ let t8;
90
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
91
+ t8 = event_0 => setValue(event_0.target.value);
92
+ $[11] = t8;
93
+ } else {
94
+ t8 = $[11];
95
+ }
96
+ let t9;
97
+ if ($[12] !== language.markup) {
98
+ t9 = () => language.markup.cancelWrap();
99
+ $[12] = language.markup;
100
+ $[13] = t9;
101
+ } else {
102
+ t9 = $[13];
103
+ }
104
+ let t10;
105
+ if ($[14] !== onKeyDown || $[15] !== t5 || $[16] !== t6 || $[17] !== t7 || $[18] !== t9 || $[19] !== value) {
106
+ t10 = /*#__PURE__*/_jsx(Input, {
107
+ ref: input,
108
+ size: "sm",
109
+ mono: true,
110
+ value: value,
111
+ spellCheck: false,
112
+ autoComplete: "off",
113
+ "aria-label": t5,
114
+ "aria-invalid": t6,
115
+ placeholder: t7,
116
+ onChange: t8,
117
+ onKeyDown: onKeyDown,
118
+ onBlur: t9
119
+ });
120
+ $[14] = onKeyDown;
121
+ $[15] = t5;
122
+ $[16] = t6;
123
+ $[17] = t7;
124
+ $[18] = t9;
125
+ $[19] = value;
126
+ $[20] = t10;
127
+ } else {
128
+ t10 = $[20];
129
+ }
130
+ let t11;
131
+ if ($[21] !== t || $[22] !== view.error) {
132
+ t11 = view.error !== null ? /*#__PURE__*/_jsx("div", {
133
+ role: "alert",
134
+ className: "text-xs text-status-error",
135
+ children: view.error
136
+ }) : /*#__PURE__*/_jsxs("div", {
137
+ className: "text-xs text-text-muted",
138
+ children: ["\u21B5 ", t("language.markup.apply")]
139
+ });
140
+ $[21] = t;
141
+ $[22] = view.error;
142
+ $[23] = t11;
143
+ } else {
144
+ t11 = $[23];
145
+ }
146
+ let t12;
147
+ if ($[24] !== t10 || $[25] !== t11) {
148
+ t12 = /*#__PURE__*/_jsxs("div", {
149
+ className: "flex w-[280px] flex-col gap-1.5 p-2",
150
+ children: [t10, t11]
151
+ });
152
+ $[24] = t10;
153
+ $[25] = t11;
154
+ $[26] = t12;
155
+ } else {
156
+ t12 = $[26];
157
+ }
158
+ let t13;
159
+ if ($[27] !== rect || $[28] !== t12) {
160
+ t13 = /*#__PURE__*/_jsx(AnchoredPopup, {
161
+ rect: rect,
162
+ placement: t4,
163
+ children: t12
164
+ });
165
+ $[27] = rect;
166
+ $[28] = t12;
167
+ $[29] = t13;
168
+ } else {
169
+ t13 = $[29];
170
+ }
171
+ return t13;
172
+ }
@@ -1,5 +1,6 @@
1
- import type { CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, Range } from '@adecore/lsp';
2
- export type CallDirection = 'incoming' | 'outgoing';
1
+ import type { CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, Range, TypeHierarchyItem } from '@adecore/lsp';
2
+ export type CallDirection = 'incoming' | 'outgoing' | 'supertypes' | 'subtypes';
3
+ export declare function isTypeDirection(direction: CallDirection): direction is 'supertypes' | 'subtypes';
3
4
  export declare const CALL_LEVEL_LIMIT = 50;
4
5
  export type CallLoad = 'idle' | 'loading' | 'loaded' | 'failed';
5
6
  export interface CallNode {
@@ -44,6 +45,7 @@ export declare function statusIdOf(parent: string): string;
44
45
  export declare function moreIdOf(parent: string): string;
45
46
  export declare function rootsOf(items: readonly CallHierarchyItem[]): CallNode[];
46
47
  export declare function childrenOf(direction: CallDirection, parent: CallNode, calls: readonly (CallHierarchyIncomingCall | CallHierarchyOutgoingCall)[]): CallNode[];
48
+ export declare function typeChildrenOf(parent: CallNode, items: readonly TypeHierarchyItem[]): CallNode[];
47
49
  export declare function rowsOf(nodes: ReadonlyMap<string, CallNode>, roots: readonly string[]): CallRow[];
48
50
  export declare function stepsOf(rows: readonly CallRow[]): CallRow[];
49
51
  export declare function targetOf(node: CallNode, site?: number): {
@@ -1,3 +1,7 @@
1
+ /* Whether a direction walks a type hierarchy and not the calls. */
2
+ export function isTypeDirection(direction) {
3
+ return direction === 'supertypes' || direction === 'subtypes';
4
+ }
1
5
  /* The most calls of one level that are drawn at once; the rest wait behind a row that shows more. */
2
6
  export const CALL_LEVEL_LIMIT = 50;
3
7
  /* The id of the status line under a node. */
@@ -47,6 +51,22 @@ export function childrenOf(direction, parent, calls) {
47
51
  shown: 0
48
52
  }));
49
53
  }
54
+ /* The children of a node made from the types a server returned; a type has no call sites, so a row goes to the type itself. */
55
+ export function typeChildrenOf(parent, items) {
56
+ return items.map((item, index) => ({
57
+ id: `${parent.id}.${index}`,
58
+ parent: parent.id,
59
+ level: parent.level + 1,
60
+ item,
61
+ sites: [],
62
+ siteUri: null,
63
+ expanded: false,
64
+ load: 'idle',
65
+ error: null,
66
+ children: [],
67
+ shown: 0
68
+ }));
69
+ }
50
70
  /* The lines the tree draws: every root, and under an expanded node its status, its calls and the row that shows more. */
51
71
  export function rowsOf(nodes, roots) {
52
72
  const rows = [];
@@ -9,6 +9,7 @@ export declare class CallHierarchyFeature {
9
9
  private nodes;
10
10
  private roots;
11
11
  private prepared;
12
+ private position;
12
13
  private direction;
13
14
  private controller;
14
15
  private epoch;
@@ -17,6 +18,7 @@ export declare class CallHierarchyFeature {
17
18
  constructor(language: EditorLanguage, timers?: Timers);
18
19
  get isOpen(): boolean;
19
20
  get supported(): boolean;
21
+ get typesSupported(): boolean;
20
22
  open(position?: EditorPosition, direction?: CallDirection): Promise<void>;
21
23
  close(): void;
22
24
  setDirection(direction: CallDirection): void;
@@ -31,6 +33,7 @@ export declare class CallHierarchyFeature {
31
33
  private mounted;
32
34
  private patch;
33
35
  private load;
36
+ private childrenOf;
34
37
  private preview;
35
38
  private hasAncestor;
36
39
  private key;