@adecore/editor-react 0.62.1 → 0.63.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 (264) hide show
  1. package/README.md +2 -2
  2. package/dist/AnchoredPopup.d.ts +2 -1
  3. package/dist/CompletionPopup.js +0 -2
  4. package/dist/DiffView.d.ts +1 -28
  5. package/dist/EditorView.js +0 -1
  6. package/dist/HoverSections.d.ts +1 -8
  7. package/dist/HoverSections.js +2 -2
  8. package/dist/LanguagePopups.js +30 -14
  9. package/dist/PanelResizeHandle.js +0 -1
  10. package/dist/PeekPanel.js +0 -1
  11. package/dist/PickPopup.js +0 -1
  12. package/dist/RenderedDocs.js +0 -2
  13. package/dist/SplitDiffView.d.ts +1 -1
  14. package/dist/SymbolPicker.js +0 -1
  15. package/dist/call-hierarchy-model.js +0 -4
  16. package/dist/call-hierarchy.d.ts +9 -2
  17. package/dist/call-hierarchy.js +51 -67
  18. package/dist/clipboard-history.d.ts +3 -0
  19. package/dist/clipboard-history.js +0 -1
  20. package/dist/code-actions-model.js +1 -1
  21. package/dist/code-actions.d.ts +14 -2
  22. package/dist/code-actions.js +14 -9
  23. package/dist/code-authors.js +4 -12
  24. package/dist/code-vision-model.d.ts +0 -1
  25. package/dist/code-vision-model.js +1 -2
  26. package/dist/code-vision.d.ts +11 -3
  27. package/dist/code-vision.js +13 -18
  28. package/dist/completion-call.d.ts +1 -1
  29. package/dist/completion-call.js +2 -1
  30. package/dist/completion-model.d.ts +5 -4
  31. package/dist/completion-model.js +4 -4
  32. package/dist/completion.d.ts +13 -4
  33. package/dist/completion.js +19 -18
  34. package/dist/context-menu-rows.d.ts +2 -1
  35. package/dist/context-menu.d.ts +9 -3
  36. package/dist/context-menu.js +17 -19
  37. package/dist/definition-link.d.ts +8 -2
  38. package/dist/definition-link.js +4 -2
  39. package/dist/diagnostics-model.d.ts +6 -8
  40. package/dist/diagnostics-model.js +1 -54
  41. package/dist/diagnostics.d.ts +9 -7
  42. package/dist/diagnostics.js +6 -4
  43. package/dist/diff-view-props.d.ts +28 -0
  44. package/dist/diff-view-props.js +1 -0
  45. package/dist/doc-comment-model.js +0 -2
  46. package/dist/document-colors.d.ts +9 -4
  47. package/dist/document-colors.js +7 -4
  48. package/dist/document-links.d.ts +2 -3
  49. package/dist/document-links.js +2 -3
  50. package/dist/document-query.d.ts +2 -2
  51. package/dist/edit-locations.js +4 -22
  52. package/dist/editor-language.d.ts +12 -7
  53. package/dist/editor-language.js +54 -45
  54. package/dist/emmet.d.ts +3 -2
  55. package/dist/folding.d.ts +2 -4
  56. package/dist/folding.js +1 -2
  57. package/dist/format-on-type.d.ts +8 -2
  58. package/dist/format-on-type.js +8 -6
  59. package/dist/highlights.d.ts +2 -6
  60. package/dist/highlights.js +3 -3
  61. package/dist/history.d.ts +8 -2
  62. package/dist/history.js +4 -2
  63. package/dist/host-types.d.ts +39 -22
  64. package/dist/hover-content.js +0 -1
  65. package/dist/hover.d.ts +13 -2
  66. package/dist/hover.js +25 -28
  67. package/dist/index.d.ts +19 -9
  68. package/dist/index.js +5 -2
  69. package/dist/inlay-hints.d.ts +12 -21
  70. package/dist/inlay-hints.js +16 -15
  71. package/dist/inline-completion.d.ts +30 -10
  72. package/dist/inline-completion.js +346 -102
  73. package/dist/key-priority.d.ts +1 -1
  74. package/dist/key-priority.js +2 -2
  75. package/dist/language-context.d.ts +30 -0
  76. package/dist/language-context.js +1 -0
  77. package/dist/language-ids.d.ts +0 -1
  78. package/dist/language-ids.js +0 -32
  79. package/dist/line-text.js +0 -1
  80. package/dist/linked-editing.d.ts +2 -4
  81. package/dist/linked-editing.js +1 -3
  82. package/dist/live-templates.d.ts +14 -2
  83. package/dist/live-templates.js +15 -10
  84. package/dist/locales/en.d.ts +357 -0
  85. package/dist/locales/en.js +356 -0
  86. package/dist/locales/nl.d.ts +357 -0
  87. package/dist/locales/nl.js +356 -0
  88. package/dist/markup-context.d.ts +7 -6
  89. package/dist/markup-context.js +0 -1
  90. package/dist/markup.d.ts +8 -2
  91. package/dist/markup.js +19 -20
  92. package/dist/models.d.ts +2 -1
  93. package/dist/models.js +2 -1
  94. package/dist/navigation-history.d.ts +7 -0
  95. package/dist/navigation.d.ts +11 -8
  96. package/dist/navigation.js +9 -20
  97. package/dist/panel-size.d.ts +4 -0
  98. package/dist/paste-history.d.ts +8 -2
  99. package/dist/paste-history.js +4 -2
  100. package/dist/patch-layout.d.ts +0 -4
  101. package/dist/patch-layout.js +1 -1
  102. package/dist/peek-model.js +0 -1
  103. package/dist/peek.d.ts +8 -2
  104. package/dist/peek.js +31 -42
  105. package/dist/pick.d.ts +4 -2
  106. package/dist/pick.js +38 -15
  107. package/dist/popups.d.ts +25 -20
  108. package/dist/popups.js +31 -15
  109. package/dist/positions.d.ts +7 -0
  110. package/dist/positions.js +54 -0
  111. package/dist/postfix.d.ts +11 -2
  112. package/dist/postfix.js +10 -6
  113. package/dist/project-language.d.ts +11 -3
  114. package/dist/project-language.js +40 -9
  115. package/dist/project-problems.d.ts +7 -1
  116. package/dist/project-problems.js +2 -1
  117. package/dist/rename-model.js +1 -1
  118. package/dist/rename.d.ts +2 -2
  119. package/dist/rename.js +17 -22
  120. package/dist/rendered-docs.d.ts +8 -2
  121. package/dist/rendered-docs.js +5 -4
  122. package/dist/selection-ranges.d.ts +2 -2
  123. package/dist/semantic-tokens.d.ts +2 -4
  124. package/dist/semantic-tokens.js +2 -2
  125. package/dist/shortcut-keys.d.ts +2 -1
  126. package/dist/signature.d.ts +2 -2
  127. package/dist/signature.js +9 -15
  128. package/dist/snippet-field-transforms.js +1 -1
  129. package/dist/snippet-insert.d.ts +4 -2
  130. package/dist/snippet-insert.js +9 -15
  131. package/dist/snippet-session.d.ts +9 -4
  132. package/dist/snippet-session.js +14 -14
  133. package/dist/snippet-transform-format.d.ts +2 -1
  134. package/dist/snippet-transform-queue.d.ts +2 -4
  135. package/dist/snippet-transform-queue.js +5 -37
  136. package/dist/snippet.d.ts +2 -1
  137. package/dist/surround-constructs.d.ts +1 -1
  138. package/dist/surround.d.ts +13 -2
  139. package/dist/surround.js +15 -8
  140. package/dist/symbol-links.d.ts +0 -1
  141. package/dist/symbol-links.js +1 -1
  142. package/dist/symbol-picker-model.d.ts +0 -1
  143. package/dist/symbol-picker-model.js +1 -2
  144. package/dist/symbol-picker.d.ts +2 -2
  145. package/dist/symbol-picker.js +5 -10
  146. package/dist/symbols.d.ts +4 -3
  147. package/dist/template-builtins.d.ts +1 -1
  148. package/dist/template-builtins.js +0 -1
  149. package/dist/template-context.d.ts +3 -3
  150. package/dist/template-context.js +2 -11
  151. package/dist/template-types.d.ts +20 -0
  152. package/dist/template-types.js +1 -0
  153. package/dist/templates.d.ts +5 -20
  154. package/dist/templates.js +0 -1
  155. package/dist/testing.d.ts +6 -0
  156. package/dist/testing.js +42 -0
  157. package/dist/use-problem-counts.d.ts +1 -1
  158. package/dist/word-diff.d.ts +1 -1
  159. package/dist/word-diff.js +16 -25
  160. package/dist/workspace-edit.d.ts +1 -24
  161. package/dist/workspace-edit.js +0 -1
  162. package/package.json +10 -9
  163. package/src/AnchoredPopup.tsx +1 -1
  164. package/src/CompletionPopup.tsx +0 -2
  165. package/src/DiffView.tsx +6 -38
  166. package/src/EditorView.tsx +0 -1
  167. package/src/HoverSections.tsx +2 -2
  168. package/src/LanguagePopups.tsx +20 -14
  169. package/src/PanelResizeHandle.tsx +0 -1
  170. package/src/PeekPanel.tsx +0 -1
  171. package/src/PickPopup.tsx +0 -1
  172. package/src/RenderedDocs.tsx +0 -2
  173. package/src/SplitDiffView.tsx +1 -1
  174. package/src/SymbolPicker.tsx +0 -1
  175. package/src/call-hierarchy-model.ts +0 -7
  176. package/src/call-hierarchy.ts +32 -31
  177. package/src/clipboard-history.ts +5 -2
  178. package/src/code-actions-model.ts +1 -4
  179. package/src/code-actions.ts +26 -10
  180. package/src/code-authors.ts +4 -15
  181. package/src/code-vision-model.ts +1 -2
  182. package/src/code-vision.ts +23 -19
  183. package/src/completion-call.ts +2 -2
  184. package/src/completion-model.ts +12 -7
  185. package/src/completion.ts +31 -16
  186. package/src/context-menu-rows.ts +1 -1
  187. package/src/context-menu.ts +19 -10
  188. package/src/definition-link.ts +12 -4
  189. package/src/diagnostics-model.ts +8 -55
  190. package/src/diagnostics.ts +11 -20
  191. package/src/diff-view-props.ts +38 -0
  192. package/src/doc-comment-model.ts +0 -2
  193. package/src/document-colors.ts +14 -6
  194. package/src/document-links.ts +5 -6
  195. package/src/document-query.ts +3 -3
  196. package/src/edit-locations.ts +4 -19
  197. package/src/editor-language.ts +74 -39
  198. package/src/emmet.ts +2 -3
  199. package/src/folding.ts +4 -5
  200. package/src/format-on-type.ts +14 -7
  201. package/src/highlights.ts +6 -6
  202. package/src/history.ts +12 -4
  203. package/src/host-types.ts +52 -33
  204. package/src/hover-content.ts +0 -1
  205. package/src/hover.ts +29 -22
  206. package/src/index.ts +25 -14
  207. package/src/inlay-hints.ts +23 -17
  208. package/src/inline-completion.ts +340 -90
  209. package/src/key-priority.ts +2 -2
  210. package/src/language-context.ts +60 -0
  211. package/src/language-ids.ts +0 -34
  212. package/src/line-text.ts +0 -1
  213. package/src/linked-editing.ts +4 -6
  214. package/src/live-templates.ts +27 -13
  215. package/src/locales/en.ts +356 -0
  216. package/src/locales/nl.ts +356 -0
  217. package/src/markup-context.ts +6 -9
  218. package/src/markup.ts +19 -10
  219. package/src/models.ts +2 -1
  220. package/src/navigation-history.ts +11 -0
  221. package/src/navigation.ts +18 -20
  222. package/src/panel-size.ts +8 -0
  223. package/src/paste-history.ts +12 -4
  224. package/src/patch-layout.ts +1 -1
  225. package/src/peek-model.ts +0 -1
  226. package/src/peek.ts +22 -18
  227. package/src/pick.ts +30 -16
  228. package/src/popups.ts +61 -40
  229. package/src/positions.ts +54 -0
  230. package/src/postfix.ts +21 -8
  231. package/src/project-language.ts +63 -14
  232. package/src/project-problems.ts +10 -2
  233. package/src/proposal-model.ts +0 -1
  234. package/src/rename-model.ts +1 -1
  235. package/src/rename.ts +21 -24
  236. package/src/rendered-docs.ts +13 -6
  237. package/src/selection-ranges.ts +2 -2
  238. package/src/semantic-tokens.ts +5 -5
  239. package/src/shortcut-keys.ts +1 -1
  240. package/src/signature.ts +8 -8
  241. package/src/snippet-field-transforms.ts +1 -1
  242. package/src/snippet-insert.ts +21 -14
  243. package/src/snippet-session.ts +25 -24
  244. package/src/snippet-transform-format.ts +1 -1
  245. package/src/snippet-transform-queue.ts +5 -51
  246. package/src/snippet.ts +1 -1
  247. package/src/surround-constructs.ts +1 -1
  248. package/src/surround.ts +24 -12
  249. package/src/symbol-links.ts +1 -1
  250. package/src/symbol-picker-model.ts +1 -4
  251. package/src/symbol-picker.ts +6 -7
  252. package/src/symbols.ts +3 -4
  253. package/src/template-builtins.ts +1 -2
  254. package/src/template-context.ts +5 -14
  255. package/src/template-types.ts +43 -0
  256. package/src/templates.ts +9 -45
  257. package/src/testing.ts +52 -0
  258. package/src/use-problem-counts.ts +1 -1
  259. package/src/word-diff.ts +17 -28
  260. package/src/workspace-edit.ts +1 -34
  261. package/dist/locales/en.json +0 -356
  262. package/dist/locales/nl.json +0 -356
  263. package/src/locales/en.json +0 -356
  264. package/src/locales/nl.json +0 -356
