@adecore/editor-react 0.31.12 → 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
|
@@ -7,111 +7,123 @@ export const ACTION_GROUPS = ['quickfix', 'rewrite', 'extract', 'inline', 'move'
|
|
|
7
7
|
export const REFACTOR_GROUPS = ['extract', 'inline', 'move', 'rewrite', 'refactor'];
|
|
8
8
|
/* Entries in the order of `order`, the preferred actions of each group first. */
|
|
9
9
|
function inGroupOrder(entries, order) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
return order.flatMap(group => {
|
|
11
|
+
const own = entries.filter(entry => entry.group === group);
|
|
12
|
+
return [...own.filter(entry => entry.action.isPreferred === true), ...own.filter(entry => entry.action.isPreferred !== true)];
|
|
13
|
+
});
|
|
14
14
|
}
|
|
15
15
|
/* The kinds nest by dots: `refactor.extract.function` is an extraction and `source.organizeImports` a source action. */
|
|
16
16
|
export function groupOf(kind) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
if (kind === 'quickfix' || kind?.startsWith('quickfix.')) {
|
|
18
|
+
return 'quickfix';
|
|
19
|
+
}
|
|
20
|
+
for (const group of ['extract', 'inline', 'move', 'rewrite']) {
|
|
21
|
+
if (kind === `refactor.${group}` || kind?.startsWith(`refactor.${group}.`)) {
|
|
22
|
+
return group;
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (kind === 'source' || kind?.startsWith('source.')) {
|
|
29
|
-
return 'source';
|
|
30
|
-
}
|
|
31
|
-
return 'other';
|
|
24
|
+
}
|
|
25
|
+
if (kind === 'refactor' || kind?.startsWith('refactor.')) {
|
|
26
|
+
return 'refactor';
|
|
27
|
+
}
|
|
28
|
+
if (kind === 'source' || kind?.startsWith('source.')) {
|
|
29
|
+
return 'source';
|
|
30
|
+
}
|
|
31
|
+
return 'other';
|
|
32
32
|
}
|
|
33
33
|
/*
|
|
34
34
|
* What a server answered, as the rows of a list. A bare command becomes an action of its own, one a server
|
|
35
35
|
* marked disabled is left out, and each group lists the preferred actions first, in the order the server gave.
|
|
36
36
|
*/
|
|
37
37
|
export function actionsOf(result, order = ACTION_GROUPS) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const entries = (result ?? []).map(item => typeof item.command === 'string' ? {
|
|
39
|
+
title: item.title,
|
|
40
|
+
command: item
|
|
41
|
+
} : item).filter(action => action.disabled === undefined).map((action, index) => ({
|
|
42
|
+
id: String(index),
|
|
43
|
+
action,
|
|
44
|
+
group: groupOf(action.kind)
|
|
45
|
+
}));
|
|
46
|
+
return inGroupOrder(entries, order);
|
|
43
47
|
}
|
|
44
48
|
/* Entries from several requests as one list: the same order as a single answer, and an id of its own for each row. Two actions with a title and kind alike are one. */
|
|
45
49
|
export function mergeEntries(lists) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
const unique = lists.flat().filter(entry => {
|
|
52
|
+
const key = `${entry.action.kind ?? ''}\0${entry.action.title}`;
|
|
53
|
+
if (seen.has(key)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
seen.add(key);
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
59
|
+
return inGroupOrder(unique, ACTION_GROUPS).map((entry, index) => ({
|
|
60
|
+
...entry,
|
|
61
|
+
id: String(index)
|
|
62
|
+
}));
|
|
56
63
|
}
|
|
57
64
|
/* Whether the lightbulb offers it: a source action such as organizing imports is a command of its own and never a hint. */
|
|
58
65
|
export function isHint(entry) {
|
|
59
|
-
|
|
66
|
+
return entry.group !== 'source';
|
|
60
67
|
}
|
|
61
68
|
/* The problems of a line that are worth a fix: errors and warnings, errors first, in the order of the line. */
|
|
62
69
|
export function fixableOnLine(diagnostics, line) {
|
|
63
|
-
|
|
64
|
-
.filter((diagnostic) => (diagnostic.severity ?? 1) <= 2 && diagnostic.range.start.line <= line && diagnostic.range.end.line >= line)
|
|
65
|
-
.sort((left, right) => (left.severity ?? 1) - (right.severity ?? 1) || comparePositions(left.range.start, right.range.start));
|
|
70
|
+
return diagnostics.filter(diagnostic => (diagnostic.severity ?? 1) <= 2 && diagnostic.range.start.line <= line && diagnostic.range.end.line >= line).sort((left, right) => (left.severity ?? 1) - (right.severity ?? 1) || comparePositions(left.range.start, right.range.start));
|
|
66
71
|
}
|
|
67
72
|
function touches(range, target) {
|
|
68
|
-
|
|
73
|
+
return comparePositions(range.start, target.end) <= 0 && comparePositions(target.start, range.end) <= 0;
|
|
69
74
|
}
|
|
70
75
|
/* The problems an action may be about: the ones that overlap or touch the range it was asked for. */
|
|
71
76
|
export function diagnosticsAt(diagnostics, range) {
|
|
72
|
-
|
|
77
|
+
return diagnostics.filter(diagnostic => touches(diagnostic.range, range));
|
|
73
78
|
}
|
|
74
79
|
const PREVIEW_LINES = 3;
|
|
75
80
|
function linesOf(text) {
|
|
76
|
-
|
|
81
|
+
return text.split(/\r\n|\r|\n/);
|
|
77
82
|
}
|
|
78
83
|
/* Null when the edit changes nothing. A file it creates is counted under `creates` and not as another file; moves and deletes are counted apart. */
|
|
79
84
|
export function previewOf(text, edit, uri) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
const before = linesOf(text);
|
|
100
|
-
const next = linesOf(after);
|
|
101
|
-
let head = 0;
|
|
102
|
-
while (head < before.length && head < next.length && before[head] === next[head]) {
|
|
103
|
-
head++;
|
|
104
|
-
}
|
|
105
|
-
let tail = 0;
|
|
106
|
-
while (tail < before.length - head && tail < next.length - head && before[before.length - 1 - tail] === next[next.length - 1 - tail]) {
|
|
107
|
-
tail++;
|
|
108
|
-
}
|
|
109
|
-
removed = before.slice(head, before.length - tail);
|
|
110
|
-
added = next.slice(head, next.length - tail);
|
|
85
|
+
const entries = textEntriesOf(edit);
|
|
86
|
+
const operations = resourceOperationsOf(edit);
|
|
87
|
+
const count = kind => operations.filter(operation => operation.kind === kind).length;
|
|
88
|
+
const moves = count('rename');
|
|
89
|
+
const creates = count('create');
|
|
90
|
+
const deletes = count('delete');
|
|
91
|
+
const own = entries.get(uri);
|
|
92
|
+
const made = new Set(operations.filter(operation => operation.kind === 'create').map(operation => operation.uri));
|
|
93
|
+
const otherFiles = [...entries.keys()].filter(key => key !== uri && !made.has(key)).length;
|
|
94
|
+
let removed = [];
|
|
95
|
+
let added = [];
|
|
96
|
+
if (own !== undefined) {
|
|
97
|
+
let after;
|
|
98
|
+
try {
|
|
99
|
+
after = applyTextEdits(text, own.flat());
|
|
100
|
+
} catch {
|
|
101
|
+
return null;
|
|
111
102
|
}
|
|
112
|
-
|
|
113
|
-
|
|
103
|
+
const before = linesOf(text);
|
|
104
|
+
const next = linesOf(after);
|
|
105
|
+
let head = 0;
|
|
106
|
+
while (head < before.length && head < next.length && before[head] === next[head]) {
|
|
107
|
+
head++;
|
|
114
108
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
let tail = 0;
|
|
110
|
+
while (tail < before.length - head && tail < next.length - head && before[before.length - 1 - tail] === next[next.length - 1 - tail]) {
|
|
111
|
+
tail++;
|
|
112
|
+
}
|
|
113
|
+
removed = before.slice(head, before.length - tail);
|
|
114
|
+
added = next.slice(head, next.length - tail);
|
|
115
|
+
}
|
|
116
|
+
if (removed.length === 0 && added.length === 0 && otherFiles === 0 && moves === 0 && creates === 0 && deletes === 0) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const hiddenLines = Math.max(0, removed.length - PREVIEW_LINES) + Math.max(0, added.length - PREVIEW_LINES);
|
|
120
|
+
return {
|
|
121
|
+
removed: removed.slice(0, PREVIEW_LINES),
|
|
122
|
+
added: added.slice(0, PREVIEW_LINES),
|
|
123
|
+
hiddenLines,
|
|
124
|
+
otherFiles,
|
|
125
|
+
moves,
|
|
126
|
+
creates,
|
|
127
|
+
deletes
|
|
128
|
+
};
|
|
129
|
+
}
|