@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/peek-model.js
CHANGED
|
@@ -2,63 +2,75 @@
|
|
|
2
2
|
export const PEEK_READ_FILES = 30;
|
|
3
3
|
/* The part of `line` a range covers, which runs to the end of the line when the range goes on. */
|
|
4
4
|
function columnsOf(range, line, length) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
if (range.start.line !== line) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const end = Math.min(length, range.end.line === line ? range.end.character : length);
|
|
9
|
+
return range.start.character < end ? {
|
|
10
|
+
start: range.start.character,
|
|
11
|
+
end
|
|
12
|
+
} : null;
|
|
10
13
|
}
|
|
11
14
|
/* The name of a place within its line once the indentation is cut off. */
|
|
12
15
|
function trimmedNameOf(raw, range, line) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const leading = raw.length - raw.trimStart().length;
|
|
17
|
+
const columns = columnsOf(range, line, raw.length);
|
|
18
|
+
const length = raw.trim().length;
|
|
19
|
+
if (columns === null || columns.start < leading || columns.start >= leading + length) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
start: columns.start - leading,
|
|
24
|
+
end: Math.min(length, columns.end - leading)
|
|
25
|
+
};
|
|
20
26
|
}
|
|
21
27
|
/*
|
|
22
28
|
* The references grouped by file, the file the peek was opened in first and the others in the order the
|
|
23
29
|
* server gave them, each file's places by line. `textOf` answers null for a file whose text is not at hand.
|
|
24
30
|
*/
|
|
25
31
|
export function peekFilesOf(locations, current, textOf) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
byFile.get(location.uri).push(location);
|
|
32
|
+
const order = [];
|
|
33
|
+
const byFile = new Map();
|
|
34
|
+
for (const location of locations) {
|
|
35
|
+
if (!byFile.has(location.uri)) {
|
|
36
|
+
order.push(location.uri);
|
|
37
|
+
byFile.set(location.uri, []);
|
|
34
38
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
return { uri, places };
|
|
39
|
+
byFile.get(location.uri).push(location);
|
|
40
|
+
}
|
|
41
|
+
const uris = [...order.filter(uri => uri === current), ...order.filter(uri => uri !== current)];
|
|
42
|
+
return uris.map((uri, fileIndex) => {
|
|
43
|
+
const text = textOf(uri);
|
|
44
|
+
const lines = text === null ? null : text.split(/\r\n|\r|\n/);
|
|
45
|
+
const places = [...byFile.get(uri)].sort((left, right) => left.range.start.line - right.range.start.line || left.range.start.character - right.range.start.character).map((location, index) => {
|
|
46
|
+
const line = location.range.start.line;
|
|
47
|
+
const raw = lines?.[line] ?? '';
|
|
48
|
+
return {
|
|
49
|
+
id: `${fileIndex}:${index}`,
|
|
50
|
+
location,
|
|
51
|
+
line,
|
|
52
|
+
text: raw.trim(),
|
|
53
|
+
name: lines === null ? null : trimmedNameOf(raw, location.range, line)
|
|
54
|
+
};
|
|
53
55
|
});
|
|
56
|
+
return {
|
|
57
|
+
uri,
|
|
58
|
+
places
|
|
59
|
+
};
|
|
60
|
+
});
|
|
54
61
|
}
|
|
55
62
|
const BEFORE = 3;
|
|
56
63
|
const AFTER = 8;
|
|
57
64
|
export function snippetOf(text, line, range) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
const lines = text.split(/\r\n|\r|\n/);
|
|
66
|
+
const startLine = Math.max(0, line - BEFORE);
|
|
67
|
+
const end = Math.min(lines.length, line + AFTER + 1);
|
|
68
|
+
return {
|
|
69
|
+
startLine,
|
|
70
|
+
text: lines.slice(startLine, end).join('\n'),
|
|
71
|
+
active: line - startLine,
|
|
72
|
+
name: columnsOf(range, line, (lines[line] ?? '').length)
|
|
73
|
+
};
|
|
62
74
|
}
|
|
63
75
|
const DEFINITION_LINES = 24;
|
|
64
76
|
/*
|
|
@@ -66,39 +78,44 @@ const DEFINITION_LINES = 24;
|
|
|
66
78
|
* from just above the name, cut at a screenful since a class is longer than a peek is tall.
|
|
67
79
|
*/
|
|
68
80
|
export function definitionSnippetOf(text, line, declaration, range) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
const lines = text.split(/\r\n|\r|\n/);
|
|
82
|
+
const startLine = declaration === null ? Math.max(0, line - 2) : Math.min(declaration.start.line, line);
|
|
83
|
+
const end = Math.min(lines.length - 1, declaration === null ? line + DEFINITION_LINES / 2 : Math.min(declaration.end.line, startLine + DEFINITION_LINES));
|
|
84
|
+
return {
|
|
85
|
+
startLine,
|
|
86
|
+
text: lines.slice(startLine, end + 1).join('\n'),
|
|
87
|
+
active: line - startLine,
|
|
88
|
+
name: columnsOf(range, line, (lines[line] ?? '').length)
|
|
89
|
+
};
|
|
73
90
|
}
|
|
74
91
|
/*
|
|
75
92
|
* For each path, the trailing folders that tell it from the other paths with the same file name, as few
|
|
76
93
|
* as it takes; empty for a file whose name is its own.
|
|
77
94
|
*/
|
|
78
95
|
export function distinguishingFolders(paths) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
const folders = paths.map(path => path.split('/').slice(0, -1));
|
|
97
|
+
const names = paths.map(path => path.slice(path.lastIndexOf('/') + 1));
|
|
98
|
+
return paths.map((path, index) => {
|
|
99
|
+
const same = paths.map((_, other) => other).filter(other => names[other] === names[index] && paths[other] !== path);
|
|
100
|
+
if (same.length === 0) {
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
const rivals = [...new Set(same.map(other => paths[other]))].map(other => folders[paths.indexOf(other)]);
|
|
104
|
+
const mine = folders[index];
|
|
105
|
+
for (let depth = 1; depth <= mine.length; depth++) {
|
|
106
|
+
const tail = mine.slice(-depth).join('/');
|
|
107
|
+
if (rivals.every(rival => rival.slice(-depth).join('/') !== tail)) {
|
|
108
|
+
return tail;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return mine.join('/');
|
|
112
|
+
});
|
|
96
113
|
}
|
|
97
114
|
/* The column a character stands at once tabs are expanded to their stops, which is where a monospace face draws it. */
|
|
98
115
|
export function visualColumnOf(line, character, tabSize) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
116
|
+
let column = 0;
|
|
117
|
+
for (let i = 0; i < Math.min(character, line.length); i++) {
|
|
118
|
+
column += line[i] === '\t' ? tabSize - column % tabSize : 1;
|
|
119
|
+
}
|
|
120
|
+
return column;
|
|
121
|
+
}
|