package/README.md CHANGED
@@ -24,7 +24,7 @@ bun add @adecore/editor-react
24
24
  @source "../node_modules/@adecore/editor-react/dist";
25
25
  ```
26
26
 
27
- Add `@adecore/editor-react/locales/en.json` and `nl.json` to i18next as the `editor` namespace, then:
27
+ Add `@adecore/editor-react/locales/en` and `nl` to i18next as the `editor` namespace, then:
28
28
 
29
29
  ```tsx
30
30
  import { EditorView, ProjectLanguage } from '@adecore/editor-react';
@@ -42,7 +42,7 @@ const project = new ProjectLanguage(service, { folder, keymap, openPlace, files,
42
42
  | `@adecore/editor-react/models` | The pure models, without React |
43
43
  | `@adecore/editor-react/testing` | `FakeLanguageService` and `ManualTimers` |
44
44
  | `@adecore/editor-react/editor-react.css` | The styles of the cards |
45
- | `@adecore/editor-react/locales/*.json` | The words, in English and Dutch |
45
+ | `@adecore/editor-react/locales/*` | The words, in English and Dutch |
46
46
 
47
47
  ## Documentation
48
48
 
@@ -1,7 +1,7 @@
1
1
  import type { EditorRect } from '@adecore/editor';
2
2
  import { type ReactNode } from 'react';
3
3
  import { type PlaceOptions } from './popup-placement.ts';
4
- export interface AnchoredPopupProps {
4
+ interface AnchoredPopupProps {
5
5
  rect: EditorRect;
6
6
  className?: string;
7
7
  overflow?: 'scroll' | 'clip';
@@ -11,3 +11,4 @@ export interface AnchoredPopupProps {
11
11
  onPointerLeave?(): void;
12
12
  }
13
13
  export declare function AnchoredPopup({ rect, className, overflow, children, placement, onPointerEnter, onPointerLeave }: AnchoredPopupProps): import("react").ReactPortal;
14
+ export {};
@@ -9,7 +9,6 @@ import { PathText } from "./PathText.js";
9
9
  import { keepFocusOutOfList, useInputPopup } from './popup-focus.js';
10
10
  import { placeBeside, placePopup } from './popup-placement.js';
11
11
  import { TONE_CLASSES } from './symbol-picker-model.js';
12
- /* The label with the characters that match what was typed set apart. */
13
12
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
13
  function MarkedLabel(t0) {
15
14
  const $ = _c(7);
@@ -76,7 +75,6 @@ const ROW_HEIGHT = 24;
76
75
  const VISIBLE_ROWS = 8;
77
76
  /* Rows drawn past the visible ones on each side, so a wheel turn lands on rows that exist. */
78
77
  const OVERSCAN_ROWS = 6;
79
- /* The padding the listbox has around its rows. */
80
78
  const LIST_PADDING = 4;
81
79
  /* What a row takes besides its name and namespace: padding, the kind badge and the gaps. */
82
80
  const ROW_CHROME = 72;
@@ -1,29 +1,2 @@
1
- import type { Editor, EditorEngine, EditorTheme } from '@adecore/editor';
2
- import { type DiffDocument, type DiffSourceLine } from '@adecore/merge';
3
- import { type Ref } from 'react';
4
- import { type DiffLimits } from './diff-expansion.ts';
5
- import { type DiffSourceTokens } from './diff-syntax.ts';
6
- export interface DiffViewProps {
7
- engine: EditorEngine;
8
- document: DiffDocument;
9
- theme: EditorTheme;
10
- tokens?: DiffSourceTokens;
11
- wrap?: boolean;
12
- layout?: 'unified' | 'split';
13
- splitWrapLimit?: number;
14
- fill?: boolean;
15
- maxHeight?: number;
16
- unfoldLimits?: DiffLimits;
17
- label: string;
18
- numbered?: boolean;
19
- className?: string;
20
- ref?: Ref<HTMLDivElement>;
21
- onMount?(editor: Editor, side?: 'old' | 'new'): void | (() => void);
22
- onSource?(source: DiffSource): void | (() => void);
23
- }
24
- export interface DiffSource {
25
- readonly editor: Editor;
26
- readonly side?: 'old' | 'new';
27
- at(): DiffSourceLine | null;
28
- }
1
+ import type { DiffViewProps } from './diff-view-props.ts';
29
2
  export declare function DiffView(props: DiffViewProps): import("react").JSX.Element;
@@ -32,7 +32,6 @@ function sameFields(left, right) {
32
32
  const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
33
33
  return [...keys].every(key => left[key] === right[key]);
34
34
  }
35
- /* Hands the editor the settings that changed by value, so a new options object with the same values costs nothing. */
36
35
  function applyChangedOptions(editor, before, after) {
37
36
  if (before.theme !== after.theme) {
38
37
  editor.setTheme(after.theme);
@@ -1,16 +1,9 @@
1
- import { type DocTag, type HoverSection, type HoverText } from './hover-content.ts';
1
+ import { type HoverText } from './hover-content.ts';
2
2
  export declare function Signature({ code, language, onName }: {
3
3
  code: string;
4
4
  language: string;
5
5
  onName?: (name: string) => void;
6
6
  }): import("react").JSX.Element;
7
- export declare function DocTags({ tags }: {
8
- tags: readonly DocTag[];
9
- }): import("react").JSX.Element;
10
- export declare function SymbolSection({ section, onName }: {
11
- section: HoverSection;
12
- onName?: (name: string, declared: string | null) => void;
13
- }): import("react").JSX.Element;
14
7
  export declare function SymbolSections({ text, onName }: {
15
8
  text: HoverText;
16
9
  onName?: (name: string, declared: string | null) => void;
@@ -90,7 +90,7 @@ export function Signature(t0) {
90
90
  }
91
91
  /* A docblock's tags as rows: the tag once beside each run of the same tag, so a list of parameters reads as one. */
92
92
  function _temp() {}
93
- export function DocTags(t0) {
93
+ function DocTags(t0) {
94
94
  const $ = _c(4);
95
95
  const {
96
96
  tags
@@ -128,7 +128,7 @@ export function DocTags(t0) {
128
128
  return t2;
129
129
  }
130
130
  /* One symbol: its qualified name muted, its signature, the prose and examples as compact blocks, and its tags as rows. Names in the signature are links only where `onName` says what a press does. */
131
- export function SymbolSection(t0) {
131
+ function SymbolSection(t0) {
132
132
  const $ = _c(27);
133
133
  const {
134
134
  section,
@@ -1,5 +1,5 @@
1
- import { useEffect, useReducer } from 'react';
2
- import { useStore } from 'zustand';
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useEffect, useReducer, useSyncExternalStore } from 'react';
3
3
  import { AnchoredPopup } from "./AnchoredPopup.js";
4
4
  import { CallHierarchyPanel } from "./CallHierarchyPanel.js";
5
5
  import { CodeAuthorsCard } from "./CodeAuthorsCard.js";
@@ -13,12 +13,28 @@ import { RenderedDocs } from "./RenderedDocs.js";
13
13
  import { SignatureCard } from "./SignatureCard.js";
14
14
  import { SymbolPicker } from "./SymbolPicker.js";
15
15
  import { WrapCard } from "./WrapCard.js";
16
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
17
+ function useSlot(slot) {
18
+ const $ = _c(3);
19
+ let t0;
20
+ let t1;
21
+ if ($[0] !== slot) {
22
+ t0 = listener => slot.subscribe(listener);
23
+ t1 = () => slot.get();
24
+ $[0] = slot;
25
+ $[1] = t0;
26
+ $[2] = t1;
27
+ } else {
28
+ t0 = $[1];
29
+ t1 = $[2];
30
+ }
31
+ return useSyncExternalStore(t0, t1);
32
+ }
16
33
  /*
17
34
  * Every card a language feature opens over the editor. Each feature keeps its own state and these
18
35
  * only draw it, placed by the screen position of the character it belongs to, which is read again
19
36
  * whenever the editor scrolls or resizes.
20
37
  */
21
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
22
38
  export function LanguagePopups({
23
39
  language,
24
40
  contextMenuItems,
@@ -29,17 +45,17 @@ export function LanguagePopups({
29
45
  'use no memo';
30
46
 
31
47
  const [, redraw] = useReducer(count => count + 1, 0);
32
- const hover = useStore(language.popups, state => state.hover);
33
- const completion = useStore(language.popups, state_0 => state_0.completion);
34
- const signature = useStore(language.popups, state_1 => state_1.signature);
35
- const pick = useStore(language.popups, state_2 => state_2.pick);
36
- const rename = useStore(language.popups, state_3 => state_3.rename);
37
- const peek = useStore(language.popups, state_4 => state_4.peek);
38
- const callHierarchy = useStore(language.popups, state_5 => state_5.callHierarchy);
39
- const symbols = useStore(language.popups, state_6 => state_6.symbols);
40
- const menu = useStore(language.popups, state_7 => state_7.menu);
41
- const authors = useStore(language.popups, state_8 => state_8.authors);
42
- const wrap = useStore(language.popups, state_9 => state_9.wrap);
48
+ const hover = useSlot(language.popups.slot('hover'));
49
+ const completion = useSlot(language.popups.slot('completion'));
50
+ const signature = useSlot(language.popups.slot('signature'));
51
+ const pick = useSlot(language.popups.slot('pick'));
52
+ const rename = useSlot(language.popups.slot('rename'));
53
+ const peek = useSlot(language.popups.slot('peek'));
54
+ const callHierarchy = useSlot(language.popups.slot('callHierarchy'));
55
+ const symbols = useSlot(language.popups.slot('symbols'));
56
+ const menu = useSlot(language.popups.slot('menu'));
57
+ const authors = useSlot(language.popups.slot('authors'));
58
+ const wrap = useSlot(language.popups.slot('wrap'));
43
59
  useEffect(() => language.editor.onViewChange(redraw), [language]);
44
60
  const hoverRect = hover === null ? null : language.editor.rectAt(hover.anchor);
45
61
  const completionRect = completion === null ? null : language.editor.rectAt(completion.anchor);
@@ -3,7 +3,6 @@ import { useEffect, useRef, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { PANEL_BODY_MIN, PANEL_KEY_STEP, availableHeightOf, clampPanelBody, panelBodyMax } from './panel-size.js';
5
5
  import { realTimers, revealRow } from './timers.js';
6
- /* The bottom edge of a panel: a drag, or the arrow keys, change the height of its body. */
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
8
7
  export function PanelResizeHandle(t0) {
9
8
  const $ = _c(34);
package/dist/PeekPanel.js CHANGED
@@ -353,7 +353,6 @@ function _temp2(place) {
353
353
  return place.text;
354
354
  }
355
355
  const NO_LINES = new Map();
356
- /* A line of code in the colors of its syntax with the name marked, or with its name in the text color and the rest muted while no colors are at hand. */
357
356
  function PlaceText(t0) {
358
357
  const $ = _c(27);
359
358
  const {
package/dist/PickPopup.js CHANGED
@@ -7,7 +7,6 @@ import { keepFocusOutOfList, useInputPopup } from './popup-focus.js';
7
7
  import { placePopup } from './popup-placement.js';
8
8
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  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)';
10
- /* The label with the part a query matched marked, whatever the case. */
11
10
  function MatchedLabel(t0) {
12
11
  const $ = _c(18);
13
12
  const {
@@ -10,7 +10,6 @@ import { Markdown } from "./Markdown.js";
10
10
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  const LINK = /\[([^\]]*)\]\(#doc-link:[^)]*\)/g;
12
12
  const KNOWN = new Set(['deprecated', 'template', 'param', 'property', 'type', 'var', 'return', 'yield', 'throws', 'see', 'example', 'since', 'version', 'author']);
13
- /* Code in the editor's face, with a type fainter than a name. */
14
13
  function Code(t0) {
15
14
  const $ = _c(3);
16
15
  const {
@@ -33,7 +32,6 @@ function Code(t0) {
33
32
  }
34
33
  return t3;
35
34
  }
36
- /* Markdown prose and fenced code as the hover draws them: the blocks in the code face, the rest muted. */
37
35
  function Prose(t0) {
38
36
  const $ = _c(10);
39
37
  const {
@@ -1,5 +1,5 @@
1
1
  import { type DiffSplit } from '@adecore/merge';
2
- import type { DiffViewProps } from './DiffView.tsx';
2
+ import type { DiffViewProps } from './diff-view-props.ts';
3
3
  interface SplitViewProps extends DiffViewProps {
4
4
  display: DiffSplit;
5
5
  unfold(id: number): void;
@@ -10,7 +10,6 @@ import { basenameOf } from './paths.js';
10
10
  import { filterEntries, groupEntries, letterOfKind, modeOf, toneOfKind, TONE_CLASSES } from './symbol-picker-model.js';
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const SEARCH_DELAY_MS = 200;
13
- /* The letter badge of a symbol kind, tinted by what the symbol is. */
14
13
  export function SymbolBadge(t0) {
15
14
  const $ = _c(5);
16
15
  const {
@@ -1,18 +1,14 @@
1
- /* Whether a direction walks a type hierarchy and not the calls. */
2
1
  export function isTypeDirection(direction) {
3
2
  return direction === 'supertypes' || direction === 'subtypes';
4
3
  }
5
4
  /* The most calls of one level that are drawn at once; the rest wait behind a row that shows more. */
6
5
  export const CALL_LEVEL_LIMIT = 50;
7
- /* The id of the status line under a node. */
8
6
  export function statusIdOf(parent) {
9
7
  return `${parent}:status`;
10
8
  }
11
- /* The id of the line that shows more calls under a node. */
12
9
  export function moreIdOf(parent) {
13
10
  return `${parent}:more`;
14
11
  }
15
- /* The tree's roots, each one a symbol the server prepared. */
16
12
  export function rootsOf(items) {
17
13
  return items.map((item, index) => ({
18
14
  id: `r${index}`,
@@ -1,10 +1,16 @@
1
1
  import type { EditorPosition } from '@adecore/editor';
2
2
  import { type CallDirection } from './call-hierarchy-model.ts';
3
- import type { EditorLanguage } from './editor-language.ts';
3
+ import type { LanguageContext } from './language-context.ts';
4
4
  import { type Timers } from './timers.ts';
5
5
  export declare const CALL_HIERARCHY_HEIGHT: number;
6
+ interface CallHierarchyPeers {
7
+ readonly peek: {
8
+ close(): void;
9
+ };
10
+ }
6
11
  export declare class CallHierarchyFeature {
7
12
  private readonly language;
13
+ private readonly peers;
8
14
  private readonly timers;
9
15
  private nodes;
10
16
  private roots;
@@ -15,7 +21,7 @@ export declare class CallHierarchyFeature {
15
21
  private epoch;
16
22
  private previewEpoch;
17
23
  private texts;
18
- constructor(language: EditorLanguage, timers?: Timers);
24
+ constructor(language: LanguageContext, peers: CallHierarchyPeers, timers?: Timers);
19
25
  get isOpen(): boolean;
20
26
  get supported(): boolean;
21
27
  get typesSupported(): boolean;
@@ -43,3 +49,4 @@ export declare class CallHierarchyFeature {
43
49
  private tell;
44
50
  private say;
45
51
  }
52
+ export {};
@@ -21,6 +21,7 @@ const OWNER = 'call-hierarchy';
21
21
  */
22
22
  export class CallHierarchyFeature {
23
23
  language;
24
+ peers;
24
25
  timers;
25
26
  nodes = new Map();
26
27
  roots = [];
@@ -32,8 +33,9 @@ export class CallHierarchyFeature {
32
33
  epoch = 0;
33
34
  previewEpoch = 0;
34
35
  texts = new Map();
35
- constructor(language, timers = realTimers) {
36
+ constructor(language, peers, timers = realTimers) {
36
37
  this.language = language;
38
+ this.peers = peers;
37
39
  this.timers = timers;
38
40
  const {
39
41
  editor
@@ -59,7 +61,7 @@ export class CallHierarchyFeature {
59
61
  });
60
62
  }
61
63
  get isOpen() {
62
- return this.language.popups.getState().callHierarchy !== null;
64
+ return this.language.popups.slot('callHierarchy').get() !== null;
63
65
  }
64
66
  /* Whether a server of this document answers the three requests the tree is made of. */
65
67
  get supported() {
@@ -115,23 +117,21 @@ export class CallHierarchyFeature {
115
117
  this.tell(this.say(types ? 'typesNone' : 'none'));
116
118
  return;
117
119
  }
118
- this.language.peek.close();
120
+ this.peers.peek.close();
119
121
  this.prepared = items;
120
122
  this.position = position;
121
123
  this.direction = direction;
122
124
  this.seed();
123
125
  const active = this.roots[0];
124
- this.language.popups.setState({
125
- callHierarchy: {
126
- direction,
127
- container: null,
128
- name: items[0].name,
129
- rows: rowsOf(this.nodes, this.roots),
130
- active,
131
- site: 0,
132
- sites: 0,
133
- preview: null
134
- }
126
+ this.language.popups.slot('callHierarchy').set({
127
+ direction,
128
+ container: null,
129
+ name: items[0].name,
130
+ rows: rowsOf(this.nodes, this.roots),
131
+ active,
132
+ site: 0,
133
+ sites: 0,
134
+ preview: null
135
135
  });
136
136
  this.select(active);
137
137
  // The editor draws a row once per id, so a tree opened over another needs an id of its own to get a container.
@@ -148,19 +148,17 @@ export class CallHierarchyFeature {
148
148
  }
149
149
  close() {
150
150
  this.reset();
151
- if (this.language.popups.getState().callHierarchy === null) {
151
+ if (this.language.popups.slot('callHierarchy').get() === null) {
152
152
  return;
153
153
  }
154
- this.language.popups.setState({
155
- callHierarchy: null
156
- });
154
+ this.language.popups.slot('callHierarchy').set(null);
157
155
  this.language.editor.setWidgets([], OWNER);
158
156
  this.language.editor.setInputPopup(null);
159
157
  this.language.editor.focus();
160
158
  }
161
159
  /* Starts the tree over from the same symbols for the other direction; a switch between calls and types prepares the symbol again. */
162
160
  setDirection(direction) {
163
- const view = this.language.popups.getState().callHierarchy;
161
+ const view = this.language.popups.slot('callHierarchy').get();
164
162
  if (view === null || view.direction === direction) {
165
163
  return;
166
164
  }
@@ -172,16 +170,14 @@ export class CallHierarchyFeature {
172
170
  this.direction = direction;
173
171
  this.seed();
174
172
  const active = this.roots[0];
175
- this.language.popups.setState({
176
- callHierarchy: {
177
- ...view,
178
- direction,
179
- rows: rowsOf(this.nodes, this.roots),
180
- active,
181
- site: 0,
182
- sites: 0,
183
- preview: null
184
- }
173
+ this.language.popups.slot('callHierarchy').set({
174
+ ...view,
175
+ direction,
176
+ rows: rowsOf(this.nodes, this.roots),
177
+ active,
178
+ site: 0,
179
+ sites: 0,
180
+ preview: null
185
181
  });
186
182
  this.select(active);
187
183
  for (const root of this.roots) {
@@ -198,7 +194,7 @@ export class CallHierarchyFeature {
198
194
  this.patch(id, {
199
195
  expanded: false
200
196
  });
201
- const view = this.language.popups.getState().callHierarchy;
197
+ const view = this.language.popups.slot('callHierarchy').get();
202
198
  if (view !== null && this.hasAncestor(view.active, id)) {
203
199
  this.select(id);
204
200
  }
@@ -211,13 +207,11 @@ export class CallHierarchyFeature {
211
207
  void this.load(id);
212
208
  }
213
209
  }
214
- /* Asks again for the calls of a node whose last try failed. */
215
210
  retry(id) {
216
211
  if (this.nodes.get(id)?.load === 'failed') {
217
212
  void this.load(id);
218
213
  }
219
214
  }
220
- /* Brings the next stretch of calls of a level. */
221
215
  showMore(parent) {
222
216
  const node = this.nodes.get(parent);
223
217
  if (node === undefined) {
@@ -227,44 +221,40 @@ export class CallHierarchyFeature {
227
221
  shown: Math.min(node.children.length, node.shown + CALL_LEVEL_LIMIT)
228
222
  });
229
223
  const first = node.children[node.shown];
230
- const view = this.language.popups.getState().callHierarchy;
224
+ const view = this.language.popups.slot('callHierarchy').get();
231
225
  // The row that offered more is gone once everything shows, so the selection moves on to what it brought.
232
226
  if (first !== undefined && view?.active === moreIdOf(parent)) {
233
227
  this.select(first);
234
228
  }
235
229
  }
236
- /* Makes a row the active one and shows the code of its call. */
237
230
  select(id, site = 0) {
238
- const view = this.language.popups.getState().callHierarchy;
231
+ const view = this.language.popups.slot('callHierarchy').get();
239
232
  const node = this.nodes.get(id);
240
233
  if (view === null || !view.rows.some(row => row.id === id)) {
241
234
  return;
242
235
  }
243
236
  const sites = node?.sites.length ?? view.sites;
244
237
  const next = node === undefined ? view.site : Math.max(0, Math.min(Math.max(0, sites - 1), site));
245
- this.language.popups.setState({
246
- callHierarchy: {
247
- ...view,
248
- active: id,
249
- site: next,
250
- sites,
251
- preview: node === undefined ? view.preview : null
252
- }
238
+ this.language.popups.slot('callHierarchy').set({
239
+ ...view,
240
+ active: id,
241
+ site: next,
242
+ sites,
243
+ preview: node === undefined ? view.preview : null
253
244
  });
254
245
  if (node !== undefined) {
255
246
  void this.preview(node, next);
256
247
  }
257
248
  }
258
- /* Steps through the places a call is made from when the active one has more than one. */
259
249
  stepSite(direction) {
260
- const view = this.language.popups.getState().callHierarchy;
250
+ const view = this.language.popups.slot('callHierarchy').get();
261
251
  if (view !== null && view.sites > 1) {
262
252
  this.select(view.active, (view.site + direction + view.sites) % view.sites);
263
253
  }
264
254
  }
265
255
  /* Goes to the call of a row, or to the symbol of a root, and closes the tree. */
266
256
  go(id) {
267
- const view = this.language.popups.getState().callHierarchy;
257
+ const view = this.language.popups.slot('callHierarchy').get();
268
258
  const node = this.nodes.get(id);
269
259
  if (view === null || node === undefined) {
270
260
  return;
@@ -294,20 +284,18 @@ export class CallHierarchyFeature {
294
284
  this.nodes = new Map(roots.map(root => [root.id, root]));
295
285
  }
296
286
  mounted(container) {
297
- const view = this.language.popups.getState().callHierarchy;
287
+ const view = this.language.popups.slot('callHierarchy').get();
298
288
  if (view !== null && view.container !== container) {
299
- this.language.popups.setState({
300
- callHierarchy: {
301
- ...view,
302
- container
303
- }
289
+ this.language.popups.slot('callHierarchy').set({
290
+ ...view,
291
+ container
304
292
  });
305
293
  revealRow(this.timers, container);
306
294
  }
307
295
  }
308
296
  patch(id, change) {
309
297
  const node = this.nodes.get(id);
310
- const view = this.language.popups.getState().callHierarchy;
298
+ const view = this.language.popups.slot('callHierarchy').get();
311
299
  if (node === undefined || view === null) {
312
300
  return;
313
301
  }
@@ -315,11 +303,9 @@ export class CallHierarchyFeature {
315
303
  ...node,
316
304
  ...change
317
305
  });
318
- this.language.popups.setState({
319
- callHierarchy: {
320
- ...view,
321
- rows: rowsOf(this.nodes, this.roots)
322
- }
306
+ this.language.popups.slot('callHierarchy').set({
307
+ ...view,
308
+ rows: rowsOf(this.nodes, this.roots)
323
309
  });
324
310
  }
325
311
  async load(id) {
@@ -416,18 +402,16 @@ export class CallHierarchyFeature {
416
402
  this.texts.set(uri, text);
417
403
  }
418
404
  }
419
- const view = this.language.popups.getState().callHierarchy;
405
+ const view = this.language.popups.slot('callHierarchy').get();
420
406
  if (view === null || view.active !== node.id) {
421
407
  return;
422
408
  }
423
409
  const snippet = text === undefined ? null : snippetOf(text, range.start.line, range);
424
- this.language.popups.setState({
425
- callHierarchy: {
426
- ...view,
427
- preview: snippet === null ? null : {
428
- ...snippet,
429
- uri
430
- }
410
+ this.language.popups.slot('callHierarchy').set({
411
+ ...view,
412
+ preview: snippet === null ? null : {
413
+ ...snippet,
414
+ uri
431
415
  }
432
416
  });
433
417
  }
@@ -445,7 +429,7 @@ export class CallHierarchyFeature {
445
429
  return false;
446
430
  }
447
431
  key(event) {
448
- const view = this.language.popups.getState().callHierarchy;
432
+ const view = this.language.popups.slot('callHierarchy').get();
449
433
  if (view === null || event.metaKey || event.ctrlKey || event.altKey || event.shiftKey || event.isComposing) {
450
434
  return false;
451
435
  }
@@ -1,3 +1,6 @@
1
+ export interface ClipboardHost {
2
+ readonly clipboard?: ClipboardHistory;
3
+ }
1
4
  export interface ClipboardEntry {
2
5
  readonly text: string;
3
6
  readonly wholeLines: boolean;
@@ -54,7 +54,6 @@ export class ClipboardHistory {
54
54
  this.onChange?.(this.list);
55
55
  this.listeners.forEach(listener => listener());
56
56
  }
57
- /* Keeps the newest entries that fit the limit and the total length. */
58
57
  trimmed(entries) {
59
58
  const kept = [];
60
59
  let length = 0;
@@ -1,5 +1,5 @@
1
1
  import { applyTextEdits } from '@adecore/lsp';
2
- import { comparePositions } from './diagnostics-model.js';
2
+ import { comparePositions } from './positions.js';
3
3
  import { uniqueBy } from './unique.js';
4
4
  import { resourceOperationsOf, textEntriesOf } from './workspace-edit.js';
5
5
  /* The order of the list under the caret: the fixes and the rewrites that are one keystroke away first, the refactorings after them. */
@@ -1,13 +1,24 @@
1
1
  import { type ActionEntry } from './code-actions-model.ts';
2
+ import type { CompletionFeature } from './completion.ts';
2
3
  import { type Problem } from './diagnostics-model.ts';
3
- import type { EditorLanguage } from './editor-language.ts';
4
+ import type { DiagnosticsFeature } from './diagnostics.ts';
5
+ import type { LanguageContext } from './language-context.ts';
6
+ import type { PickFeature } from './pick.ts';
7
+ import type { RenameFeature } from './rename.ts';
4
8
  import { type Timers } from './timers.ts';
9
+ interface CodeActionsPeers {
10
+ readonly diagnostics: Pick<DiagnosticsFeature, 'at' | 'onChange' | 'problems'>;
11
+ readonly completion: Pick<CompletionFeature, 'close'>;
12
+ readonly pick: Pick<PickFeature, 'open'>;
13
+ readonly rename: Pick<RenameFeature, 'start'>;
14
+ }
5
15
  export declare class CodeActionsFeature {
6
16
  private readonly language;
17
+ private readonly peers;
7
18
  private readonly refresher;
8
19
  private asking;
9
20
  private readonly resolved;
10
- constructor(language: EditorLanguage, timers?: Timers);
21
+ constructor(language: LanguageContext, peers: CodeActionsPeers, timers?: Timers);
11
22
  get supported(): boolean;
12
23
  open(): Promise<void>;
13
24
  refactorThis(): Promise<void>;
@@ -30,3 +41,4 @@ export declare class CodeActionsFeature {
30
41
  private fail;
31
42
  private say;
32
43
  }
44
+ export {};