@adecore/editor-react 0.22.1 → 0.23.1

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 (209) hide show
  1. package/dist/CallHierarchyPanel.d.ts +6 -0
  2. package/dist/CallHierarchyPanel.js +92 -0
  3. package/dist/CompletionPopup.js +11 -3
  4. package/dist/DiffView.d.ts +22 -0
  5. package/dist/DiffView.js +203 -0
  6. package/dist/EditorContextMenu.js +1 -0
  7. package/dist/EditorView.js +18 -1
  8. package/dist/FindReplace.d.ts +1 -1
  9. package/dist/FindReplace.js +41 -11
  10. package/dist/HoverCard.js +2 -2
  11. package/dist/LanguagePopups.js +4 -1
  12. package/dist/Markdown.d.ts +2 -1
  13. package/dist/Markdown.js +8 -4
  14. package/dist/PanelResizeHandle.d.ts +8 -0
  15. package/dist/PanelResizeHandle.js +71 -0
  16. package/dist/PeekPanel.d.ts +3 -0
  17. package/dist/PeekPanel.js +7 -4
  18. package/dist/PickPopup.js +15 -2
  19. package/dist/RenameCard.js +10 -5
  20. package/dist/RenderedDocs.d.ts +9 -0
  21. package/dist/RenderedDocs.js +84 -0
  22. package/dist/SplitDiffView.d.ts +9 -0
  23. package/dist/SplitDiffView.js +276 -0
  24. package/dist/SymbolPicker.d.ts +3 -0
  25. package/dist/SymbolPicker.js +4 -3
  26. package/dist/call-hierarchy-model.d.ts +52 -0
  27. package/dist/call-hierarchy-model.js +93 -0
  28. package/dist/call-hierarchy.d.ts +42 -0
  29. package/dist/call-hierarchy.js +398 -0
  30. package/dist/code-actions-model.d.ts +2 -0
  31. package/dist/code-actions-model.js +12 -10
  32. package/dist/code-actions.js +3 -1
  33. package/dist/completion-model.d.ts +14 -4
  34. package/dist/completion-model.js +40 -33
  35. package/dist/completion.d.ts +4 -0
  36. package/dist/completion.js +257 -42
  37. package/dist/diagnostics.js +8 -6
  38. package/dist/diff-expansion.d.ts +9 -0
  39. package/dist/diff-expansion.js +41 -0
  40. package/dist/diff-overlays.d.ts +15 -0
  41. package/dist/diff-overlays.js +28 -0
  42. package/dist/diff-syntax.d.ts +16 -0
  43. package/dist/diff-syntax.js +49 -0
  44. package/dist/diff-wordmarks.d.ts +5 -0
  45. package/dist/diff-wordmarks.js +26 -0
  46. package/dist/doc-comment-model.d.ts +23 -0
  47. package/dist/doc-comment-model.js +291 -0
  48. package/dist/editor-language.d.ts +13 -1
  49. package/dist/editor-language.js +15 -5
  50. package/dist/editor-react.css +79 -0
  51. package/dist/format-on-type.d.ts +14 -0
  52. package/dist/format-on-type.js +96 -0
  53. package/dist/host-types.d.ts +19 -0
  54. package/dist/hover.d.ts +4 -0
  55. package/dist/hover.js +15 -2
  56. package/dist/index.d.ts +19 -5
  57. package/dist/index.js +9 -1
  58. package/dist/inlay-hints.d.ts +47 -2
  59. package/dist/inlay-hints.js +353 -16
  60. package/dist/language-ids.js +4 -2
  61. package/dist/locales/en.json +117 -3
  62. package/dist/locales/nl.json +117 -3
  63. package/dist/models.d.ts +6 -2
  64. package/dist/models.js +5 -1
  65. package/dist/panel-size.d.ts +6 -0
  66. package/dist/panel-size.js +25 -0
  67. package/dist/patch-decorations.d.ts +27 -0
  68. package/dist/patch-decorations.js +182 -0
  69. package/dist/patch-layout.d.ts +40 -0
  70. package/dist/patch-layout.js +304 -0
  71. package/dist/peek.d.ts +3 -1
  72. package/dist/peek.js +6 -1
  73. package/dist/pick.d.ts +1 -0
  74. package/dist/pick.js +11 -1
  75. package/dist/popups.d.ts +17 -0
  76. package/dist/popups.js +1 -0
  77. package/dist/project-language.d.ts +12 -0
  78. package/dist/project-language.js +52 -2
  79. package/dist/refresher.d.ts +1 -0
  80. package/dist/refresher.js +5 -0
  81. package/dist/rename-model.d.ts +1 -1
  82. package/dist/rename-model.js +3 -7
  83. package/dist/rename.js +5 -8
  84. package/dist/rendered-docs.d.ts +64 -0
  85. package/dist/rendered-docs.js +374 -0
  86. package/dist/row-host.d.ts +2 -0
  87. package/dist/row-host.js +11 -3
  88. package/dist/semantic-delta.d.ts +2 -0
  89. package/dist/semantic-delta.js +27 -0
  90. package/dist/semantic-model.js +16 -0
  91. package/dist/semantic-tokens.d.ts +26 -1
  92. package/dist/semantic-tokens.js +174 -14
  93. package/dist/shortcut-keys.d.ts +2 -0
  94. package/dist/shortcut-keys.js +6 -2
  95. package/dist/signature.js +1 -1
  96. package/dist/snippet-field-transforms.d.ts +30 -0
  97. package/dist/snippet-field-transforms.js +116 -0
  98. package/dist/snippet-indent.d.ts +2 -0
  99. package/dist/snippet-indent.js +49 -0
  100. package/dist/snippet-range-order.d.ts +3 -0
  101. package/dist/snippet-range-order.js +19 -0
  102. package/dist/snippet-session.d.ts +42 -6
  103. package/dist/snippet-session.js +650 -53
  104. package/dist/snippet-transform-client.d.ts +19 -0
  105. package/dist/snippet-transform-client.js +66 -0
  106. package/dist/snippet-transform-format.d.ts +15 -0
  107. package/dist/snippet-transform-format.js +302 -0
  108. package/dist/snippet-transform-protocol.d.ts +45 -0
  109. package/dist/snippet-transform-protocol.js +8 -0
  110. package/dist/snippet-transform-queue.d.ts +32 -0
  111. package/dist/snippet-transform-queue.js +173 -0
  112. package/dist/snippet-transform-worker.d.ts +10 -0
  113. package/dist/snippet-transform-worker.js +41 -0
  114. package/dist/snippet-variable-names.d.ts +1 -0
  115. package/dist/snippet-variable-names.js +36 -0
  116. package/dist/snippet-variables.d.ts +7 -0
  117. package/dist/snippet-variables.js +66 -0
  118. package/dist/snippet.d.ts +30 -3
  119. package/dist/snippet.js +402 -87
  120. package/dist/split-alignment.d.ts +6 -0
  121. package/dist/split-alignment.js +38 -0
  122. package/dist/split-scroll.d.ts +14 -0
  123. package/dist/split-scroll.js +45 -0
  124. package/dist/symbols.d.ts +2 -1
  125. package/dist/symbols.js +39 -7
  126. package/dist/testing.d.ts +5 -1
  127. package/dist/testing.js +12 -0
  128. package/dist/timers.d.ts +1 -0
  129. package/dist/timers.js +4 -0
  130. package/dist/use-panel-body.d.ts +6 -0
  131. package/dist/use-panel-body.js +13 -0
  132. package/dist/workspace-edit.d.ts +25 -3
  133. package/dist/workspace-edit.js +282 -143
  134. package/package.json +10 -5
  135. package/src/CallHierarchyPanel.tsx +244 -0
  136. package/src/CompletionPopup.tsx +12 -1
  137. package/src/DiffView.tsx +262 -0
  138. package/src/EditorContextMenu.tsx +1 -0
  139. package/src/EditorView.tsx +21 -2
  140. package/src/FindReplace.tsx +51 -13
  141. package/src/HoverCard.tsx +23 -21
  142. package/src/LanguagePopups.tsx +5 -0
  143. package/src/Markdown.tsx +10 -3
  144. package/src/PanelResizeHandle.tsx +104 -0
  145. package/src/PeekPanel.tsx +11 -6
  146. package/src/PickPopup.tsx +18 -2
  147. package/src/RenameCard.tsx +18 -0
  148. package/src/RenderedDocs.tsx +155 -0
  149. package/src/SplitDiffView.tsx +337 -0
  150. package/src/SymbolPicker.tsx +4 -3
  151. package/src/call-hierarchy-model.ts +151 -0
  152. package/src/call-hierarchy.ts +440 -0
  153. package/src/code-actions-model.ts +17 -11
  154. package/src/code-actions.ts +3 -1
  155. package/src/completion-model.ts +61 -35
  156. package/src/completion.ts +302 -42
  157. package/src/diagnostics.ts +8 -6
  158. package/src/diff-expansion.ts +49 -0
  159. package/src/diff-overlays.tsx +69 -0
  160. package/src/diff-syntax.ts +67 -0
  161. package/src/diff-wordmarks.ts +31 -0
  162. package/src/doc-comment-model.ts +336 -0
  163. package/src/editor-language.ts +22 -6
  164. package/src/editor-react.css +79 -0
  165. package/src/format-on-type.ts +111 -0
  166. package/src/host-types.ts +23 -0
  167. package/src/hover.ts +18 -3
  168. package/src/index.ts +27 -4
  169. package/src/inlay-hints.ts +394 -18
  170. package/src/language-ids.ts +4 -2
  171. package/src/locales/en.json +117 -3
  172. package/src/locales/nl.json +117 -3
  173. package/src/models.ts +40 -1
  174. package/src/panel-size.ts +28 -0
  175. package/src/patch-decorations.ts +224 -0
  176. package/src/patch-layout.ts +388 -0
  177. package/src/peek.ts +6 -1
  178. package/src/pick.ts +12 -1
  179. package/src/popups.ts +24 -0
  180. package/src/project-language.ts +63 -2
  181. package/src/refresher.ts +6 -0
  182. package/src/rename-model.ts +4 -8
  183. package/src/rename.ts +5 -8
  184. package/src/rendered-docs.ts +430 -0
  185. package/src/row-host.ts +12 -3
  186. package/src/semantic-delta.ts +29 -0
  187. package/src/semantic-model.ts +17 -0
  188. package/src/semantic-tokens.ts +202 -19
  189. package/src/shortcut-keys.ts +6 -2
  190. package/src/signature.ts +1 -1
  191. package/src/snippet-field-transforms.ts +144 -0
  192. package/src/snippet-indent.ts +53 -0
  193. package/src/snippet-range-order.ts +19 -0
  194. package/src/snippet-session.ts +797 -56
  195. package/src/snippet-transform-client.ts +84 -0
  196. package/src/snippet-transform-format.ts +325 -0
  197. package/src/snippet-transform-protocol.ts +24 -0
  198. package/src/snippet-transform-queue.ts +199 -0
  199. package/src/snippet-transform-worker.ts +58 -0
  200. package/src/snippet-variable-names.ts +36 -0
  201. package/src/snippet-variables.ts +74 -0
  202. package/src/snippet.ts +452 -89
  203. package/src/split-alignment.ts +45 -0
  204. package/src/split-scroll.ts +54 -0
  205. package/src/symbols.ts +43 -7
  206. package/src/testing.ts +25 -0
  207. package/src/timers.ts +5 -0
  208. package/src/use-panel-body.ts +17 -0
  209. package/src/workspace-edit.ts +347 -169
