@adecore/editor-react 0.31.11 → 0.32.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/dist/AnchoredPopup.js +73 -19
- package/dist/AttributionCard.js +162 -4
- package/dist/BaselineStatus.js +62 -8
- package/dist/CallHierarchyPanel.js +977 -60
- package/dist/ChangeReview.js +76 -25
- package/dist/CodeAuthorsCard.js +314 -14
- package/dist/CompletionPopup.js +490 -83
- package/dist/DiffView.js +548 -181
- package/dist/EditorContextMenu.js +352 -34
- package/dist/EditorView.js +276 -99
- package/dist/FindReplace.js +525 -67
- package/dist/HoverCard.js +378 -38
- package/dist/HoverSections.js +367 -56
- package/dist/LanguagePopups.js +95 -34
- package/dist/Markdown.js +41 -6
- package/dist/PanelResizeHandle.js +199 -66
- package/dist/PathText.js +49 -7
- package/dist/PeekPanel.js +675 -72
- package/dist/PickPopup.js +304 -34
- package/dist/RenameCard.js +679 -85
- package/dist/RenderedDocs.js +329 -58
- package/dist/SignatureCard.js +91 -7
- package/dist/SplitDiffView.js +344 -254
- package/dist/SymbolPicker.js +440 -85
- package/dist/call-hierarchy-model.js +102 -68
- package/dist/call-hierarchy.js +458 -359
- package/dist/code-actions-model.js +88 -76
- package/dist/code-actions.js +372 -283
- package/dist/code-authors.js +64 -55
- package/dist/code-vision-model.js +134 -127
- package/dist/code-vision.js +224 -206
- package/dist/completion-call.js +94 -67
- package/dist/completion-model.js +334 -244
- package/dist/completion.js +840 -649
- package/dist/conflict-model.js +35 -29
- package/dist/context-menu-rows.js +42 -17
- package/dist/context-menu.js +64 -46
- package/dist/definition-link.js +88 -85
- package/dist/diagnostics-model.js +74 -55
- package/dist/diagnostics.js +121 -100
- package/dist/diff-expansion.js +38 -35
- package/dist/diff-overlays.js +144 -22
- package/dist/diff-syntax.js +65 -42
- package/dist/diff-wordmarks.js +26 -23
- package/dist/doc-comment-model.js +265 -216
- package/dist/editor-language.js +177 -152
- package/dist/error-message.js +2 -2
- package/dist/find-query.js +49 -36
- package/dist/folding.js +81 -62
- package/dist/format-on-type.js +86 -67
- package/dist/highlight-layers.js +19 -20
- package/dist/highlights.js +105 -83
- package/dist/history.js +44 -38
- package/dist/holder.js +18 -18
- package/dist/host-types.js +1 -1
- package/dist/hover-content.js +167 -129
- package/dist/hover.js +285 -245
- package/dist/index.js +10 -10
- package/dist/inlay-hints.js +369 -324
- package/dist/key-priority.js +34 -31
- package/dist/language-ids.js +45 -42
- package/dist/line-edits.js +74 -28
- package/dist/line-text.js +18 -3
- package/dist/locales/en.json +38 -38
- package/dist/locales/nl.json +41 -41
- package/dist/models.js +1 -1
- package/dist/navigation-history.js +40 -41
- package/dist/navigation.js +141 -123
- package/dist/panel-size.js +8 -8
- package/dist/patch-decorations.js +236 -160
- package/dist/patch-layout.js +331 -262
- package/dist/paths.js +3 -3
- package/dist/peek-model.js +86 -69
- package/dist/peek.js +254 -192
- package/dist/pick.js +164 -157
- package/dist/popup-focus.js +5 -5
- package/dist/popup-placement.js +36 -21
- package/dist/popups.js +13 -13
- package/dist/project-language.js +228 -211
- package/dist/project-problems.js +81 -69
- package/dist/proposal-model.js +163 -126
- package/dist/recent-choices.js +25 -25
- package/dist/refresher.js +44 -49
- package/dist/rename-model.js +113 -113
- package/dist/rename.js +321 -233
- package/dist/rendered-docs.d.ts +4 -2
- package/dist/rendered-docs.js +384 -318
- package/dist/rendering-context.js +5 -3
- package/dist/rendering.js +22 -4
- package/dist/review-group.js +42 -39
- package/dist/row-host.d.ts +4 -2
- package/dist/row-host.js +90 -78
- package/dist/selection-ranges.js +21 -17
- package/dist/semantic-delta.js +22 -19
- package/dist/semantic-model.js +86 -73
- package/dist/semantic-tokens.js +201 -162
- package/dist/shortcut-keys.js +16 -10
- package/dist/signature-model.js +34 -28
- package/dist/signature.js +177 -129
- package/dist/snippet-field-transforms.js +118 -106
- package/dist/snippet-indent.js +48 -43
- package/dist/snippet-range-order.js +11 -11
- package/dist/snippet-session.js +703 -667
- package/dist/snippet-transform-client.js +59 -59
- package/dist/snippet-transform-format.js +285 -263
- package/dist/snippet-transform-protocol.js +1 -1
- package/dist/snippet-transform-queue.js +163 -153
- package/dist/snippet-transform-worker.js +42 -35
- package/dist/snippet-variable-names.js +1 -36
- package/dist/snippet-variables.js +53 -63
- package/dist/snippet.js +477 -405
- package/dist/split-alignment.js +47 -35
- package/dist/split-scroll.js +42 -40
- package/dist/symbol-links.js +33 -25
- package/dist/symbol-picker-model.js +126 -116
- package/dist/symbol-picker.js +98 -59
- package/dist/symbols.js +117 -88
- package/dist/testing.js +248 -165
- package/dist/timers.js +35 -30
- package/dist/use-panel-body.js +49 -8
- package/dist/use-problem-counts.js +29 -15
- package/dist/view-state.js +54 -33
- package/dist/word-diff.js +18 -18
- package/dist/workspace-edit.js +300 -249
- package/package.json +6 -6
- package/src/CallHierarchyPanel.tsx +2 -2
- package/src/DiffView.tsx +3 -3
- package/src/FindReplace.tsx +2 -2
- package/src/LanguagePopups.tsx +2 -0
- package/src/PeekPanel.tsx +3 -3
- package/src/RenderedDocs.tsx +9 -10
- package/src/SymbolPicker.tsx +2 -2
- package/src/diff-overlays.tsx +6 -4
- package/src/locales/en.json +38 -38
- package/src/locales/nl.json +41 -41
- package/src/rendered-docs.ts +14 -3
- package/src/row-host.ts +14 -3
package/dist/pick.js
CHANGED
|
@@ -7,171 +7,178 @@ const PREVIEW_DELAY_MS = 120;
|
|
|
7
7
|
* Escape, typing, a click elsewhere or a change of the text close it.
|
|
8
8
|
*/
|
|
9
9
|
export class PickFeature {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
10
|
+
language;
|
|
11
|
+
timers;
|
|
12
|
+
spec = null;
|
|
13
|
+
ids = [];
|
|
14
|
+
active = '';
|
|
15
|
+
previewTimer;
|
|
16
|
+
controller = null;
|
|
17
|
+
/* The rows that said why they cannot be taken, by id. */
|
|
18
|
+
refusals = new Map();
|
|
19
|
+
attempting = false;
|
|
20
|
+
constructor(language, timers = realTimers) {
|
|
21
|
+
this.language = language;
|
|
22
|
+
this.timers = timers;
|
|
23
|
+
const {
|
|
24
|
+
editor
|
|
25
|
+
} = language;
|
|
26
|
+
const offs = [language.onKey(event => this.key(event), KEY_PRIORITY.pick), editor.onTextChange(() => this.close()), editor.onCaret(() => this.close()), editor.onBlur(() => this.close())];
|
|
27
|
+
language.onDispose(() => {
|
|
28
|
+
for (const off of offs) {
|
|
29
|
+
off();
|
|
30
|
+
}
|
|
31
|
+
this.close();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
get isOpen() {
|
|
35
|
+
return this.spec !== null;
|
|
36
|
+
}
|
|
37
|
+
open(spec) {
|
|
38
|
+
this.close();
|
|
39
|
+
const ids = spec.groups.flatMap(group => group.rows.map(row => row.id));
|
|
40
|
+
if (ids.length === 0) {
|
|
41
|
+
return;
|
|
36
42
|
}
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
this.spec = spec;
|
|
44
|
+
this.refusals = new Map();
|
|
45
|
+
this.ids = ids;
|
|
46
|
+
this.active = spec.active !== undefined && ids.includes(spec.active) ? spec.active : ids[0];
|
|
47
|
+
this.publish(null);
|
|
48
|
+
this.schedulePreview();
|
|
49
|
+
}
|
|
50
|
+
close() {
|
|
51
|
+
if (this.spec === null) {
|
|
52
|
+
return;
|
|
39
53
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
this.spec = null;
|
|
55
|
+
this.timers.clear(this.previewTimer);
|
|
56
|
+
this.controller?.abort();
|
|
57
|
+
this.controller = null;
|
|
58
|
+
this.language.popups.setState({
|
|
59
|
+
pick: null
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
move(delta) {
|
|
63
|
+
const index = this.ids.indexOf(this.active);
|
|
64
|
+
this.activate(this.ids[Math.max(0, Math.min(this.ids.length - 1, index + delta))]);
|
|
65
|
+
}
|
|
66
|
+
/* Takes a row, by a click or Enter. */
|
|
67
|
+
choose(id) {
|
|
68
|
+
const spec = this.spec;
|
|
69
|
+
if (spec === null || !this.ids.includes(id) || this.attempting) {
|
|
70
|
+
return;
|
|
52
71
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.spec = null;
|
|
58
|
-
this.timers.clear(this.previewTimer);
|
|
59
|
-
this.controller?.abort();
|
|
60
|
-
this.controller = null;
|
|
61
|
-
this.language.popups.setState({ pick: null });
|
|
72
|
+
if (spec.attempt === undefined) {
|
|
73
|
+
this.close();
|
|
74
|
+
spec.accept(id);
|
|
75
|
+
return;
|
|
62
76
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.catch(() => null)
|
|
82
|
-
.then((reason) => {
|
|
83
|
-
this.attempting = false;
|
|
84
|
-
if (this.spec !== spec) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (reason === null) {
|
|
88
|
-
this.close();
|
|
89
|
-
spec.accept(id);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
this.refusals.set(id, reason);
|
|
93
|
-
this.publish(null);
|
|
94
|
-
});
|
|
77
|
+
this.attempting = true;
|
|
78
|
+
void spec.attempt(id).catch(() => null).then(reason => {
|
|
79
|
+
this.attempting = false;
|
|
80
|
+
if (this.spec !== spec) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (reason === null) {
|
|
84
|
+
this.close();
|
|
85
|
+
spec.accept(id);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.refusals.set(id, reason);
|
|
89
|
+
this.publish(null);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
activate(id) {
|
|
93
|
+
if (id === this.active) {
|
|
94
|
+
return;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
this.active = id;
|
|
97
|
+
this.controller?.abort();
|
|
98
|
+
this.publish(null);
|
|
99
|
+
this.schedulePreview();
|
|
100
|
+
}
|
|
101
|
+
key(event) {
|
|
102
|
+
if (this.spec === null || event.metaKey || event.ctrlKey || event.altKey) {
|
|
103
|
+
return false;
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
else {
|
|
138
|
-
this.choose(this.active);
|
|
139
|
-
}
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
case 'Escape':
|
|
143
|
-
this.close();
|
|
144
|
-
return true;
|
|
145
|
-
default:
|
|
146
|
-
return false;
|
|
105
|
+
switch (event.key) {
|
|
106
|
+
case 'ArrowDown':
|
|
107
|
+
this.move(1);
|
|
108
|
+
return true;
|
|
109
|
+
case 'ArrowUp':
|
|
110
|
+
this.move(-1);
|
|
111
|
+
return true;
|
|
112
|
+
case 'PageDown':
|
|
113
|
+
this.move(8);
|
|
114
|
+
return true;
|
|
115
|
+
case 'PageUp':
|
|
116
|
+
this.move(-8);
|
|
117
|
+
return true;
|
|
118
|
+
case 'Home':
|
|
119
|
+
this.activate(this.ids[0]);
|
|
120
|
+
return true;
|
|
121
|
+
case 'End':
|
|
122
|
+
this.activate(this.ids[this.ids.length - 1]);
|
|
123
|
+
return true;
|
|
124
|
+
case 'Enter':
|
|
125
|
+
this.choose(this.active);
|
|
126
|
+
return true;
|
|
127
|
+
case 'Tab':
|
|
128
|
+
{
|
|
129
|
+
const spec = this.spec;
|
|
130
|
+
if (spec.onTab !== undefined) {
|
|
131
|
+
this.close();
|
|
132
|
+
spec.onTab(event.shiftKey);
|
|
133
|
+
} else {
|
|
134
|
+
this.choose(this.active);
|
|
135
|
+
}
|
|
136
|
+
return true;
|
|
147
137
|
}
|
|
138
|
+
case 'Escape':
|
|
139
|
+
this.close();
|
|
140
|
+
return true;
|
|
141
|
+
default:
|
|
142
|
+
return false;
|
|
148
143
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const id = this.active;
|
|
156
|
-
this.previewTimer = this.timers.set(() => {
|
|
157
|
-
const controller = new AbortController();
|
|
158
|
-
this.controller = controller;
|
|
159
|
-
spec.preview(id, controller.signal)
|
|
160
|
-
.then((preview) => {
|
|
161
|
-
if (this.spec === spec && this.active === id && !controller.signal.aborted) {
|
|
162
|
-
this.publish(preview);
|
|
163
|
-
}
|
|
164
|
-
})
|
|
165
|
-
.catch(() => undefined);
|
|
166
|
-
}, PREVIEW_DELAY_MS);
|
|
144
|
+
}
|
|
145
|
+
schedulePreview() {
|
|
146
|
+
const spec = this.spec;
|
|
147
|
+
this.timers.clear(this.previewTimer);
|
|
148
|
+
if (spec?.preview === undefined) {
|
|
149
|
+
return;
|
|
167
150
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
151
|
+
const id = this.active;
|
|
152
|
+
this.previewTimer = this.timers.set(() => {
|
|
153
|
+
const controller = new AbortController();
|
|
154
|
+
this.controller = controller;
|
|
155
|
+
spec.preview(id, controller.signal).then(preview => {
|
|
156
|
+
if (this.spec === spec && this.active === id && !controller.signal.aborted) {
|
|
157
|
+
this.publish(preview);
|
|
172
158
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
159
|
+
}).catch(() => undefined);
|
|
160
|
+
}, PREVIEW_DELAY_MS);
|
|
161
|
+
}
|
|
162
|
+
publish(preview) {
|
|
163
|
+
const spec = this.spec;
|
|
164
|
+
if (spec === null) {
|
|
165
|
+
return;
|
|
176
166
|
}
|
|
177
|
-
|
|
167
|
+
const refusal = this.refusals.get(this.active);
|
|
168
|
+
const shown = refusal === undefined ? preview : {
|
|
169
|
+
removed: [],
|
|
170
|
+
added: [],
|
|
171
|
+
note: null,
|
|
172
|
+
refusal
|
|
173
|
+
};
|
|
174
|
+
this.language.popups.setState({
|
|
175
|
+
pick: {
|
|
176
|
+
anchor: spec.anchor,
|
|
177
|
+
groups: spec.groups,
|
|
178
|
+
active: this.active,
|
|
179
|
+
preview: shown,
|
|
180
|
+
title: spec.title ?? null
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
package/dist/popup-focus.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* text. A press on the list moves no focus, and a row that gets it anyway hands it straight back.
|
|
6
6
|
*/
|
|
7
7
|
export function keepFocusOutOfList(focusBack) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
8
|
+
return {
|
|
9
|
+
onMouseDown: event => event.preventDefault(),
|
|
10
|
+
onFocus: () => focusBack()
|
|
11
|
+
};
|
|
12
|
+
}
|
package/dist/popup-placement.js
CHANGED
|
@@ -5,30 +5,45 @@
|
|
|
5
5
|
* are the page's own pixels, so a canvas's scale never enters.
|
|
6
6
|
*/
|
|
7
7
|
export function placePopup(anchor, size, window, options = {}) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const gap = options.gap ?? 4;
|
|
9
|
+
const margin = options.margin ?? 8;
|
|
10
|
+
const roomBelow = window.height - margin - (anchor.bottom + gap);
|
|
11
|
+
const roomAbove = anchor.top - gap - margin;
|
|
12
|
+
const fitsBelow = size.height <= roomBelow;
|
|
13
|
+
const fitsAbove = size.height <= roomAbove;
|
|
14
|
+
const below = options.prefer === 'above' ? !fitsAbove && (fitsBelow || roomBelow >= roomAbove) : fitsBelow || !fitsAbove && roomBelow >= roomAbove;
|
|
15
|
+
const maxHeight = Math.max(0, below ? roomBelow : roomAbove);
|
|
16
|
+
const height = Math.min(size.height, maxHeight);
|
|
17
|
+
const left = Math.max(margin, Math.min(anchor.left, window.width - size.width - margin));
|
|
18
|
+
return {
|
|
19
|
+
left,
|
|
20
|
+
top: below ? anchor.bottom + gap : anchor.top - gap - height,
|
|
21
|
+
maxHeight,
|
|
22
|
+
side: below ? 'below' : 'above'
|
|
23
|
+
};
|
|
19
24
|
}
|
|
20
25
|
/*
|
|
21
26
|
* A second box beside a first, such as the documentation of the highlighted suggestion: to the right
|
|
22
27
|
* of it when it fits, to the left when only that fits, and under it, at its left edge, when neither does.
|
|
23
28
|
*/
|
|
24
29
|
export function placeBeside(first, size, window, margin = 8, gap = 4) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
30
|
+
const fitsRight = first.left + first.width + gap + size.width <= window.width - margin;
|
|
31
|
+
const fitsLeft = first.left - gap - size.width >= margin;
|
|
32
|
+
if (fitsRight || fitsLeft) {
|
|
33
|
+
const top = Math.max(margin, Math.min(first.top, window.height - size.height - margin));
|
|
34
|
+
return {
|
|
35
|
+
left: fitsRight ? first.left + first.width + gap : first.left - gap - size.width,
|
|
36
|
+
top,
|
|
37
|
+
maxHeight: window.height - margin * 2,
|
|
38
|
+
side: 'below'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const top = first.top + first.height + gap;
|
|
42
|
+
const maxHeight = Math.max(0, window.height - margin - top);
|
|
43
|
+
return {
|
|
44
|
+
left: Math.max(margin, Math.min(first.left, window.width - size.width - margin)),
|
|
45
|
+
top,
|
|
46
|
+
maxHeight,
|
|
47
|
+
side: 'below'
|
|
48
|
+
};
|
|
49
|
+
}
|
package/dist/popups.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createStore } from 'zustand';
|
|
2
2
|
export function createPopupStore() {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
3
|
+
return createStore(() => ({
|
|
4
|
+
hover: null,
|
|
5
|
+
completion: null,
|
|
6
|
+
signature: null,
|
|
7
|
+
pick: null,
|
|
8
|
+
rename: null,
|
|
9
|
+
peek: null,
|
|
10
|
+
callHierarchy: null,
|
|
11
|
+
symbols: null,
|
|
12
|
+
menu: null,
|
|
13
|
+
authors: null
|
|
14
|
+
}));
|
|
15
|
+
}
|