@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.
- package/README.md +2 -2
- package/dist/AnchoredPopup.d.ts +2 -1
- package/dist/CompletionPopup.js +0 -2
- package/dist/DiffView.d.ts +1 -28
- package/dist/EditorView.js +0 -1
- package/dist/HoverSections.d.ts +1 -8
- package/dist/HoverSections.js +2 -2
- package/dist/LanguagePopups.js +30 -14
- package/dist/PanelResizeHandle.js +0 -1
- package/dist/PeekPanel.js +0 -1
- package/dist/PickPopup.js +0 -1
- package/dist/RenderedDocs.js +0 -2
- package/dist/SplitDiffView.d.ts +1 -1
- package/dist/SymbolPicker.js +0 -1
- package/dist/call-hierarchy-model.js +0 -4
- package/dist/call-hierarchy.d.ts +9 -2
- package/dist/call-hierarchy.js +51 -67
- package/dist/clipboard-history.d.ts +3 -0
- package/dist/clipboard-history.js +0 -1
- package/dist/code-actions-model.js +1 -1
- package/dist/code-actions.d.ts +14 -2
- package/dist/code-actions.js +14 -9
- package/dist/code-authors.js +4 -12
- package/dist/code-vision-model.d.ts +0 -1
- package/dist/code-vision-model.js +1 -2
- package/dist/code-vision.d.ts +11 -3
- package/dist/code-vision.js +13 -18
- package/dist/completion-call.d.ts +1 -1
- package/dist/completion-call.js +2 -1
- package/dist/completion-model.d.ts +5 -4
- package/dist/completion-model.js +4 -4
- package/dist/completion.d.ts +13 -4
- package/dist/completion.js +19 -18
- package/dist/context-menu-rows.d.ts +2 -1
- package/dist/context-menu.d.ts +9 -3
- package/dist/context-menu.js +17 -19
- package/dist/definition-link.d.ts +8 -2
- package/dist/definition-link.js +4 -2
- package/dist/diagnostics-model.d.ts +6 -8
- package/dist/diagnostics-model.js +1 -54
- package/dist/diagnostics.d.ts +9 -7
- package/dist/diagnostics.js +6 -4
- package/dist/diff-view-props.d.ts +28 -0
- package/dist/diff-view-props.js +1 -0
- package/dist/doc-comment-model.js +0 -2
- package/dist/document-colors.d.ts +9 -4
- package/dist/document-colors.js +7 -4
- package/dist/document-links.d.ts +2 -3
- package/dist/document-links.js +2 -3
- package/dist/document-query.d.ts +2 -2
- package/dist/edit-locations.js +4 -22
- package/dist/editor-language.d.ts +12 -7
- package/dist/editor-language.js +54 -45
- package/dist/emmet.d.ts +3 -2
- package/dist/folding.d.ts +2 -4
- package/dist/folding.js +1 -2
- package/dist/format-on-type.d.ts +8 -2
- package/dist/format-on-type.js +8 -6
- package/dist/highlights.d.ts +2 -6
- package/dist/highlights.js +3 -3
- package/dist/history.d.ts +8 -2
- package/dist/history.js +4 -2
- package/dist/host-types.d.ts +39 -22
- package/dist/hover-content.js +0 -1
- package/dist/hover.d.ts +13 -2
- package/dist/hover.js +25 -28
- package/dist/index.d.ts +19 -9
- package/dist/index.js +5 -2
- package/dist/inlay-hints.d.ts +12 -21
- package/dist/inlay-hints.js +16 -15
- package/dist/inline-completion.d.ts +30 -10
- package/dist/inline-completion.js +346 -102
- package/dist/key-priority.d.ts +1 -1
- package/dist/key-priority.js +2 -2
- package/dist/language-context.d.ts +30 -0
- package/dist/language-context.js +1 -0
- package/dist/language-ids.d.ts +0 -1
- package/dist/language-ids.js +0 -32
- package/dist/line-text.js +0 -1
- package/dist/linked-editing.d.ts +2 -4
- package/dist/linked-editing.js +1 -3
- package/dist/live-templates.d.ts +14 -2
- package/dist/live-templates.js +15 -10
- package/dist/locales/en.d.ts +357 -0
- package/dist/locales/en.js +356 -0
- package/dist/locales/nl.d.ts +357 -0
- package/dist/locales/nl.js +356 -0
- package/dist/markup-context.d.ts +7 -6
- package/dist/markup-context.js +0 -1
- package/dist/markup.d.ts +8 -2
- package/dist/markup.js +19 -20
- package/dist/models.d.ts +2 -1
- package/dist/models.js +2 -1
- package/dist/navigation-history.d.ts +7 -0
- package/dist/navigation.d.ts +11 -8
- package/dist/navigation.js +9 -20
- package/dist/panel-size.d.ts +4 -0
- package/dist/paste-history.d.ts +8 -2
- package/dist/paste-history.js +4 -2
- package/dist/patch-layout.d.ts +0 -4
- package/dist/patch-layout.js +1 -1
- package/dist/peek-model.js +0 -1
- package/dist/peek.d.ts +8 -2
- package/dist/peek.js +31 -42
- package/dist/pick.d.ts +4 -2
- package/dist/pick.js +38 -15
- package/dist/popups.d.ts +25 -20
- package/dist/popups.js +31 -15
- package/dist/positions.d.ts +7 -0
- package/dist/positions.js +54 -0
- package/dist/postfix.d.ts +11 -2
- package/dist/postfix.js +10 -6
- package/dist/project-language.d.ts +11 -3
- package/dist/project-language.js +40 -9
- package/dist/project-problems.d.ts +7 -1
- package/dist/project-problems.js +2 -1
- package/dist/rename-model.js +1 -1
- package/dist/rename.d.ts +2 -2
- package/dist/rename.js +17 -22
- package/dist/rendered-docs.d.ts +8 -2
- package/dist/rendered-docs.js +5 -4
- package/dist/selection-ranges.d.ts +2 -2
- package/dist/semantic-tokens.d.ts +2 -4
- package/dist/semantic-tokens.js +2 -2
- package/dist/shortcut-keys.d.ts +2 -1
- package/dist/signature.d.ts +2 -2
- package/dist/signature.js +9 -15
- package/dist/snippet-field-transforms.js +1 -1
- package/dist/snippet-insert.d.ts +4 -2
- package/dist/snippet-insert.js +9 -15
- package/dist/snippet-session.d.ts +9 -4
- package/dist/snippet-session.js +14 -14
- package/dist/snippet-transform-format.d.ts +2 -1
- package/dist/snippet-transform-queue.d.ts +2 -4
- package/dist/snippet-transform-queue.js +5 -37
- package/dist/snippet.d.ts +2 -1
- package/dist/surround-constructs.d.ts +1 -1
- package/dist/surround.d.ts +13 -2
- package/dist/surround.js +15 -8
- package/dist/symbol-links.d.ts +0 -1
- package/dist/symbol-links.js +1 -1
- package/dist/symbol-picker-model.d.ts +0 -1
- package/dist/symbol-picker-model.js +1 -2
- package/dist/symbol-picker.d.ts +2 -2
- package/dist/symbol-picker.js +5 -10
- package/dist/symbols.d.ts +4 -3
- package/dist/template-builtins.d.ts +1 -1
- package/dist/template-builtins.js +0 -1
- package/dist/template-context.d.ts +3 -3
- package/dist/template-context.js +2 -11
- package/dist/template-types.d.ts +20 -0
- package/dist/template-types.js +1 -0
- package/dist/templates.d.ts +5 -20
- package/dist/templates.js +0 -1
- package/dist/testing.d.ts +6 -0
- package/dist/testing.js +42 -0
- package/dist/use-problem-counts.d.ts +1 -1
- package/dist/word-diff.d.ts +1 -1
- package/dist/word-diff.js +16 -25
- package/dist/workspace-edit.d.ts +1 -24
- package/dist/workspace-edit.js +0 -1
- package/package.json +10 -9
- package/src/AnchoredPopup.tsx +1 -1
- package/src/CompletionPopup.tsx +0 -2
- package/src/DiffView.tsx +6 -38
- package/src/EditorView.tsx +0 -1
- package/src/HoverSections.tsx +2 -2
- package/src/LanguagePopups.tsx +20 -14
- package/src/PanelResizeHandle.tsx +0 -1
- package/src/PeekPanel.tsx +0 -1
- package/src/PickPopup.tsx +0 -1
- package/src/RenderedDocs.tsx +0 -2
- package/src/SplitDiffView.tsx +1 -1
- package/src/SymbolPicker.tsx +0 -1
- package/src/call-hierarchy-model.ts +0 -7
- package/src/call-hierarchy.ts +32 -31
- package/src/clipboard-history.ts +5 -2
- package/src/code-actions-model.ts +1 -4
- package/src/code-actions.ts +26 -10
- package/src/code-authors.ts +4 -15
- package/src/code-vision-model.ts +1 -2
- package/src/code-vision.ts +23 -19
- package/src/completion-call.ts +2 -2
- package/src/completion-model.ts +12 -7
- package/src/completion.ts +31 -16
- package/src/context-menu-rows.ts +1 -1
- package/src/context-menu.ts +19 -10
- package/src/definition-link.ts +12 -4
- package/src/diagnostics-model.ts +8 -55
- package/src/diagnostics.ts +11 -20
- package/src/diff-view-props.ts +38 -0
- package/src/doc-comment-model.ts +0 -2
- package/src/document-colors.ts +14 -6
- package/src/document-links.ts +5 -6
- package/src/document-query.ts +3 -3
- package/src/edit-locations.ts +4 -19
- package/src/editor-language.ts +74 -39
- package/src/emmet.ts +2 -3
- package/src/folding.ts +4 -5
- package/src/format-on-type.ts +14 -7
- package/src/highlights.ts +6 -6
- package/src/history.ts +12 -4
- package/src/host-types.ts +52 -33
- package/src/hover-content.ts +0 -1
- package/src/hover.ts +29 -22
- package/src/index.ts +25 -14
- package/src/inlay-hints.ts +23 -17
- package/src/inline-completion.ts +340 -90
- package/src/key-priority.ts +2 -2
- package/src/language-context.ts +60 -0
- package/src/language-ids.ts +0 -34
- package/src/line-text.ts +0 -1
- package/src/linked-editing.ts +4 -6
- package/src/live-templates.ts +27 -13
- package/src/locales/en.ts +356 -0
- package/src/locales/nl.ts +356 -0
- package/src/markup-context.ts +6 -9
- package/src/markup.ts +19 -10
- package/src/models.ts +2 -1
- package/src/navigation-history.ts +11 -0
- package/src/navigation.ts +18 -20
- package/src/panel-size.ts +8 -0
- package/src/paste-history.ts +12 -4
- package/src/patch-layout.ts +1 -1
- package/src/peek-model.ts +0 -1
- package/src/peek.ts +22 -18
- package/src/pick.ts +30 -16
- package/src/popups.ts +61 -40
- package/src/positions.ts +54 -0
- package/src/postfix.ts +21 -8
- package/src/project-language.ts +63 -14
- package/src/project-problems.ts +10 -2
- package/src/proposal-model.ts +0 -1
- package/src/rename-model.ts +1 -1
- package/src/rename.ts +21 -24
- package/src/rendered-docs.ts +13 -6
- package/src/selection-ranges.ts +2 -2
- package/src/semantic-tokens.ts +5 -5
- package/src/shortcut-keys.ts +1 -1
- package/src/signature.ts +8 -8
- package/src/snippet-field-transforms.ts +1 -1
- package/src/snippet-insert.ts +21 -14
- package/src/snippet-session.ts +25 -24
- package/src/snippet-transform-format.ts +1 -1
- package/src/snippet-transform-queue.ts +5 -51
- package/src/snippet.ts +1 -1
- package/src/surround-constructs.ts +1 -1
- package/src/surround.ts +24 -12
- package/src/symbol-links.ts +1 -1
- package/src/symbol-picker-model.ts +1 -4
- package/src/symbol-picker.ts +6 -7
- package/src/symbols.ts +3 -4
- package/src/template-builtins.ts +1 -2
- package/src/template-context.ts +5 -14
- package/src/template-types.ts +43 -0
- package/src/templates.ts +9 -45
- package/src/testing.ts +52 -0
- package/src/use-problem-counts.ts +1 -1
- package/src/word-diff.ts +17 -28
- package/src/workspace-edit.ts +1 -34
- package/dist/locales/en.json +0 -356
- package/dist/locales/nl.json +0 -356
- package/src/locales/en.json +0 -356
- package/src/locales/nl.json +0 -356
package/dist/word-diff.js
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/* A word, a run of spaces or one other character, so a change inside a line is found by word and not by letter. */
|
|
3
|
-
const TOKEN = /\w+|\s+|[^\w\s]/g;
|
|
1
|
+
import { wordChanges } from '@adecore/merge';
|
|
4
2
|
/*
|
|
5
|
-
* The `[start, end)` ranges of each
|
|
6
|
-
*
|
|
3
|
+
* The `[start, end)` ranges of each of `lines` that differ from the line of `replaced` it stands for. Lines pair up
|
|
4
|
+
* only when there are as many of each; any other change has no pairing and marks no words.
|
|
7
5
|
*/
|
|
8
|
-
export function replacedWords(
|
|
9
|
-
return
|
|
6
|
+
export function replacedWords(lines, replaced) {
|
|
7
|
+
return lines.map((line, index) => lines.length === replaced.length ? changedRanges(line, replaced[index]) : []);
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
starts.push(offset);
|
|
21
|
-
const ranges = [];
|
|
22
|
-
for (const change of diffLines(before, after)) {
|
|
23
|
-
const text = removed.slice(starts[change.baseStart], starts[change.baseEnd]);
|
|
24
|
-
if (text.trim() !== '') {
|
|
25
|
-
const start = starts[change.baseStart] + (text.length - text.trimStart().length);
|
|
26
|
-
ranges.push([start, start + text.trim().length]);
|
|
9
|
+
/* The words of `line` that `replaced` does not have, without the space around them; a change of spacing marks nothing. */
|
|
10
|
+
function changedRanges(line, replaced) {
|
|
11
|
+
const words = wordChanges(replaced, line);
|
|
12
|
+
return (words?.new ?? []).flatMap(range => {
|
|
13
|
+
const text = line.slice(range.from, range.to);
|
|
14
|
+
const trimmed = text.trim();
|
|
15
|
+
if (trimmed === '') {
|
|
16
|
+
return [];
|
|
27
17
|
}
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
const start = range.from + (text.length - text.trimStart().length);
|
|
19
|
+
return [[start, start + trimmed.length]];
|
|
20
|
+
});
|
|
30
21
|
}
|
package/dist/workspace-edit.d.ts
CHANGED
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
import type { Editor } from '@adecore/editor';
|
|
2
2
|
import { type ApplyWorkspaceEditResult, type ResourceOperationKind, type RenameFile, type TextEdit, type WorkspaceEdit } from '@adecore/lsp';
|
|
3
|
-
import type {
|
|
4
|
-
export interface StagedFile {
|
|
5
|
-
readonly path: string;
|
|
6
|
-
readonly disk: DiskText;
|
|
7
|
-
readonly text: string;
|
|
8
|
-
}
|
|
9
|
-
export interface ProjectFiles {
|
|
10
|
-
read(path: string): Promise<DiskText | null>;
|
|
11
|
-
stage(files: readonly StagedFile[]): void;
|
|
12
|
-
save(files: readonly StagedFile[]): Promise<string | null>;
|
|
13
|
-
rename(from: string, to: string, options?: {
|
|
14
|
-
readonly overwrite: boolean;
|
|
15
|
-
}): Promise<string | null>;
|
|
16
|
-
create?(path: string, text: string, options?: {
|
|
17
|
-
readonly overwrite: boolean;
|
|
18
|
-
}): Promise<string | null>;
|
|
19
|
-
delete?(path: string, options: {
|
|
20
|
-
readonly recursive: boolean;
|
|
21
|
-
}): Promise<string | null>;
|
|
22
|
-
readonly supportsOverwrite?: boolean;
|
|
23
|
-
isUnsaved?(path: string): boolean;
|
|
24
|
-
exists?(path: string): Promise<boolean>;
|
|
25
|
-
isFolder?(path: string): Promise<boolean>;
|
|
26
|
-
}
|
|
3
|
+
import type { ProjectFiles } from './host-types.ts';
|
|
27
4
|
export interface WorkspaceEditHost {
|
|
28
5
|
editorOf(uri: string): Editor | undefined;
|
|
29
6
|
readonly files: ProjectFiles | null;
|
package/dist/workspace-edit.js
CHANGED
|
@@ -282,7 +282,6 @@ function driftOf(step, host, uri, editor, touched) {
|
|
|
282
282
|
}
|
|
283
283
|
return readOnlyAt(host, uri, editor) ? `${step.uri} is read only` : null;
|
|
284
284
|
}
|
|
285
|
-
/* Does one step; the reason it could not, or null. */
|
|
286
285
|
async function run(step, host, running) {
|
|
287
286
|
const files = host.files;
|
|
288
287
|
if (step.kind === 'create') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Language-enabled editors, feature coordination and React popups over injected language services.",
|
|
6
6
|
"license": "FSL-1.1-MIT",
|
|
@@ -46,9 +46,10 @@
|
|
|
46
46
|
"source": "./src/editor-react.css",
|
|
47
47
|
"default": "./dist/editor-react.css"
|
|
48
48
|
},
|
|
49
|
-
"./locales
|
|
50
|
-
"source": "./src/locales/*.
|
|
51
|
-
"
|
|
49
|
+
"./locales/*": {
|
|
50
|
+
"source": "./src/locales/*.ts",
|
|
51
|
+
"types": "./dist/locales/*.d.ts",
|
|
52
|
+
"default": "./dist/locales/*.js"
|
|
52
53
|
},
|
|
53
54
|
"./snippet-transform-worker": {
|
|
54
55
|
"source": "./src/snippet-transform-worker.ts",
|
|
@@ -62,9 +63,9 @@
|
|
|
62
63
|
"test": "bun test --conditions=source"
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|
|
65
|
-
"@adecore/editor": "0.
|
|
66
|
-
"@adecore/lsp": "0.
|
|
67
|
-
"@adecore/merge": "0.
|
|
66
|
+
"@adecore/editor": "0.63.0",
|
|
67
|
+
"@adecore/lsp": "0.63.0",
|
|
68
|
+
"@adecore/merge": "0.63.0",
|
|
68
69
|
"emmet": "^2.4.11",
|
|
69
70
|
"lucide-react": "^1.65.0",
|
|
70
71
|
"react-markdown": "^10.1.0",
|
|
@@ -73,14 +74,14 @@
|
|
|
73
74
|
"zustand": "^5.0.16"
|
|
74
75
|
},
|
|
75
76
|
"peerDependencies": {
|
|
76
|
-
"@adecore/ui": "^0.
|
|
77
|
+
"@adecore/ui": "^0.63.0",
|
|
77
78
|
"i18next": "^26.5.12",
|
|
78
79
|
"react": "^19.3.1",
|
|
79
80
|
"react-dom": "^19.3.1",
|
|
80
81
|
"react-i18next": "^17.1.9"
|
|
81
82
|
},
|
|
82
83
|
"devDependencies": {
|
|
83
|
-
"@adecore/ui": "0.
|
|
84
|
+
"@adecore/ui": "0.63.0",
|
|
84
85
|
"@types/bun": "^1.4.4",
|
|
85
86
|
"@types/react": "^19.3.0",
|
|
86
87
|
"@types/react-dom": "^19.3.0",
|
package/src/AnchoredPopup.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useLayoutEffect, useRef, type ReactNode } from 'react';
|
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { placePopup, type PlaceOptions } from './popup-placement.ts';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
interface AnchoredPopupProps {
|
|
8
8
|
/* The character the popup belongs to, in the page's pixels. */
|
|
9
9
|
rect: EditorRect;
|
|
10
10
|
className?: string;
|
package/src/CompletionPopup.tsx
CHANGED
|
@@ -12,7 +12,6 @@ import { placeBeside, placePopup } from './popup-placement.ts';
|
|
|
12
12
|
import type { CompletionView } from './popups.ts';
|
|
13
13
|
import { TONE_CLASSES } from './symbol-picker-model.ts';
|
|
14
14
|
|
|
15
|
-
/* The label with the characters that match what was typed set apart. */
|
|
16
15
|
function MarkedLabel({ label, matches }: { label: string; matches: readonly number[] }) {
|
|
17
16
|
if (matches.length === 0) {
|
|
18
17
|
return <>{label}</>;
|
|
@@ -54,7 +53,6 @@ const VISIBLE_ROWS = 8;
|
|
|
54
53
|
/* Rows drawn past the visible ones on each side, so a wheel turn lands on rows that exist. */
|
|
55
54
|
const OVERSCAN_ROWS = 6;
|
|
56
55
|
|
|
57
|
-
/* The padding the listbox has around its rows. */
|
|
58
56
|
const LIST_PADDING = 4;
|
|
59
57
|
|
|
60
58
|
/* What a row takes besides its name and namespace: padding, the kind badge and the gaps. */
|
package/src/DiffView.tsx
CHANGED
|
@@ -1,49 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EditorLineHighlight } from '@adecore/editor';
|
|
2
2
|
import { parseChord } from '@adecore/editor/keymap';
|
|
3
|
-
import { diffDisplay, diffSplit, sourceLineOf, type DiffDocument, type DiffDisplay
|
|
3
|
+
import { diffDisplay, diffSplit, sourceLineOf, type DiffDocument, type DiffDisplay } from '@adecore/merge';
|
|
4
4
|
import { useOverlayScrollbars } from '@adecore/ui';
|
|
5
|
-
import { useLayoutEffect, useRef, useState
|
|
5
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { DEFAULT_UNFOLD_LIMITS, expandDiff
|
|
7
|
+
import { DEFAULT_UNFOLD_LIMITS, expandDiff } from './diff-expansion.ts';
|
|
8
8
|
import { DiffOverlays, type MountedDiff } from './diff-overlays.tsx';
|
|
9
|
-
import { repaintOnTokens
|
|
9
|
+
import { repaintOnTokens } from './diff-syntax.ts';
|
|
10
|
+
import type { DiffViewProps } from './diff-view-props.ts';
|
|
10
11
|
import { wordMarks } from './diff-wordmarks.ts';
|
|
11
12
|
import { LineActionHost, RowHost } from './row-host.ts';
|
|
12
13
|
import { SplitDiffView } from './SplitDiffView.tsx';
|
|
13
14
|
|
|
14
|
-
export interface DiffViewProps {
|
|
15
|
-
engine: EditorEngine;
|
|
16
|
-
document: DiffDocument;
|
|
17
|
-
theme: EditorTheme;
|
|
18
|
-
tokens?: DiffSourceTokens;
|
|
19
|
-
wrap?: boolean;
|
|
20
|
-
layout?: 'unified' | 'split';
|
|
21
|
-
/* Above this many displayed unified rows, split uses fixed line heights. Defaults to 2000. */
|
|
22
|
-
splitWrapLimit?: number;
|
|
23
|
-
/* A fixed-height host supplies the height; otherwise the view grows with its rows. */
|
|
24
|
-
fill?: boolean;
|
|
25
|
-
/* Positive pixels; taller content scrolls inside the editor. Ignored with fill. */
|
|
26
|
-
maxHeight?: number;
|
|
27
|
-
/* Total visible source-text budgets after unfolding; changed rows are always retained. */
|
|
28
|
-
unfoldLimits?: DiffLimits;
|
|
29
|
-
label: string;
|
|
30
|
-
/* False draws no line numbers, for a fragment whose place in its file is not known. Defaults to true. */
|
|
31
|
-
numbered?: boolean;
|
|
32
|
-
className?: string;
|
|
33
|
-
ref?: Ref<HTMLDivElement>;
|
|
34
|
-
onMount?(editor: Editor, side?: 'old' | 'new'): void | (() => void);
|
|
35
|
-
/* Runs per editor like `onMount`, with a way to ask where its caret stands in the new file, for a host that opens the file there. */
|
|
36
|
-
onSource?(source: DiffSource): void | (() => void);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface DiffSource {
|
|
40
|
-
readonly editor: Editor;
|
|
41
|
-
/* `old` or `new` in split, absent in unified. */
|
|
42
|
-
readonly side?: 'old' | 'new';
|
|
43
|
-
/* The line and column of the new file under the caret, or null where the new file has none. */
|
|
44
|
-
at(): DiffSourceLine | null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
15
|
interface UnifiedViewProps extends DiffViewProps {
|
|
48
16
|
display: DiffDisplay;
|
|
49
17
|
unfold(id: number): void;
|
package/src/EditorView.tsx
CHANGED
|
@@ -70,7 +70,6 @@ function sameFields<T extends object>(left: T | undefined, right: T | undefined)
|
|
|
70
70
|
return [...keys].every((key) => left[key] === right[key]);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
/* Hands the editor the settings that changed by value, so a new options object with the same values costs nothing. */
|
|
74
73
|
function applyChangedOptions(editor: Editor, before: EditorOptions, after: EditorOptions): void {
|
|
75
74
|
if (before.theme !== after.theme) {
|
|
76
75
|
editor.setTheme(after.theme);
|
package/src/HoverSections.tsx
CHANGED
|
@@ -50,7 +50,7 @@ export function Signature({ code, language, onName }: { code: string; language:
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/* A docblock's tags as rows: the tag once beside each run of the same tag, so a list of parameters reads as one. */
|
|
53
|
-
|
|
53
|
+
function DocTags({ tags }: { tags: readonly DocTag[] }) {
|
|
54
54
|
return (
|
|
55
55
|
<div className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs/[18px] select-text">
|
|
56
56
|
{tags.map((tag, index) => (
|
|
@@ -66,7 +66,7 @@ export function DocTags({ tags }: { tags: readonly DocTag[] }) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/* 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. */
|
|
69
|
-
|
|
69
|
+
function SymbolSection({ section, onName }: { section: HoverSection; onName?: (name: string, declared: string | null) => void }) {
|
|
70
70
|
const declared = declaredNameOf(section.signatures[0]?.code ?? '');
|
|
71
71
|
const follow = onName === undefined ? undefined : (name: string): void => onName(name, declared);
|
|
72
72
|
|
package/src/LanguagePopups.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { useEffect, useReducer, type ReactNode } from 'react';
|
|
2
|
-
import { useStore } from 'zustand';
|
|
1
|
+
import { useEffect, useReducer, useSyncExternalStore, type ReactNode } from 'react';
|
|
3
2
|
import { AnchoredPopup } from './AnchoredPopup.tsx';
|
|
4
3
|
import { CallHierarchyPanel } from './CallHierarchyPanel.tsx';
|
|
5
4
|
import { CodeAuthorsCard } from './CodeAuthorsCard.tsx';
|
|
@@ -9,13 +8,20 @@ import { EditorContextMenu } from './EditorContextMenu.tsx';
|
|
|
9
8
|
import { HoverCard } from './HoverCard.tsx';
|
|
10
9
|
import { PeekPanel } from './PeekPanel.tsx';
|
|
11
10
|
import { PickPopup } from './PickPopup.tsx';
|
|
12
|
-
import type { HoverView } from './popups.ts';
|
|
11
|
+
import type { HoverView, PopupSlot } from './popups.ts';
|
|
13
12
|
import { RenameCard } from './RenameCard.tsx';
|
|
14
13
|
import { RenderedDocs } from './RenderedDocs.tsx';
|
|
15
14
|
import { SignatureCard } from './SignatureCard.tsx';
|
|
16
15
|
import { SymbolPicker } from './SymbolPicker.tsx';
|
|
17
16
|
import { WrapCard } from './WrapCard.tsx';
|
|
18
17
|
|
|
18
|
+
function useSlot<View>(slot: PopupSlot<View>): View | null {
|
|
19
|
+
return useSyncExternalStore(
|
|
20
|
+
(listener) => slot.subscribe(listener),
|
|
21
|
+
() => slot.get()
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
export interface LanguagePopupsProps<Language extends EditorLanguage = EditorLanguage> {
|
|
20
26
|
language: Language;
|
|
21
27
|
/* A group of the app's own rows in the context menu, set apart between the refactorings and the clipboard rows. */
|
|
@@ -35,17 +41,17 @@ export function LanguagePopups<Language extends EditorLanguage>({ language, cont
|
|
|
35
41
|
// The React Compiler would keep each card's place from the render before; it is read from the editor again on every scroll.
|
|
36
42
|
'use no memo';
|
|
37
43
|
const [, redraw] = useReducer((count: number) => count + 1, 0);
|
|
38
|
-
const hover =
|
|
39
|
-
const completion =
|
|
40
|
-
const signature =
|
|
41
|
-
const pick =
|
|
42
|
-
const rename =
|
|
43
|
-
const peek =
|
|
44
|
-
const callHierarchy =
|
|
45
|
-
const symbols =
|
|
46
|
-
const menu =
|
|
47
|
-
const authors =
|
|
48
|
-
const wrap =
|
|
44
|
+
const hover = useSlot(language.popups.slot('hover'));
|
|
45
|
+
const completion = useSlot(language.popups.slot('completion'));
|
|
46
|
+
const signature = useSlot(language.popups.slot('signature'));
|
|
47
|
+
const pick = useSlot(language.popups.slot('pick'));
|
|
48
|
+
const rename = useSlot(language.popups.slot('rename'));
|
|
49
|
+
const peek = useSlot(language.popups.slot('peek'));
|
|
50
|
+
const callHierarchy = useSlot(language.popups.slot('callHierarchy'));
|
|
51
|
+
const symbols = useSlot(language.popups.slot('symbols'));
|
|
52
|
+
const menu = useSlot(language.popups.slot('menu'));
|
|
53
|
+
const authors = useSlot(language.popups.slot('authors'));
|
|
54
|
+
const wrap = useSlot(language.popups.slot('wrap'));
|
|
49
55
|
|
|
50
56
|
useEffect(() => language.editor.onViewChange(redraw), [language]);
|
|
51
57
|
|
|
@@ -10,7 +10,6 @@ interface Props {
|
|
|
10
10
|
onCommit(height: number): void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
/* The bottom edge of a panel: a drag, or the arrow keys, change the height of its body. */
|
|
14
13
|
export function PanelResizeHandle({ container, height, onHeight, onCommit }: Props) {
|
|
15
14
|
const { t } = useTranslation('editor');
|
|
16
15
|
const drag = useRef<{ startY: number; startHeight: number; lastY: number } | null>(null);
|
package/src/PeekPanel.tsx
CHANGED
|
@@ -153,7 +153,6 @@ function useHighlightedPlaces(files: readonly PeekFile[]): ReadonlyMap<string, s
|
|
|
153
153
|
|
|
154
154
|
const NO_LINES: ReadonlyMap<string, string> = new Map();
|
|
155
155
|
|
|
156
|
-
/* 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. */
|
|
157
156
|
function PlaceText({ place, html }: { place: PeekPlace; html: string | undefined }) {
|
|
158
157
|
if (place.text === '') {
|
|
159
158
|
return <span className="min-w-0 truncate text-text-muted">{`:${place.line + 1}`}</span>;
|
package/src/PickPopup.tsx
CHANGED
|
@@ -11,7 +11,6 @@ import type { PickPreview, PickView } from './popups.ts';
|
|
|
11
11
|
const CARD =
|
|
12
12
|
'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)';
|
|
13
13
|
|
|
14
|
-
/* The label with the part a query matched marked, whatever the case. */
|
|
15
14
|
function MatchedLabel({ label, query }: { label: string; query: string | null }) {
|
|
16
15
|
const start = query === null || query === '' ? -1 : label.toLowerCase().indexOf(query.toLowerCase());
|
|
17
16
|
|
package/src/RenderedDocs.tsx
CHANGED
|
@@ -28,12 +28,10 @@ const KNOWN = new Set([
|
|
|
28
28
|
'author'
|
|
29
29
|
]);
|
|
30
30
|
|
|
31
|
-
/* Code in the editor's face, with a type fainter than a name. */
|
|
32
31
|
function Code({ children, faint = false }: { children: string; faint?: boolean }) {
|
|
33
32
|
return <code className={`font-mono text-code break-words ${faint ? 'text-text-faint' : 'text-text'}`}>{children}</code>;
|
|
34
33
|
}
|
|
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({ text, language, linkable, compact = false }: { text: string; language: string; linkable: boolean; compact?: boolean }) {
|
|
38
36
|
const plain = linkable ? text : text.replace(LINK, '$1');
|
|
39
37
|
|
package/src/SplitDiffView.tsx
CHANGED
|
@@ -6,8 +6,8 @@ import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { DiffOverlays, type MountedDiff } from './diff-overlays.tsx';
|
|
8
8
|
import { repaintOnTokens, type DiffSourceSide } from './diff-syntax.ts';
|
|
9
|
+
import type { DiffViewProps } from './diff-view-props.ts';
|
|
9
10
|
import { wordMarks } from './diff-wordmarks.ts';
|
|
10
|
-
import type { DiffViewProps } from './DiffView.tsx';
|
|
11
11
|
import { RowHost, LineActionHost } from './row-host.ts';
|
|
12
12
|
import { splitAlignment } from './split-alignment.ts';
|
|
13
13
|
import { SplitScroll } from './split-scroll.ts';
|
package/src/SymbolPicker.tsx
CHANGED
|
@@ -12,7 +12,6 @@ import { filterEntries, groupEntries, letterOfKind, modeOf, toneOfKind, type Sym
|
|
|
12
12
|
|
|
13
13
|
const SEARCH_DELAY_MS = 200;
|
|
14
14
|
|
|
15
|
-
/* The letter badge of a symbol kind, tinted by what the symbol is. */
|
|
16
15
|
export function SymbolBadge({ kind }: { kind: number }) {
|
|
17
16
|
return (
|
|
18
17
|
<span className={`grid size-4 shrink-0 place-items-center rounded-sm font-mono text-xs font-semibold ${TONE_CLASSES[toneOfKind(kind)]}`}>
|
|
@@ -3,7 +3,6 @@ import type { CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoin
|
|
|
3
3
|
/* Callers of a symbol or the symbols it calls; or the super and sub types of a type, which the same tree draws. */
|
|
4
4
|
export type CallDirection = 'incoming' | 'outgoing' | 'supertypes' | 'subtypes';
|
|
5
5
|
|
|
6
|
-
/* Whether a direction walks a type hierarchy and not the calls. */
|
|
7
6
|
export function isTypeDirection(direction: CallDirection): direction is 'supertypes' | 'subtypes' {
|
|
8
7
|
return direction === 'supertypes' || direction === 'subtypes';
|
|
9
8
|
}
|
|
@@ -13,7 +12,6 @@ export const CALL_LEVEL_LIMIT = 50;
|
|
|
13
12
|
|
|
14
13
|
export type CallLoad = 'idle' | 'loading' | 'loaded' | 'failed';
|
|
15
14
|
|
|
16
|
-
/* One symbol of the tree and what is known of its calls. */
|
|
17
15
|
export interface CallNode {
|
|
18
16
|
readonly id: string;
|
|
19
17
|
readonly parent: string | null;
|
|
@@ -28,11 +26,9 @@ export interface CallNode {
|
|
|
28
26
|
readonly error: string | null;
|
|
29
27
|
/* Every call the server returned, in the order they are listed. */
|
|
30
28
|
readonly children: readonly string[];
|
|
31
|
-
/* How many of the children are drawn. */
|
|
32
29
|
readonly shown: number;
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
/* A line of the tree as it is drawn. */
|
|
36
32
|
export type CallRow =
|
|
37
33
|
| {
|
|
38
34
|
readonly kind: 'node';
|
|
@@ -59,17 +55,14 @@ export type CallRow =
|
|
|
59
55
|
}
|
|
60
56
|
| { readonly kind: 'more'; readonly id: string; readonly level: number; readonly parent: string; readonly hidden: number };
|
|
61
57
|
|
|
62
|
-
/* The id of the status line under a node. */
|
|
63
58
|
export function statusIdOf(parent: string): string {
|
|
64
59
|
return `${parent}:status`;
|
|
65
60
|
}
|
|
66
61
|
|
|
67
|
-
/* The id of the line that shows more calls under a node. */
|
|
68
62
|
export function moreIdOf(parent: string): string {
|
|
69
63
|
return `${parent}:more`;
|
|
70
64
|
}
|
|
71
65
|
|
|
72
|
-
/* The tree's roots, each one a symbol the server prepared. */
|
|
73
66
|
export function rootsOf(items: readonly CallHierarchyItem[]): CallNode[] {
|
|
74
67
|
return items.map((item, index) => ({
|
|
75
68
|
id: `r${index}`,
|
package/src/call-hierarchy.ts
CHANGED
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
type CallNode,
|
|
16
16
|
type CallRow
|
|
17
17
|
} from './call-hierarchy-model.ts';
|
|
18
|
-
import type { EditorLanguage } from './editor-language.ts';
|
|
19
18
|
import { messageOf } from './error-message.ts';
|
|
20
19
|
import { KEY_PRIORITY } from './key-priority.ts';
|
|
20
|
+
import type { LanguageContext } from './language-context.ts';
|
|
21
21
|
import { snippetOf } from './peek-model.ts';
|
|
22
22
|
import { PEEK_HEIGHT } from './peek.ts';
|
|
23
23
|
import { isShortcut } from './shortcut-keys.ts';
|
|
@@ -32,6 +32,11 @@ export const CALL_HIERARCHY_HEIGHT = PEEK_HEIGHT + 2;
|
|
|
32
32
|
|
|
33
33
|
const OWNER = 'call-hierarchy';
|
|
34
34
|
|
|
35
|
+
/* The sibling features CallHierarchyFeature drives, which the editor language hands over. */
|
|
36
|
+
interface CallHierarchyPeers {
|
|
37
|
+
readonly peek: { close(): void };
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
/*
|
|
36
41
|
* The callers of the symbol at the caret, or the symbols it calls, as a tree between the lines of the file
|
|
37
42
|
* under the line the caret is on, with the code around the call that is active. A node asks the server for its
|
|
@@ -40,7 +45,8 @@ const OWNER = 'call-hierarchy';
|
|
|
40
45
|
* shortcut that opened the tree switches between callers and callees. Typing closes it.
|
|
41
46
|
*/
|
|
42
47
|
export class CallHierarchyFeature {
|
|
43
|
-
private readonly language:
|
|
48
|
+
private readonly language: LanguageContext;
|
|
49
|
+
private readonly peers: CallHierarchyPeers;
|
|
44
50
|
private readonly timers: Timers;
|
|
45
51
|
private nodes = new Map<string, CallNode>();
|
|
46
52
|
private roots: string[] = [];
|
|
@@ -55,8 +61,9 @@ export class CallHierarchyFeature {
|
|
|
55
61
|
private previewEpoch = 0;
|
|
56
62
|
private texts = new Map<string, string>();
|
|
57
63
|
|
|
58
|
-
constructor(language:
|
|
64
|
+
constructor(language: LanguageContext, peers: CallHierarchyPeers, timers: Timers = realTimers) {
|
|
59
65
|
this.language = language;
|
|
66
|
+
this.peers = peers;
|
|
60
67
|
this.timers = timers;
|
|
61
68
|
const { editor } = language;
|
|
62
69
|
|
|
@@ -89,7 +96,7 @@ export class CallHierarchyFeature {
|
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
get isOpen(): boolean {
|
|
92
|
-
return this.language.popups.
|
|
99
|
+
return this.language.popups.slot('callHierarchy').get() !== null;
|
|
93
100
|
}
|
|
94
101
|
|
|
95
102
|
/* Whether a server of this document answers the three requests the tree is made of. */
|
|
@@ -156,16 +163,16 @@ export class CallHierarchyFeature {
|
|
|
156
163
|
return;
|
|
157
164
|
}
|
|
158
165
|
|
|
159
|
-
this.
|
|
166
|
+
this.peers.peek.close();
|
|
160
167
|
this.prepared = items;
|
|
161
168
|
this.position = position;
|
|
162
169
|
this.direction = direction;
|
|
163
170
|
this.seed();
|
|
164
171
|
const active = this.roots[0]!;
|
|
165
172
|
|
|
166
|
-
this.language.popups
|
|
167
|
-
callHierarchy
|
|
168
|
-
|
|
173
|
+
this.language.popups
|
|
174
|
+
.slot('callHierarchy')
|
|
175
|
+
.set({ direction, container: null, name: items[0]!.name, rows: rowsOf(this.nodes, this.roots), active, site: 0, sites: 0, preview: null });
|
|
169
176
|
|
|
170
177
|
this.select(active);
|
|
171
178
|
|
|
@@ -185,11 +192,11 @@ export class CallHierarchyFeature {
|
|
|
185
192
|
close(): void {
|
|
186
193
|
this.reset();
|
|
187
194
|
|
|
188
|
-
if (this.language.popups.
|
|
195
|
+
if (this.language.popups.slot('callHierarchy').get() === null) {
|
|
189
196
|
return;
|
|
190
197
|
}
|
|
191
198
|
|
|
192
|
-
this.language.popups.
|
|
199
|
+
this.language.popups.slot('callHierarchy').set(null);
|
|
193
200
|
this.language.editor.setWidgets([], OWNER);
|
|
194
201
|
this.language.editor.setInputPopup(null);
|
|
195
202
|
this.language.editor.focus();
|
|
@@ -197,7 +204,7 @@ export class CallHierarchyFeature {
|
|
|
197
204
|
|
|
198
205
|
/* Starts the tree over from the same symbols for the other direction; a switch between calls and types prepares the symbol again. */
|
|
199
206
|
setDirection(direction: CallDirection): void {
|
|
200
|
-
const view = this.language.popups.
|
|
207
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
201
208
|
|
|
202
209
|
if (view === null || view.direction === direction) {
|
|
203
210
|
return;
|
|
@@ -214,9 +221,7 @@ export class CallHierarchyFeature {
|
|
|
214
221
|
this.seed();
|
|
215
222
|
const active = this.roots[0]!;
|
|
216
223
|
|
|
217
|
-
this.language.popups.
|
|
218
|
-
callHierarchy: { ...view, direction, rows: rowsOf(this.nodes, this.roots), active, site: 0, sites: 0, preview: null }
|
|
219
|
-
});
|
|
224
|
+
this.language.popups.slot('callHierarchy').set({ ...view, direction, rows: rowsOf(this.nodes, this.roots), active, site: 0, sites: 0, preview: null });
|
|
220
225
|
|
|
221
226
|
this.select(active);
|
|
222
227
|
|
|
@@ -235,7 +240,7 @@ export class CallHierarchyFeature {
|
|
|
235
240
|
|
|
236
241
|
if (node.expanded) {
|
|
237
242
|
this.patch(id, { expanded: false });
|
|
238
|
-
const view = this.language.popups.
|
|
243
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
239
244
|
|
|
240
245
|
if (view !== null && this.hasAncestor(view.active, id)) {
|
|
241
246
|
this.select(id);
|
|
@@ -251,14 +256,12 @@ export class CallHierarchyFeature {
|
|
|
251
256
|
}
|
|
252
257
|
}
|
|
253
258
|
|
|
254
|
-
/* Asks again for the calls of a node whose last try failed. */
|
|
255
259
|
retry(id: string): void {
|
|
256
260
|
if (this.nodes.get(id)?.load === 'failed') {
|
|
257
261
|
void this.load(id);
|
|
258
262
|
}
|
|
259
263
|
}
|
|
260
264
|
|
|
261
|
-
/* Brings the next stretch of calls of a level. */
|
|
262
265
|
showMore(parent: string): void {
|
|
263
266
|
const node = this.nodes.get(parent);
|
|
264
267
|
|
|
@@ -268,7 +271,7 @@ export class CallHierarchyFeature {
|
|
|
268
271
|
|
|
269
272
|
this.patch(parent, { shown: Math.min(node.children.length, node.shown + CALL_LEVEL_LIMIT) });
|
|
270
273
|
const first = node.children[node.shown];
|
|
271
|
-
const view = this.language.popups.
|
|
274
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
272
275
|
|
|
273
276
|
// The row that offered more is gone once everything shows, so the selection moves on to what it brought.
|
|
274
277
|
if (first !== undefined && view?.active === moreIdOf(parent)) {
|
|
@@ -276,9 +279,8 @@ export class CallHierarchyFeature {
|
|
|
276
279
|
}
|
|
277
280
|
}
|
|
278
281
|
|
|
279
|
-
/* Makes a row the active one and shows the code of its call. */
|
|
280
282
|
select(id: string, site = 0): void {
|
|
281
|
-
const view = this.language.popups.
|
|
283
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
282
284
|
const node = this.nodes.get(id);
|
|
283
285
|
|
|
284
286
|
if (view === null || !view.rows.some((row) => row.id === id)) {
|
|
@@ -287,16 +289,15 @@ export class CallHierarchyFeature {
|
|
|
287
289
|
|
|
288
290
|
const sites = node?.sites.length ?? view.sites;
|
|
289
291
|
const next = node === undefined ? view.site : Math.max(0, Math.min(Math.max(0, sites - 1), site));
|
|
290
|
-
this.language.popups.
|
|
292
|
+
this.language.popups.slot('callHierarchy').set({ ...view, active: id, site: next, sites, preview: node === undefined ? view.preview : null });
|
|
291
293
|
|
|
292
294
|
if (node !== undefined) {
|
|
293
295
|
void this.preview(node, next);
|
|
294
296
|
}
|
|
295
297
|
}
|
|
296
298
|
|
|
297
|
-
/* Steps through the places a call is made from when the active one has more than one. */
|
|
298
299
|
stepSite(direction: 1 | -1): void {
|
|
299
|
-
const view = this.language.popups.
|
|
300
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
300
301
|
|
|
301
302
|
if (view !== null && view.sites > 1) {
|
|
302
303
|
this.select(view.active, (view.site + direction + view.sites) % view.sites);
|
|
@@ -305,7 +306,7 @@ export class CallHierarchyFeature {
|
|
|
305
306
|
|
|
306
307
|
/* Goes to the call of a row, or to the symbol of a root, and closes the tree. */
|
|
307
308
|
go(id: string): void {
|
|
308
|
-
const view = this.language.popups.
|
|
309
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
309
310
|
const node = this.nodes.get(id);
|
|
310
311
|
|
|
311
312
|
if (view === null || node === undefined) {
|
|
@@ -334,24 +335,24 @@ export class CallHierarchyFeature {
|
|
|
334
335
|
}
|
|
335
336
|
|
|
336
337
|
private mounted(container: HTMLElement): void {
|
|
337
|
-
const view = this.language.popups.
|
|
338
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
338
339
|
|
|
339
340
|
if (view !== null && view.container !== container) {
|
|
340
|
-
this.language.popups.
|
|
341
|
+
this.language.popups.slot('callHierarchy').set({ ...view, container });
|
|
341
342
|
revealRow(this.timers, container);
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
345
|
|
|
345
346
|
private patch(id: string, change: Partial<CallNode>): void {
|
|
346
347
|
const node = this.nodes.get(id);
|
|
347
|
-
const view = this.language.popups.
|
|
348
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
348
349
|
|
|
349
350
|
if (node === undefined || view === null) {
|
|
350
351
|
return;
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
this.nodes.set(id, { ...node, ...change });
|
|
354
|
-
this.language.popups.
|
|
355
|
+
this.language.popups.slot('callHierarchy').set({ ...view, rows: rowsOf(this.nodes, this.roots) });
|
|
355
356
|
}
|
|
356
357
|
|
|
357
358
|
private async load(id: string): Promise<void> {
|
|
@@ -433,14 +434,14 @@ export class CallHierarchyFeature {
|
|
|
433
434
|
}
|
|
434
435
|
}
|
|
435
436
|
|
|
436
|
-
const view = this.language.popups.
|
|
437
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
437
438
|
|
|
438
439
|
if (view === null || view.active !== node.id) {
|
|
439
440
|
return;
|
|
440
441
|
}
|
|
441
442
|
|
|
442
443
|
const snippet = text === undefined ? null : snippetOf(text, range.start.line, range);
|
|
443
|
-
this.language.popups.
|
|
444
|
+
this.language.popups.slot('callHierarchy').set({ ...view, preview: snippet === null ? null : { ...snippet, uri } });
|
|
444
445
|
}
|
|
445
446
|
|
|
446
447
|
/* Whether a row stands under a node; the `more` and `status` rows belong to the node they are about. */
|
|
@@ -463,7 +464,7 @@ export class CallHierarchyFeature {
|
|
|
463
464
|
}
|
|
464
465
|
|
|
465
466
|
private key(event: KeyboardEvent): boolean {
|
|
466
|
-
const view = this.language.popups.
|
|
467
|
+
const view = this.language.popups.slot('callHierarchy').get();
|
|
467
468
|
|
|
468
469
|
if (view === null || event.metaKey || event.ctrlKey || event.altKey || event.shiftKey || event.isComposing) {
|
|
469
470
|
return false;
|