@adecore/editor-react 0.42.0 → 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 (122) hide show
  1. package/dist/CallHierarchyPanel.js +177 -181
  2. package/dist/EditorContextMenu.js +118 -105
  3. package/dist/LanguagePopups.js +7 -0
  4. package/dist/PickPopup.js +190 -70
  5. package/dist/WrapCard.d.ts +8 -0
  6. package/dist/WrapCard.js +172 -0
  7. package/dist/call-hierarchy-model.d.ts +4 -2
  8. package/dist/call-hierarchy-model.js +20 -0
  9. package/dist/call-hierarchy.d.ts +3 -0
  10. package/dist/call-hierarchy.js +54 -22
  11. package/dist/clipboard-history.d.ts +31 -0
  12. package/dist/clipboard-history.js +70 -0
  13. package/dist/code-actions.d.ts +3 -1
  14. package/dist/code-actions.js +50 -10
  15. package/dist/code-vision.js +2 -3
  16. package/dist/completion.js +10 -15
  17. package/dist/context-menu-rows.d.ts +1 -1
  18. package/dist/context-menu-rows.js +4 -0
  19. package/dist/definition-link.js +15 -5
  20. package/dist/document-colors.d.ts +24 -0
  21. package/dist/document-colors.js +194 -0
  22. package/dist/document-links.d.ts +22 -0
  23. package/dist/document-links.js +133 -0
  24. package/dist/document-query.d.ts +15 -0
  25. package/dist/document-query.js +54 -0
  26. package/dist/edit-locations.d.ts +20 -0
  27. package/dist/edit-locations.js +136 -0
  28. package/dist/editor-language.d.ts +19 -1
  29. package/dist/editor-language.js +77 -2
  30. package/dist/emmet.d.ts +13 -0
  31. package/dist/emmet.js +62 -0
  32. package/dist/folding.js +2 -3
  33. package/dist/format-on-type.js +3 -5
  34. package/dist/highlights.js +2 -3
  35. package/dist/history.d.ts +7 -0
  36. package/dist/history.js +79 -1
  37. package/dist/host-types.d.ts +6 -0
  38. package/dist/index.d.ts +11 -2
  39. package/dist/index.js +8 -0
  40. package/dist/inlay-hints.js +2 -2
  41. package/dist/inline-completion.d.ts +39 -0
  42. package/dist/inline-completion.js +221 -0
  43. package/dist/key-priority.d.ts +8 -5
  44. package/dist/key-priority.js +9 -6
  45. package/dist/linked-editing.d.ts +26 -0
  46. package/dist/linked-editing.js +215 -0
  47. package/dist/locales/en.json +31 -2
  48. package/dist/locales/nl.json +31 -2
  49. package/dist/markup-context.d.ts +37 -0
  50. package/dist/markup-context.js +291 -0
  51. package/dist/markup.d.ts +36 -0
  52. package/dist/markup.js +453 -0
  53. package/dist/navigation.js +4 -6
  54. package/dist/paste-history.d.ts +7 -0
  55. package/dist/paste-history.js +104 -0
  56. package/dist/peek.js +3 -4
  57. package/dist/pick.d.ts +20 -2
  58. package/dist/pick.js +141 -18
  59. package/dist/popups.d.ts +9 -0
  60. package/dist/popups.js +2 -1
  61. package/dist/project-language.d.ts +18 -1
  62. package/dist/project-language.js +129 -18
  63. package/dist/rename.js +8 -11
  64. package/dist/rendered-docs.js +1 -2
  65. package/dist/selection-ranges.js +2 -3
  66. package/dist/shortcut-keys.d.ts +19 -0
  67. package/dist/signature.js +3 -6
  68. package/dist/snippet-session.d.ts +2 -2
  69. package/dist/snippet-session.js +3 -3
  70. package/dist/symbol-picker.js +4 -6
  71. package/dist/symbols.js +22 -3
  72. package/dist/testing.d.ts +23 -1
  73. package/dist/testing.js +114 -0
  74. package/package.json +7 -6
  75. package/src/CallHierarchyPanel.tsx +26 -11
  76. package/src/EditorContextMenu.tsx +7 -0
  77. package/src/LanguagePopups.tsx +4 -0
  78. package/src/PickPopup.tsx +40 -5
  79. package/src/WrapCard.tsx +64 -0
  80. package/src/call-hierarchy-model.ts +25 -3
  81. package/src/call-hierarchy.ts +62 -20
  82. package/src/clipboard-history.ts +102 -0
  83. package/src/code-actions.ts +48 -11
  84. package/src/code-vision.ts +3 -3
  85. package/src/completion.ts +15 -15
  86. package/src/context-menu-rows.ts +3 -2
  87. package/src/definition-link.ts +17 -5
  88. package/src/document-colors.ts +189 -0
  89. package/src/document-links.ts +129 -0
  90. package/src/document-query.ts +71 -0
  91. package/src/edit-locations.ts +162 -0
  92. package/src/editor-language.ts +80 -3
  93. package/src/emmet-module.d.ts +44 -0
  94. package/src/emmet.ts +73 -0
  95. package/src/folding.ts +3 -3
  96. package/src/format-on-type.ts +5 -5
  97. package/src/highlights.ts +3 -3
  98. package/src/history.ts +81 -1
  99. package/src/host-types.ts +10 -0
  100. package/src/index.ts +12 -3
  101. package/src/inlay-hints.ts +2 -2
  102. package/src/inline-completion.ts +221 -0
  103. package/src/key-priority.ts +9 -6
  104. package/src/linked-editing.ts +199 -0
  105. package/src/locales/en.json +31 -2
  106. package/src/locales/nl.json +31 -2
  107. package/src/markup-context.ts +262 -0
  108. package/src/markup.ts +367 -0
  109. package/src/navigation.ts +6 -6
  110. package/src/paste-history.ts +111 -0
  111. package/src/peek.ts +4 -4
  112. package/src/pick.ts +201 -19
  113. package/src/popups.ts +19 -1
  114. package/src/project-language.ts +136 -19
  115. package/src/rename.ts +11 -11
  116. package/src/rendered-docs.ts +2 -2
  117. package/src/selection-ranges.ts +3 -3
  118. package/src/signature.ts +6 -6
  119. package/src/snippet-session.ts +9 -4
  120. package/src/symbol-picker.ts +6 -6
  121. package/src/symbols.ts +30 -4
  122. package/src/testing.ts +126 -1