@@ -17,6 +17,36 @@
17
17
  color: var(--accent);
18
18
  text-decoration: underline;
19
19
  }
20
+ /* Documentation drawn in place of a comment: lists and quotes that the base layer strips of their marks. */
21
+ .adecore-rendered-doc ul,
22
+ .adecore-rendered-doc ol {
23
+ margin: 4px 0;
24
+ padding-inline-start: 20px;
25
+ }
26
+ .adecore-rendered-doc ul {
27
+ list-style: disc;
28
+ }
29
+ .adecore-rendered-doc ol {
30
+ list-style: decimal;
31
+ }
32
+ .adecore-rendered-doc blockquote {
33
+ margin: 4px 0;
34
+ padding-inline-start: 8px;
35
+ border-inline-start: 2px solid var(--border);
36
+ }
37
+ .adecore-rendered-doc :not(pre) > code {
38
+ font-family: var(--font-mono);
39
+ }
40
+ .adecore-rendered-doc h1,
41
+ .adecore-rendered-doc h2,
42
+ .adecore-rendered-doc h3,
43
+ .adecore-rendered-doc h4,
44
+ .adecore-rendered-doc h5,
45
+ .adecore-rendered-doc h6 {
46
+ margin: 4px 0;
47
+ font-size: inherit;
48
+ font-weight: 600;
49
+ }
20
50
  .adecore-editor-find {
21
51
  display: flex;
22
52
  flex-direction: column;
@@ -41,3 +71,52 @@
41
71
  .adecore-editor-find output {
42
72
  font-variant-numeric: tabular-nums;
43
73
  }
74
+
75
+ .adecore-editor-diff-gap {
76
+ display: flex;
77
+ align-items: center;
78
+ min-height: 32px;
79
+ padding: 4px 8px;
80
+ font-family: var(--font-sans);
81
+ color: var(--text-muted);
82
+ background: var(--surface-raised);
83
+ }
84
+ .adecore-editor-diff-no-newline {
85
+ padding-inline: 8px;
86
+ color: var(--text-muted);
87
+ font-family: var(--font-sans);
88
+ font-size: var(--text-sm);
89
+ }
90
+
91
+ .adecore-editor-diff .se-viewport {
92
+ overscroll-behavior-y: auto;
93
+ }
94
+
95
+ .adecore-editor-diff[data-scroll='false'] .se-viewport {
96
+ overflow-y: hidden;
97
+ }
98
+
99
+ .adecore-editor-diff-split {
100
+ display: grid;
101
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
102
+ min-height: 0;
103
+ }
104
+ .adecore-editor-diff-side {
105
+ position: relative;
106
+ min-width: 0;
107
+ min-height: 0;
108
+ }
109
+ .adecore-editor-diff-side + .adecore-editor-diff-side {
110
+ border-inline-start: 1px solid var(--border);
111
+ }
112
+ .adecore-editor-diff-surface {
113
+ position: absolute;
114
+ inset: 0;
115
+ }
116
+ .adecore-editor-diff-split .se-viewport {
117
+ scrollbar-gutter: stable;
118
+ }
119
+ .adecore-editor-diff-filler {
120
+ background: repeating-linear-gradient(135deg, transparent 0 6px, var(--editor-hatch) 6px 7px);
121
+ pointer-events: none;
122
+ }
@@ -0,0 +1,14 @@
1
+ import type { EditorLanguage } from './editor-language.ts';
2
+ export declare class FormatOnTypeFeature {
3
+ private readonly language;
4
+ private enabled;
5
+ private revision;
6
+ private controller;
7
+ constructor(language: EditorLanguage);
8
+ get isEnabled(): boolean;
9
+ get supported(): boolean;
10
+ configure(enabled: boolean): void;
11
+ triggerCharacters(): readonly string[];
12
+ private typed;
13
+ private ask;
14
+ }
@@ -0,0 +1,96 @@
1
+ import { comparePositions } from './diagnostics-model.js';
2
+ const METHOD = 'textDocument/onTypeFormatting';
3
+ /* A line break with the indentation the editor put after it, which is how Enter reaches the server. */
4
+ const LINE_BREAK = /^\r?\n[ \t]*(\r?\n[ \t]*)?$/;
5
+ /* A closer with the whitespace the editor replaced in front of it when it moved the closer back to its opener's indentation. */
6
+ const DEDENTED = /^[ \t]+(\S)$/u;
7
+ /* The overlapping edits of a server answer have no single meaning, so an answer that has them is not applied. */
8
+ function overlaps(edits) {
9
+ const ordered = [...edits].sort((left, right) => comparePositions(left.range.start, right.range.start));
10
+ return ordered.some((edit, index) => index > 0 && comparePositions(ordered[index - 1].range.end, edit.range.start) > 0);
11
+ }
12
+ /*
13
+ * Formatting while typing: after a person types one of the characters the server named in
14
+ * `firstTriggerCharacter` and `moreTriggerCharacter`, the server is asked what to change around the caret, and its
15
+ * edits are applied.
16
+ *
17
+ * Only typing counts: one change that is the trigger character alone, the closer the editor moved back to its
18
+ * opener's indentation, or a line break with its indentation for `\n`, which the editor reports as typed though
19
+ * Enter runs as a command. A character the editor types over an existing closer changes no text and asks nothing. A paste, undo, a completion or an external change does not ask, and neither does a
20
+ * second caret, a read-only editor or a snippet session, whose tab stops an edit could move. An answer is applied
21
+ * only while the text is exactly what it was asked about, and the caret where it was.
22
+ *
23
+ * The edits join the undo step of the typed character, so one undo takes both back. On by default where the server offers it; `configure(false)`
24
+ * turns it off for a host that has a setting for it.
25
+ */
26
+ export class FormatOnTypeFeature {
27
+ language;
28
+ enabled = true;
29
+ /* Raised by every change of the text, so an answer for an older text is told from the one for the text that is. */
30
+ revision = 0;
31
+ controller = new AbortController();
32
+ constructor(language) {
33
+ this.language = language;
34
+ const off = language.editor.onTextChange((change) => this.typed(change));
35
+ language.onDispose(() => {
36
+ off();
37
+ this.controller.abort();
38
+ });
39
+ }
40
+ get isEnabled() {
41
+ return this.enabled;
42
+ }
43
+ /* Whether the server of this document formats on type and the service can ask it. */
44
+ get supported() {
45
+ const { project, uri } = this.language;
46
+ return project.service.onTypeFormatting !== undefined && project.service.supports(METHOD, uri);
47
+ }
48
+ configure(enabled) {
49
+ this.enabled = enabled;
50
+ if (!enabled) {
51
+ this.controller.abort();
52
+ }
53
+ }
54
+ /* The characters that ask the server, the first one and the more. */
55
+ triggerCharacters() {
56
+ const options = this.language.project.service.providerOptions(METHOD, this.language.uri);
57
+ return options === undefined
58
+ ? []
59
+ : [...(options.firstTriggerCharacter === undefined ? [] : [options.firstTriggerCharacter]), ...(options.moreTriggerCharacter ?? [])];
60
+ }
61
+ typed(change) {
62
+ const revision = ++this.revision;
63
+ this.controller.abort();
64
+ if (!this.enabled || (change.source !== 'input' && change.typed !== true) || change.changes.length !== 1 || !this.supported) {
65
+ return;
66
+ }
67
+ const { editor, snippets } = this.language;
68
+ const { text } = change.changes[0];
69
+ const typed = LINE_BREAK.test(text) ? '\n' : Array.from(text).length === 1 ? text : (DEDENTED.exec(text)?.[1] ?? null);
70
+ if (typed === null || !this.triggerCharacters().includes(typed)) {
71
+ return;
72
+ }
73
+ if (snippets.isActive || editor.isReadOnly?.() === true || editor.getSelections().length !== 1) {
74
+ return;
75
+ }
76
+ this.controller = new AbortController();
77
+ void this.ask(revision, typed, editor.getCaret(), this.controller.signal);
78
+ }
79
+ async ask(revision, typed, caret, signal) {
80
+ const { editor, project, uri, document } = this.language;
81
+ try {
82
+ // The change of the typed character reaches the server before this question does.
83
+ await document.ready;
84
+ const edits = await project.service.onTypeFormatting(uri, caret, typed, { ...editor.getIndentation() }, { signal });
85
+ const here = editor.getCaret();
86
+ const stale = revision !== this.revision || this.language.isDisposed || comparePositions(here, caret) !== 0;
87
+ if (stale || edits === null || edits.length === 0 || overlaps(edits)) {
88
+ return;
89
+ }
90
+ editor.applyEdits(edits.map((edit) => ({ range: edit.range, text: edit.newText })), { mergeUndo: true });
91
+ }
92
+ catch {
93
+ // A refusal or a failing server is not worth a notice per keystroke; the next trigger character asks again.
94
+ }
95
+ }
96
+ }
@@ -1,3 +1,5 @@
1
+ import type { WorkerRequestPort } from '@adecore/editor/worker-client';
2
+ import type { EditorPosition, EditorRange } from '@adecore/editor';
1
3
  import type { i18n } from 'i18next';
2
4
  import type { Keymap } from '@adecore/editor/keymap';
3
5
  import type { ProjectFiles } from './workspace-edit.ts';
@@ -31,15 +33,32 @@ export interface RenameSuggestionsRequest {
31
33
  context: string;
32
34
  uses: readonly string[];
33
35
  }
36
+ export interface SnippetVariableContext {
37
+ readonly uri: string;
38
+ readonly languageId: string;
39
+ readonly position: EditorPosition;
40
+ readonly selection: EditorRange;
41
+ readonly selectedText: string;
42
+ readonly currentLine: string;
43
+ readonly currentWord: string;
44
+ readonly cursorIndex: number;
45
+ readonly cursorCount: number;
46
+ readonly folder?: string;
47
+ readonly path?: string;
48
+ }
34
49
  export interface LanguageHost {
50
+ readonly snippetTransformWorker?: () => WorkerRequestPort;
35
51
  readonly i18n?: i18n;
36
52
  readonly folder?: string;
37
53
  readonly files?: ProjectFiles;
38
54
  readonly apple?: boolean;
39
55
  readonly keymap?: Keymap;
56
+ readonly panelBodyHeight?: number;
57
+ onPanelResize?(height: number): void;
40
58
  openPlace?(place: Place): void;
41
59
  pathOfUri?(uri: string): string | null;
42
60
  serverNames?(uri: string): readonly string[];
43
61
  notify?(notification: EditorNotification): void;
62
+ resolveSnippetVariable?(name: string, context: SnippetVariableContext): string | undefined;
44
63
  suggestNames?(request: RenameSuggestionsRequest, signal: AbortSignal): Promise<readonly string[]>;
45
64
  }
package/dist/hover.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { EditorPosition, EditorRange } from '@adecore/editor';
2
2
  import type { EditorLanguage } from './editor-language.ts';
3
+ import { type HoverText } from './hover-content.ts';
3
4
  import { type Timers } from './timers.ts';
5
+ export declare const SHOW_DELAY_MS = 300;
4
6
  export declare class HoverFeature {
5
7
  private readonly language;
6
8
  private readonly timers;
@@ -19,6 +21,8 @@ export declare class HoverFeature {
19
21
  showProblemsAt(position: EditorPosition): boolean;
20
22
  keep(): void;
21
23
  showRange(range: EditorRange): void;
24
+ showText(position: EditorPosition, text: HoverText): void;
25
+ release(): void;
22
26
  hide(): void;
23
27
  private moved;
24
28
  private scheduleHide;
package/dist/hover.js CHANGED
@@ -4,7 +4,7 @@ import { lineTextOf } from './line-text.js';
4
4
  import { wordRangeAt } from './rename-model.js';
5
5
  import { isShortcut } from './shortcut-keys.js';
6
6
  import { realTimers } from './timers.js';
7
- const SHOW_DELAY_MS = 300;
7
+ export const SHOW_DELAY_MS = 300;
8
8
  const HIDE_DELAY_MS = 250;
9
9
  /* How long a card has to stay up before the references of its symbol are counted, which can be a request over the whole project. */
10
10
  const COUNT_DELAY_MS = 500;
@@ -61,7 +61,7 @@ export class HoverFeature {
61
61
  this.quickInfo();
62
62
  return true;
63
63
  }
64
- if (event.key === 'Escape' && this.language.popups.getState().hover !== null) {
64
+ if (event.key === 'Escape' && this.language.popups.getState().hover !== null && this.language.popups.getState().callHierarchy == null) {
65
65
  this.hide();
66
66
  return true;
67
67
  }
@@ -114,6 +114,15 @@ export class HoverFeature {
114
114
  this.keep();
115
115
  this.present(range.start, [], null, range);
116
116
  }
117
+ /* A card of text another feature brings, such as the tooltip of an inlay hint, which goes the way any hover card does. */
118
+ showText(position, text) {
119
+ this.hide();
120
+ this.present(position, [], { text, definition: null, word: '', references: null, plain: true }, null);
121
+ }
122
+ /* The pointer left what a card was opened for: it closes unless the pointer reaches the card in time. */
123
+ release() {
124
+ this.scheduleHide();
125
+ }
117
126
  hide() {
118
127
  this.pinned = false;
119
128
  this.held = false;
@@ -199,6 +208,10 @@ export class HoverFeature {
199
208
  }
200
209
  if (problems.length === 0 && info === null) {
201
210
  this.hide();
211
+ if (pinned && (await this.language.inlayHints.showTooltipAt(position))) {
212
+ this.pinned = true;
213
+ return;
214
+ }
202
215
  if (pinned) {
203
216
  this.language.project.host.notify?.({ id: TOAST_ID, kind: 'error', title: this.language.project.i18n.t('editor:language.hover.none') });
204
217
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- export { EditorLanguage } from './editor-language.ts';
2
- export { ProjectLanguage } from './project-language.ts';
1
+ export { EditorLanguage, type EditorLanguageOptions } from './editor-language.ts';
2
+ export { DEFAULT_RANGE_LINES, DEFAULT_RANGE_CHARACTERS, type SemanticTokensOptions } from './semantic-tokens.ts';
3
+ export { ProjectLanguage, type FileOperationTarget } from './project-language.ts';
3
4
  export type { LanguageDocumentHandle } from './project-language.ts';
4
- export type { LanguageHost, DiskText, GitBlameCommit, GitBlameResult, EditorNotification, RenameSuggestionsRequest } from './host-types.ts';
5
+ export type { SnippetVariableContext, LanguageHost, DiskText, GitBlameCommit, GitBlameResult, EditorNotification, RenameSuggestionsRequest } from './host-types.ts';
5
6
  export { EditorView } from './EditorView.tsx';
6
7
  export { createHolder } from './holder.ts';
7
8
  export type { EditorViewProps } from './EditorView.tsx';
@@ -13,8 +14,14 @@ export { SignatureCard } from './SignatureCard.tsx';
13
14
  export { RenameCard } from './RenameCard.tsx';
14
15
  export { PickPopup } from './PickPopup.tsx';
15
16
  export { PeekPanel } from './PeekPanel.tsx';
17
+ export { CallHierarchyPanel } from './CallHierarchyPanel.tsx';
16
18
  export { SymbolPicker } from './SymbolPicker.tsx';
17
19
  export { CodeAuthorsCard } from './CodeAuthorsCard.tsx';
20
+ export { RenderedDocs } from './RenderedDocs.tsx';
21
+ export { RenderedDocsFeature } from './rendered-docs.ts';
22
+ export type { RenderedDocEntry, RenderedDocsSettings } from './rendered-docs.ts';
23
+ export { parseDocComment, sectionsOf, htmlToMarkdown, DOC_LINK_PREFIX } from './doc-comment-model.ts';
24
+ export type { DocTagEntry, DocTagSection, ParsedDocComment } from './doc-comment-model.ts';
18
25
  export { EditorContextMenu } from './EditorContextMenu.tsx';
19
26
  export { EditorRenderingProvider } from './rendering.tsx';
20
27
  export type { EditorRendering } from './rendering-context.ts';
@@ -23,13 +30,13 @@ export { ChangeReview } from './ChangeReview.tsx';
23
30
  export type { ChangeReviewProps } from './ChangeReview.tsx';
24
31
  export { ProjectProblems, countsOf, compareRows } from './project-problems.ts';
25
32
  export type { ProblemFile, ProblemRow } from './project-problems.ts';
26
- export { applyWorkspaceEdit } from './workspace-edit.ts';
33
+ export { applyWorkspaceEdit, supportedResourceOperations } from './workspace-edit.ts';
27
34
  export type { ProjectFiles, StagedFile, WorkspaceEditHost } from './workspace-edit.ts';
28
35
  export { useProblemCounts } from './use-problem-counts.ts';
29
36
  export type { ProblemCounts } from './diagnostics.ts';
30
37
  export type { BlameSource, CodeVisionSettings } from './code-vision.ts';
31
38
  export type { Problem } from './diagnostics-model.ts';
32
- export type { PopupState, PopupStore, HoverInfo, HoverView, CompletionView, CompletionDocs, CompletionRow, SignatureView, RenameView, RenameFileView, PeekView, PickView, PickGroup, PickRow, PickPreview, SymbolsView, MenuView, AuthorsView } from './popups.ts';
39
+ export type { PopupState, PopupStore, HoverInfo, HoverView, CompletionView, CompletionDocs, CompletionRow, SignatureView, RenameView, RenameFileView, PeekView, CallHierarchyView, PickView, PickGroup, PickRow, PickPreview, SymbolsView, MenuView, AuthorsView } from './popups.ts';
33
40
  export { RowHost, LineActionHost } from './row-host.ts';
34
41
  export type { HostedRow, HostedAction } from './row-host.ts';
35
42
  export { HighlightLayers, highlightLayers } from './highlight-layers.ts';
@@ -42,3 +49,10 @@ export { AttributionCard } from './AttributionCard.tsx';
42
49
  export type { AttributionCardProps } from './AttributionCard.tsx';
43
50
  export { ReviewGroup, joinReviewGroup } from './review-group.ts';
44
51
  export type { ReviewMember } from './review-group.ts';
52
+ export { DiffView } from './DiffView.tsx';
53
+ export type { DiffViewProps } from './DiffView.tsx';
54
+ export type { DiffLimits } from './diff-expansion.ts';
55
+ export { diffSyntaxDocument } from './diff-syntax.ts';
56
+ export type { DiffSourceSide, DiffSourceTokens, DiffSyntaxSources } from './diff-syntax.ts';
57
+ export { decoratePatch, usePatchDecorations } from './patch-decorations.ts';
58
+ export type { PatchDecoration, PatchDecorationOptions, PatchLineLabels, PatchTimer } from './patch-decorations.ts';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { EditorLanguage } from './editor-language.js';
2
+ export { DEFAULT_RANGE_LINES, DEFAULT_RANGE_CHARACTERS } from './semantic-tokens.js';
2
3
  export { ProjectLanguage } from './project-language.js';
3
4
  export { EditorView } from './EditorView.js';
4
5
  export { createHolder } from './holder.js';
@@ -10,14 +11,18 @@ export { SignatureCard } from './SignatureCard.js';
10
11
  export { RenameCard } from './RenameCard.js';
11
12
  export { PickPopup } from './PickPopup.js';
12
13
  export { PeekPanel } from './PeekPanel.js';
14
+ export { CallHierarchyPanel } from './CallHierarchyPanel.js';
13
15
  export { SymbolPicker } from './SymbolPicker.js';
14
16
  export { CodeAuthorsCard } from './CodeAuthorsCard.js';
17
+ export { RenderedDocs } from './RenderedDocs.js';
18
+ export { RenderedDocsFeature } from './rendered-docs.js';
19
+ export { parseDocComment, sectionsOf, htmlToMarkdown, DOC_LINK_PREFIX } from './doc-comment-model.js';
15
20
  export { EditorContextMenu } from './EditorContextMenu.js';
16
21
  export { EditorRenderingProvider } from './rendering.js';
17
22
  export { FindReplace } from './FindReplace.js';
18
23
  export { ChangeReview } from './ChangeReview.js';
19
24
  export { ProjectProblems, countsOf, compareRows } from './project-problems.js';
20
- export { applyWorkspaceEdit } from './workspace-edit.js';
25
+ export { applyWorkspaceEdit, supportedResourceOperations } from './workspace-edit.js';
21
26
  export { useProblemCounts } from './use-problem-counts.js';
22
27
  export { RowHost, LineActionHost } from './row-host.js';
23
28
  export { HighlightLayers, highlightLayers } from './highlight-layers.js';
@@ -26,3 +31,6 @@ export { openingPlace, viewStates, followViewStates, viewStateKey, forgetMovesFr
26
31
  export { lspLanguageIdOf, shikiLanguageOf, shikiLanguageOfPath } from './language-ids.js';
27
32
  export { AttributionCard } from './AttributionCard.js';
28
33
  export { ReviewGroup, joinReviewGroup } from './review-group.js';
34
+ export { DiffView } from './DiffView.js';
35
+ export { diffSyntaxDocument } from './diff-syntax.js';
36
+ export { decoratePatch, usePatchDecorations } from './patch-decorations.js';
@@ -1,13 +1,58 @@
1
- import type { EditorInlayHint, EditorPosition, EditorRange } from '@adecore/editor';
2
- import type { InlayHint } from '@adecore/lsp';
1
+ import type { Editor, EditorInlayClick, EditorInlayHint, EditorPosition, EditorRange } from '@adecore/editor';
2
+ import type { Command, InlayHint, InlayHintLabelPart, Location, MarkupContent, TextEdit } from '@adecore/lsp';
3
3
  import type { EditorLanguage } from './editor-language.ts';
4
+ import { type HoverText } from './hover-content.ts';
4
5
  import { type Timers } from './timers.ts';
5
6
  export declare function hintLabelOf(hint: InlayHint): string;
7
+ export declare function drawableHints(hints: readonly InlayHint[]): InlayHint[];
8
+ export declare function editorHintOf(hint: InlayHint, id: string): EditorInlayHint;
6
9
  export declare function editorHintsOf(hints: readonly InlayHint[]): EditorInlayHint[];
7
10
  export declare function withMargin(visible: EditorRange, endOfDocument: EditorPosition, endOfLine: (line: number) => EditorPosition): EditorRange;
8
11
  export declare function covers(asked: EditorRange, visible: EditorRange): boolean;
12
+ export declare function tooltipTextOf(tooltip: string | MarkupContent | undefined): HoverText | null;
13
+ export declare function partOf(hint: InlayHint, index: number | null): InlayHintLabelPart | null;
14
+ export declare function tooltipOf(hint: InlayHint, index: number | null): HoverText | null;
15
+ export declare function lacksInfo(hint: InlayHint, index: number | null): boolean;
16
+ export declare function editsFit(editor: Editor, edits: readonly TextEdit[]): boolean;
17
+ type Action = {
18
+ readonly kind: 'go';
19
+ readonly location: Location;
20
+ } | {
21
+ readonly kind: 'run';
22
+ readonly command: Command;
23
+ } | {
24
+ readonly kind: 'insert';
25
+ readonly edits: TextEdit[];
26
+ };
27
+ export declare function actionOf(hint: InlayHint, click: Pick<EditorInlayClick, 'part' | 'mod' | 'clicks'>): Action | null;
9
28
  export declare class InlayHintsFeature {
29
+ private readonly language;
30
+ private readonly timers;
10
31
  private readonly refresher;
11
32
  private asked;
33
+ private readonly entries;
34
+ private shown;
35
+ private generation;
36
+ private epoch;
37
+ private target;
38
+ private modHeld;
39
+ private showTimer;
40
+ private commandTimer;
41
+ private pressCount;
42
+ private request;
12
43
  constructor(language: EditorLanguage, timers?: Timers);
44
+ setModHeld(held: boolean): void;
45
+ showTooltipAt(position: EditorPosition): Promise<boolean>;
46
+ private install;
47
+ private hovered;
48
+ private cancelHover;
49
+ private cardOpen;
50
+ private showTooltip;
51
+ private resolve;
52
+ private resolvable;
53
+ private updateLink;
54
+ private pressed;
55
+ private press;
56
+ private perform;
13
57
  }
58
+ export {};