@@ -10,7 +10,7 @@ import { menuGroupsOf } from './context-menu-rows.js';
10
10
  */
11
11
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
12
12
  export function EditorContextMenu(t0) {
13
- const $ = _c(91);
13
+ const $ = _c(94);
14
14
  const {
15
15
  language,
16
16
  view,
@@ -92,57 +92,63 @@ export function EditorContextMenu(t0) {
92
92
  t15 = $[32];
93
93
  }
94
94
  let t16;
95
+ let t17;
95
96
  if ($[33] !== language.callHierarchy) {
96
97
  t16 = () => void language.callHierarchy.open();
98
+ t17 = () => void language.callHierarchy.open(undefined, "supertypes");
97
99
  $[33] = language.callHierarchy;
98
100
  $[34] = t16;
101
+ $[35] = t17;
99
102
  } else {
100
103
  t16 = $[34];
101
- }
102
- let t17;
103
- if ($[35] !== language.rename) {
104
- t17 = () => void language.rename.start();
105
- $[35] = language.rename;
106
- $[36] = t17;
107
- } else {
108
- t17 = $[36];
104
+ t17 = $[35];
109
105
  }
110
106
  let t18;
111
- if ($[37] !== language.codeActions) {
112
- t18 = () => void language.codeActions.open();
113
- $[37] = language.codeActions;
114
- $[38] = t18;
107
+ if ($[36] !== language.rename) {
108
+ t18 = () => void language.rename.start();
109
+ $[36] = language.rename;
110
+ $[37] = t18;
115
111
  } else {
116
- t18 = $[38];
112
+ t18 = $[37];
117
113
  }
118
114
  let t19;
119
- if ($[39] !== t11 || $[40] !== t12 || $[41] !== t13 || $[42] !== t14 || $[43] !== t15 || $[44] !== t16 || $[45] !== t17 || $[46] !== t18) {
120
- t19 = {
115
+ if ($[38] !== language.codeActions) {
116
+ t19 = () => void language.codeActions.open();
117
+ $[38] = language.codeActions;
118
+ $[39] = t19;
119
+ } else {
120
+ t19 = $[39];
121
+ }
122
+ let t20;
123
+ if ($[40] !== t11 || $[41] !== t12 || $[42] !== t13 || $[43] !== t14 || $[44] !== t15 || $[45] !== t16 || $[46] !== t17 || $[47] !== t18 || $[48] !== t19) {
124
+ t20 = {
121
125
  definition: t11,
122
126
  declaration: t12,
123
127
  typeDefinition: t13,
124
128
  implementation: t14,
125
129
  peekReferences: t15,
126
130
  callHierarchy: t16,
127
- renameSymbol: t17,
128
- codeActions: t18
131
+ typeHierarchy: t17,
132
+ renameSymbol: t18,
133
+ codeActions: t19
129
134
  };
130
- $[39] = t11;
131
- $[40] = t12;
132
- $[41] = t13;
133
- $[42] = t14;
134
- $[43] = t15;
135
- $[44] = t16;
136
- $[45] = t17;
137
- $[46] = t18;
138
- $[47] = t19;
135
+ $[40] = t11;
136
+ $[41] = t12;
137
+ $[42] = t13;
138
+ $[43] = t14;
139
+ $[44] = t15;
140
+ $[45] = t16;
141
+ $[46] = t17;
142
+ $[47] = t18;
143
+ $[48] = t19;
144
+ $[49] = t20;
139
145
  } else {
140
- t19 = $[47];
146
+ t20 = $[49];
141
147
  }
142
- const run = t19;
143
- let t20;
144
- if ($[48] !== t) {
145
- t20 = id => {
148
+ const run = t20;
149
+ let t21;
150
+ if ($[50] !== t) {
151
+ t21 = id => {
146
152
  switch (id) {
147
153
  case "definition":
148
154
  case "declaration":
@@ -161,15 +167,15 @@ export function EditorContextMenu(t0) {
161
167
  }
162
168
  }
163
169
  };
164
- $[48] = t;
165
- $[49] = t20;
170
+ $[50] = t;
171
+ $[51] = t21;
166
172
  } else {
167
- t20 = $[49];
173
+ t21 = $[51];
168
174
  }
169
- const label = t20;
170
- let t21;
171
- if ($[50] !== label || $[51] !== language.shortcuts || $[52] !== run) {
172
- t21 = row => {
175
+ const label = t21;
176
+ let t22;
177
+ if ($[52] !== label || $[53] !== language.shortcuts || $[54] !== run) {
178
+ t22 = row => {
173
179
  const shortcut = row.shortcut === null ? null : language.shortcuts[row.shortcut];
174
180
  return /*#__PURE__*/_jsxs(ContextMenu.Item, {
175
181
  onClick: run[row.id],
@@ -178,31 +184,31 @@ export function EditorContextMenu(t0) {
178
184
  })]
179
185
  }, row.id);
180
186
  };
181
- $[50] = label;
182
- $[51] = language.shortcuts;
183
- $[52] = run;
184
- $[53] = t21;
187
+ $[52] = label;
188
+ $[53] = language.shortcuts;
189
+ $[54] = run;
190
+ $[55] = t22;
185
191
  } else {
186
- t21 = $[53];
192
+ t22 = $[55];
187
193
  }
188
- const item = t21;
194
+ const item = t22;
189
195
  T1 = ContextMenu.Root;
190
- if ($[54] !== language.contextMenu) {
196
+ if ($[56] !== language.contextMenu) {
191
197
  t8 = open => !open && language.contextMenu.close();
192
- $[54] = language.contextMenu;
193
- $[55] = t8;
198
+ $[56] = language.contextMenu;
199
+ $[57] = t8;
194
200
  } else {
195
- t8 = $[55];
201
+ t8 = $[57];
196
202
  }
197
- if ($[56] === Symbol.for("react.memo_cache_sentinel")) {
203
+ if ($[58] === Symbol.for("react.memo_cache_sentinel")) {
198
204
  t9 = /*#__PURE__*/_jsx(ContextMenu.Trigger, {
199
205
  ref: trigger,
200
206
  className: "fixed top-0 left-0 h-0 w-0",
201
207
  "aria-hidden": true
202
208
  });
203
- $[56] = t9;
209
+ $[58] = t9;
204
210
  } else {
205
- t9 = $[56];
211
+ t9 = $[58];
206
212
  }
207
213
  T0 = ContextMenu.Popup;
208
214
  t3 = groups.goTo.length > 0 && /*#__PURE__*/_jsxs(ContextMenu.SubmenuRoot, {
@@ -212,18 +218,18 @@ export function EditorContextMenu(t0) {
212
218
  children: groups.goTo.map(item)
213
219
  })]
214
220
  });
215
- if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
221
+ if ($[59] === Symbol.for("react.memo_cache_sentinel")) {
216
222
  t4 = /*#__PURE__*/_jsx(ContextMenu.Separator, {});
217
- $[57] = t4;
223
+ $[59] = t4;
218
224
  } else {
219
- t4 = $[57];
225
+ t4 = $[59];
220
226
  }
221
227
  t5 = groups.references.map(item);
222
- if ($[58] === Symbol.for("react.memo_cache_sentinel")) {
228
+ if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
223
229
  t6 = /*#__PURE__*/_jsx(ContextMenu.Separator, {});
224
- $[58] = t6;
230
+ $[60] = t6;
225
231
  } else {
226
- t6 = $[58];
232
+ t6 = $[60];
227
233
  }
228
234
  t7 = groups.changes.map(item);
229
235
  $[4] = language.callHierarchy;
@@ -257,7 +263,7 @@ export function EditorContextMenu(t0) {
257
263
  t9 = $[22];
258
264
  }
259
265
  let t10;
260
- if ($[59] !== language.codeActions || $[60] !== t || $[61] !== view.refactors) {
266
+ if ($[61] !== language.codeActions || $[62] !== t || $[63] !== view.refactors) {
261
267
  t10 = view.refactors.length > 0 && /*#__PURE__*/_jsxs(ContextMenu.SubmenuRoot, {
262
268
  children: [/*#__PURE__*/_jsx(ContextMenu.SubmenuTrigger, {
263
269
  children: t("language.context.refactor")
@@ -270,96 +276,103 @@ export function EditorContextMenu(t0) {
270
276
  }, entry.id))
271
277
  })]
272
278
  });
273
- $[59] = language.codeActions;
274
- $[60] = t;
275
- $[61] = view.refactors;
276
- $[62] = t10;
279
+ $[61] = language.codeActions;
280
+ $[62] = t;
281
+ $[63] = view.refactors;
282
+ $[64] = t10;
277
283
  } else {
278
- t10 = $[62];
284
+ t10 = $[64];
279
285
  }
280
286
  let t11;
281
- if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
287
+ if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
282
288
  t11 = /*#__PURE__*/_jsx(ContextMenu.Separator, {});
283
- $[63] = t11;
289
+ $[65] = t11;
284
290
  } else {
285
- t11 = $[63];
291
+ t11 = $[65];
286
292
  }
287
293
  let t12;
288
294
  let t13;
289
- if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
295
+ if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
290
296
  t12 = /*#__PURE__*/_jsx(ContextMenu.Separator, {});
291
297
  t13 = ["cut", "copy", "paste"];
292
- $[64] = t12;
293
- $[65] = t13;
298
+ $[66] = t12;
299
+ $[67] = t13;
294
300
  } else {
295
- t12 = $[64];
296
- t13 = $[65];
301
+ t12 = $[66];
302
+ t13 = $[67];
297
303
  }
298
304
  let t14;
299
- if ($[66] !== language.contextMenu || $[67] !== t) {
305
+ if ($[68] !== language.contextMenu || $[69] !== t) {
300
306
  t14 = t13.map(action => /*#__PURE__*/_jsxs(ContextMenu.Item, {
301
307
  onClick: () => language.contextMenu.clipboard(action),
302
308
  children: [t(`language.context.${action}`), /*#__PURE__*/_jsx(Kbd, {
303
309
  shortcut: EDIT_SHORTCUTS[action]
304
310
  })]
305
311
  }, action));
306
- $[66] = language.contextMenu;
307
- $[67] = t;
308
- $[68] = t14;
312
+ $[68] = language.contextMenu;
313
+ $[69] = t;
314
+ $[70] = t14;
309
315
  } else {
310
- t14 = $[68];
316
+ t14 = $[70];
311
317
  }
312
318
  let t15;
313
- if ($[69] !== language.codeActions || $[70] !== language.shortcuts || $[71] !== language.uri || $[72] !== service || $[73] !== t) {
319
+ if ($[71] !== language.codeActions || $[72] !== language.editor || $[73] !== language.shortcuts || $[74] !== language.uri || $[75] !== service || $[76] !== t) {
314
320
  t15 = service.supports("textDocument/formatting", language.uri) && /*#__PURE__*/_jsxs(_Fragment, {
315
321
  children: [/*#__PURE__*/_jsx(ContextMenu.Separator, {}), /*#__PURE__*/_jsxs(ContextMenu.Item, {
316
322
  onClick: () => void language.codeActions.formatDocument(),
317
323
  children: [t("commands.formatDocument"), language.shortcuts.formatDocument !== null && /*#__PURE__*/_jsx(Kbd, {
318
324
  shortcut: language.shortcuts.formatDocument
319
325
  })]
326
+ }), language.codeActions.formatsSelection && language.editor.getSelections().some(_temp) && /*#__PURE__*/_jsx(ContextMenu.Item, {
327
+ onClick: () => void language.codeActions.formatSelection(),
328
+ children: t("commands.formatSelection")
320
329
  })]
321
330
  });
322
- $[69] = language.codeActions;
323
- $[70] = language.shortcuts;
324
- $[71] = language.uri;
325
- $[72] = service;
326
- $[73] = t;
327
- $[74] = t15;
331
+ $[71] = language.codeActions;
332
+ $[72] = language.editor;
333
+ $[73] = language.shortcuts;
334
+ $[74] = language.uri;
335
+ $[75] = service;
336
+ $[76] = t;
337
+ $[77] = t15;
328
338
  } else {
329
- t15 = $[74];
339
+ t15 = $[77];
330
340
  }
331
341
  let t16;
332
- if ($[75] !== T0 || $[76] !== children || $[77] !== t10 || $[78] !== t14 || $[79] !== t15 || $[80] !== t3 || $[81] !== t4 || $[82] !== t5 || $[83] !== t6 || $[84] !== t7) {
342
+ if ($[78] !== T0 || $[79] !== children || $[80] !== t10 || $[81] !== t14 || $[82] !== t15 || $[83] !== t3 || $[84] !== t4 || $[85] !== t5 || $[86] !== t6 || $[87] !== t7) {
333
343
  t16 = /*#__PURE__*/_jsxs(T0, {
334
344
  children: [t3, t4, t5, t6, t7, t10, t11, children, t12, t14, t15]
335
345
  });
336
- $[75] = T0;
337
- $[76] = children;
338
- $[77] = t10;
339
- $[78] = t14;
340
- $[79] = t15;
341
- $[80] = t3;
342
- $[81] = t4;
343
- $[82] = t5;
344
- $[83] = t6;
345
- $[84] = t7;
346
- $[85] = t16;
346
+ $[78] = T0;
347
+ $[79] = children;
348
+ $[80] = t10;
349
+ $[81] = t14;
350
+ $[82] = t15;
351
+ $[83] = t3;
352
+ $[84] = t4;
353
+ $[85] = t5;
354
+ $[86] = t6;
355
+ $[87] = t7;
356
+ $[88] = t16;
347
357
  } else {
348
- t16 = $[85];
358
+ t16 = $[88];
349
359
  }
350
360
  let t17;
351
- if ($[86] !== T1 || $[87] !== t16 || $[88] !== t8 || $[89] !== t9) {
361
+ if ($[89] !== T1 || $[90] !== t16 || $[91] !== t8 || $[92] !== t9) {
352
362
  t17 = /*#__PURE__*/_jsxs(T1, {
353
363
  onOpenChange: t8,
354
364
  children: [t9, t16]
355
365
  });
356
- $[86] = T1;
357
- $[87] = t16;
358
- $[88] = t8;
359
- $[89] = t9;
360
- $[90] = t17;
366
+ $[89] = T1;
367
+ $[90] = t16;
368
+ $[91] = t8;
369
+ $[92] = t9;
370
+ $[93] = t17;
361
371
  } else {
362
- t17 = $[90];
372
+ t17 = $[93];
363
373
  }
364
374
  return t17;
375
+ }
376
+ function _temp(range) {
377
+ return range.start.line !== range.end.line || range.start.character !== range.end.character;
365
378
  }
@@ -12,6 +12,7 @@ import { RenameCard } from "./RenameCard.js";
12
12
  import { RenderedDocs } from "./RenderedDocs.js";
13
13
  import { SymbolPicker } from "./SymbolPicker.js";
14
14
  import { SignatureCard } from "./SignatureCard.js";
15
+ import { WrapCard } from "./WrapCard.js";
15
16
  /*
16
17
  * Every card a language feature opens over the editor. Each feature keeps its own state and these
17
18
  * only draw it, placed by the screen position of the character it belongs to, which is read again
@@ -38,6 +39,7 @@ export function LanguagePopups({
38
39
  const symbols = useStore(language.popups, state_6 => state_6.symbols);
39
40
  const menu = useStore(language.popups, state_7 => state_7.menu);
40
41
  const authors = useStore(language.popups, state_8 => state_8.authors);
42
+ const wrap = useStore(language.popups, state_9 => state_9.wrap);
41
43
  useEffect(() => language.editor.onViewChange(redraw), [language]);
42
44
  const hoverRect = hover === null ? null : language.editor.rectAt(hover.anchor);
43
45
  const completionRect = completion === null ? null : language.editor.rectAt(completion.anchor);
@@ -45,6 +47,7 @@ export function LanguagePopups({
45
47
  const pickRect = pick === null ? null : language.editor.rectAt(pick.anchor);
46
48
  const renameRect = rename === null ? null : language.editor.rectAt(rename.range.start);
47
49
  const renameEnd = rename === null ? null : language.editor.rectAt(rename.range.end);
50
+ const wrapRect = wrap === null ? null : language.editor.rectAt(wrap.anchor);
48
51
  return /*#__PURE__*/_jsxs(_Fragment, {
49
52
  children: [/*#__PURE__*/_jsx(RenderedDocs, {
50
53
  language: language
@@ -92,6 +95,10 @@ export function LanguagePopups({
92
95
  }), authors !== null && /*#__PURE__*/_jsx(CodeAuthorsCard, {
93
96
  language: language,
94
97
  view: authors
98
+ }), wrap !== null && wrapRect !== null && /*#__PURE__*/_jsx(WrapCard, {
99
+ language: language,
100
+ view: wrap,
101
+ rect: wrapRect
95
102
  }), children, rename !== null && renameRect !== null && /*#__PURE__*/_jsx(RenameCard, {
96
103
  language: language,
97
104
  view: rename,