@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/locales/nl.json
CHANGED
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
"language": {
|
|
3
3
|
"hover": {
|
|
4
4
|
"quickFix": "Quick fix…",
|
|
5
|
-
"quickFixNone": "
|
|
5
|
+
"quickFixNone": "Geen quick fixes",
|
|
6
6
|
"definition": "Ga naar definitie",
|
|
7
7
|
"references_one": "{{formatted}} referentie",
|
|
8
8
|
"references_other": "{{formatted}} referenties",
|
|
9
9
|
"line": "Regel {{line}}",
|
|
10
|
-
"none": "
|
|
10
|
+
"none": "Hier geen informatie"
|
|
11
11
|
},
|
|
12
12
|
"inlay": {
|
|
13
|
-
"failed": "
|
|
13
|
+
"failed": "Kon de hintactie niet uitvoeren: {{message}}"
|
|
14
14
|
},
|
|
15
15
|
"edit": {
|
|
16
|
-
"staged_one": "{{count}}
|
|
17
|
-
"staged_other": "{{count}}
|
|
16
|
+
"staged_one": "{{count}} niet-opgeslagen bestand",
|
|
17
|
+
"staged_other": "{{count}} niet-opgeslagen bestanden",
|
|
18
18
|
"stagedMore": "{{names}} en nog {{count}}",
|
|
19
19
|
"saveAll": "Alles opslaan",
|
|
20
|
-
"notSaved": "{{name}}
|
|
20
|
+
"notSaved": "Kon {{name}} niet opslaan"
|
|
21
21
|
},
|
|
22
22
|
"actions": {
|
|
23
23
|
"show": "Toon code actions",
|
|
24
24
|
"none": "Geen code actions hier",
|
|
25
|
-
"unavailable": "
|
|
26
|
-
"organized": "
|
|
27
|
-
"noFormatter": "Geen
|
|
28
|
-
"readOnly": "
|
|
29
|
-
"failed": "
|
|
30
|
-
"refused": "
|
|
25
|
+
"unavailable": "Hier geen code actions beschikbaar",
|
|
26
|
+
"organized": "Imports zijn al georganiseerd",
|
|
27
|
+
"noFormatter": "Geen formatter voor dit bestand",
|
|
28
|
+
"readOnly": "Bestand is alleen-lezen",
|
|
29
|
+
"failed": "Kon de actie niet toepassen: {{message}}",
|
|
30
|
+
"refused": "Wijziging geweigerd",
|
|
31
31
|
"moreLines": "nog {{count}} regels",
|
|
32
32
|
"otherFiles_one": "en nog {{count}} bestand",
|
|
33
33
|
"otherFiles_other": "en nog {{count}} bestanden",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"rename": {
|
|
52
|
-
"unavailable": "
|
|
53
|
-
"nothing": "
|
|
54
|
-
"refused": "
|
|
55
|
-
"stale": "De tekst veranderde
|
|
56
|
-
"failed": "
|
|
52
|
+
"unavailable": "Hernoemen niet beschikbaar in dit bestand",
|
|
53
|
+
"nothing": "Niets om te hernoemen",
|
|
54
|
+
"refused": "Nieuwe naam geweigerd",
|
|
55
|
+
"stale": "De tekst veranderde voordat de hernoeming klaar was. Probeer het opnieuw.",
|
|
56
|
+
"failed": "Kon niet hernoemen: {{message}}",
|
|
57
57
|
"occurrences_one": "{{formatted}} voorkomen",
|
|
58
58
|
"occurrences_other": "{{formatted}} voorkomens",
|
|
59
59
|
"occurrencesFiles_one": "{{formatted}} voorkomen in {{files}} bestanden",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"navigation": {
|
|
74
|
-
"unavailable": "
|
|
74
|
+
"unavailable": "Hier niet beschikbaar",
|
|
75
75
|
"none": "Niets gevonden",
|
|
76
|
-
"failed": "
|
|
76
|
+
"failed": "Kon het niet opzoeken: {{message}}",
|
|
77
77
|
"titles": {
|
|
78
78
|
"definition": "Definities",
|
|
79
79
|
"declaration": "Declaraties",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
"resize": "Paneel vergroten of verkleinen"
|
|
87
87
|
},
|
|
88
88
|
"peek": {
|
|
89
|
-
"unavailable": "
|
|
89
|
+
"unavailable": "Referenties niet beschikbaar in dit bestand",
|
|
90
90
|
"none": "Geen referenties gevonden",
|
|
91
|
-
"failed": "
|
|
91
|
+
"failed": "Kon de referenties niet opzoeken: {{message}}",
|
|
92
92
|
"references_one": "{{formatted}} referentie",
|
|
93
93
|
"references_other": "{{formatted}} referenties",
|
|
94
94
|
"close": "Sluit",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"definitions_one": "{{formatted}} definitie",
|
|
98
98
|
"definitions_other": "{{formatted}} definities",
|
|
99
99
|
"noDefinition": "Geen definitie gevonden",
|
|
100
|
-
"unavailableDefinition": "
|
|
100
|
+
"unavailableDefinition": "Definities niet beschikbaar in dit bestand"
|
|
101
101
|
},
|
|
102
102
|
"callHierarchy": {
|
|
103
|
-
"unavailable": "
|
|
104
|
-
"none": "Hier
|
|
105
|
-
"failed": "
|
|
103
|
+
"unavailable": "Aanroepen niet beschikbaar in dit bestand",
|
|
104
|
+
"none": "Hier geen aanroepen",
|
|
105
|
+
"failed": "Kon de aanroepen niet opzoeken: {{message}}",
|
|
106
106
|
"label": "Aanroephiërarchie",
|
|
107
107
|
"direction": "Richting",
|
|
108
108
|
"incoming": "Aanroepers",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"loading": "Laden…",
|
|
112
112
|
"noIncoming": "Geen aanroepers",
|
|
113
113
|
"noOutgoing": "Roept niets aan",
|
|
114
|
-
"retry": "
|
|
114
|
+
"retry": "Kon de aanroepen niet laden: {{message}}. Klik om het opnieuw te proberen",
|
|
115
115
|
"more_one": "Toon nog {{formatted}} aanroep ({{hidden}} over)",
|
|
116
116
|
"more_other": "Toon nog {{formatted}} aanroepen ({{hidden}} over)",
|
|
117
117
|
"sites_one": "{{formatted}} aanroep",
|
|
@@ -133,20 +133,20 @@
|
|
|
133
133
|
"newCode": "nieuw *",
|
|
134
134
|
"lines_one": "{{formatted}} regel",
|
|
135
135
|
"lines_other": "{{formatted}} regels",
|
|
136
|
-
"uncommitted": "
|
|
136
|
+
"uncommitted": "Niet gecommit",
|
|
137
137
|
"latest": "Laatste wijziging",
|
|
138
138
|
"showCommit": "Commit tonen"
|
|
139
139
|
},
|
|
140
140
|
"symbols": {
|
|
141
|
-
"unavailable": "
|
|
142
|
-
"failed": "
|
|
141
|
+
"unavailable": "Symbolen niet beschikbaar in dit bestand",
|
|
142
|
+
"failed": "Kon de symbolen niet lezen: {{message}}",
|
|
143
143
|
"placeholder": "Ga naar symbool in {{file}}",
|
|
144
144
|
"navigate": "Navigeer",
|
|
145
145
|
"open": "Open",
|
|
146
146
|
"workspace": "Symbolen in het project",
|
|
147
147
|
"line": "Ga naar regel",
|
|
148
148
|
"none": "Geen symbolen gevonden",
|
|
149
|
-
"workspaceHint": "Typ
|
|
149
|
+
"workspaceHint": "Typ een symboolnaam",
|
|
150
150
|
"lineHint": "Typ een regelnummer",
|
|
151
151
|
"goToLine": "Ga naar regel {{line}}",
|
|
152
152
|
"groups": {
|
|
@@ -180,14 +180,14 @@
|
|
|
180
180
|
"choices": "Snippetkeuze"
|
|
181
181
|
},
|
|
182
182
|
"completion": {
|
|
183
|
-
"tooLarge": "
|
|
183
|
+
"tooLarge": "Te groot om in te voegen",
|
|
184
184
|
"insert": "Invoegen",
|
|
185
185
|
"replace": "Vervangen",
|
|
186
186
|
"details": "Details",
|
|
187
187
|
"none": "Geen suggesties",
|
|
188
|
-
"transformBusy": "
|
|
189
|
-
"transformFailed": "
|
|
190
|
-
"failed": "
|
|
188
|
+
"transformBusy": "Het snippet is nog niet klaar. Probeer het opnieuw.",
|
|
189
|
+
"transformFailed": "Kon het snippet niet invullen",
|
|
190
|
+
"failed": "Kon de suggestie niet invoegen: {{message}}"
|
|
191
191
|
},
|
|
192
192
|
"history": {
|
|
193
193
|
"recent": "Recente plekken"
|
|
@@ -265,21 +265,21 @@
|
|
|
265
265
|
"toggle": "Vervangen tonen",
|
|
266
266
|
"hide": "Vervangen verbergen",
|
|
267
267
|
"failed": {
|
|
268
|
-
"limit": "Te veel om ineens te vervangen ({{edits}}
|
|
269
|
-
"timeout": "Vervangen duurde te lang
|
|
270
|
-
"unavailable": "Vervangen
|
|
271
|
-
"error": "
|
|
268
|
+
"limit": "Te veel om ineens te vervangen (meer dan {{edits}} treffers of {{characters}} tekens)",
|
|
269
|
+
"timeout": "Vervangen duurde te lang. Er is niets gewijzigd",
|
|
270
|
+
"unavailable": "Vervangen is nu niet beschikbaar",
|
|
271
|
+
"error": "Kon niet vervangen. Er is niets gewijzigd"
|
|
272
272
|
}
|
|
273
273
|
},
|
|
274
274
|
"countMore": "{{total}}+ resultaten",
|
|
275
275
|
"searching": "Zoeken…",
|
|
276
|
-
"large": "
|
|
276
|
+
"large": "Dit document is groot. Druk op Enter om te zoeken",
|
|
277
277
|
"replaced": "{{count}} resultaten vervangen",
|
|
278
278
|
"failed": {
|
|
279
|
-
"timeout": "Zoeken duurde te lang
|
|
279
|
+
"timeout": "Zoeken duurde te lang. Druk op Enter om het opnieuw te proberen",
|
|
280
280
|
"unavailable": "Zoeken met regex is niet beschikbaar",
|
|
281
281
|
"invalid": "Ongeldige reguliere expressie",
|
|
282
|
-
"error": "
|
|
282
|
+
"error": "Kon de zoekopdracht niet voltooien"
|
|
283
283
|
}
|
|
284
284
|
},
|
|
285
285
|
"diff": {
|
package/dist/models.js
CHANGED
|
@@ -19,4 +19,4 @@ export { replacedWords } from './word-diff.js';
|
|
|
19
19
|
export { EMPTY_FIND_QUERY, MATCH_LIMIT, compileFind, matchesIn, stepIndex } from './find-query.js';
|
|
20
20
|
export {} from './popup-placement.js';
|
|
21
21
|
export { planConflict } from './conflict-model.js';
|
|
22
|
-
export { patchLayoutOf } from './patch-layout.js';
|
|
22
|
+
export { patchLayoutOf } from './patch-layout.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const LIMIT = 100;
|
|
2
2
|
/* Two places on one line of one file are one place: a jump lands wherever, and walking back should not stop twice on the same line. */
|
|
3
3
|
function samePlace(left, right) {
|
|
4
|
-
|
|
4
|
+
return left.uri === right.uri && left.position.line === right.position.line;
|
|
5
5
|
}
|
|
6
6
|
/*
|
|
7
7
|
* Where the caret was before each jump, for Back and Forward. A jump records the place it left and
|
|
@@ -9,45 +9,44 @@ function samePlace(left, right) {
|
|
|
9
9
|
* One history serves every editor of a project, so it walks across files.
|
|
10
10
|
*/
|
|
11
11
|
export class NavigationHistory {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
this.forwards = [];
|
|
12
|
+
backs = [];
|
|
13
|
+
forwards = [];
|
|
14
|
+
record(from) {
|
|
15
|
+
if (this.backs.length > 0 && samePlace(this.backs[this.backs.length - 1], from)) {
|
|
16
|
+
this.backs[this.backs.length - 1] = from;
|
|
17
|
+
} else {
|
|
18
|
+
this.backs.push(from);
|
|
19
|
+
if (this.backs.length > LIMIT) {
|
|
20
|
+
this.backs.shift();
|
|
21
|
+
}
|
|
25
22
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
this.forwards = [];
|
|
24
|
+
}
|
|
25
|
+
/* The place before `current`, which Forward then returns to; null when there is none. */
|
|
26
|
+
back(current) {
|
|
27
|
+
return this.walk(this.backs, this.forwards, current);
|
|
28
|
+
}
|
|
29
|
+
forward(current) {
|
|
30
|
+
return this.walk(this.forwards, this.backs, current);
|
|
31
|
+
}
|
|
32
|
+
canGoBack(current) {
|
|
33
|
+
return this.backs.some(place => !samePlace(place, current));
|
|
34
|
+
}
|
|
35
|
+
canGoForward(current) {
|
|
36
|
+
return this.forwards.some(place => !samePlace(place, current));
|
|
37
|
+
}
|
|
38
|
+
/* Every place in the history but the one the caret is on, the latest first: where Back would go, then where Forward would. */
|
|
39
|
+
recent(current) {
|
|
40
|
+
return [...this.backs.toReversed(), ...this.forwards.toReversed()].filter(place => !samePlace(place, current));
|
|
41
|
+
}
|
|
42
|
+
walk(from, to, current) {
|
|
43
|
+
while (from.length > 0) {
|
|
44
|
+
const place = from.pop();
|
|
45
|
+
if (!samePlace(place, current)) {
|
|
46
|
+
to.push(current);
|
|
47
|
+
return place;
|
|
48
|
+
}
|
|
29
49
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
canGoBack(current) {
|
|
34
|
-
return this.backs.some((place) => !samePlace(place, current));
|
|
35
|
-
}
|
|
36
|
-
canGoForward(current) {
|
|
37
|
-
return this.forwards.some((place) => !samePlace(place, current));
|
|
38
|
-
}
|
|
39
|
-
/* Every place in the history but the one the caret is on, the latest first: where Back would go, then where Forward would. */
|
|
40
|
-
recent(current) {
|
|
41
|
-
return [...this.backs.toReversed(), ...this.forwards.toReversed()].filter((place) => !samePlace(place, current));
|
|
42
|
-
}
|
|
43
|
-
walk(from, to, current) {
|
|
44
|
-
while (from.length > 0) {
|
|
45
|
-
const place = from.pop();
|
|
46
|
-
if (!samePlace(place, current)) {
|
|
47
|
-
to.push(current);
|
|
48
|
-
return place;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
package/dist/navigation.js
CHANGED
|
@@ -6,44 +6,51 @@ import { placesOfName } from './symbol-links.js';
|
|
|
6
6
|
import { isShortcut } from './shortcut-keys.js';
|
|
7
7
|
import { messageOf } from './error-message.js';
|
|
8
8
|
const METHODS = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
definition: 'textDocument/definition',
|
|
10
|
+
declaration: 'textDocument/declaration',
|
|
11
|
+
typeDefinition: 'textDocument/typeDefinition',
|
|
12
|
+
implementation: 'textDocument/implementation'
|
|
13
13
|
};
|
|
14
14
|
const REQUESTS = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
definition: (service, uri, position) => service.definition(uri, position),
|
|
16
|
+
declaration: (service, uri, position) => service.declaration(uri, position),
|
|
17
|
+
typeDefinition: (service, uri, position) => service.typeDefinition(uri, position),
|
|
18
|
+
implementation: (service, uri, position) => service.implementation(uri, position)
|
|
19
19
|
};
|
|
20
|
-
const SHORTCUT_KINDS = [
|
|
21
|
-
['definition', 'goToDefinition'],
|
|
22
|
-
['typeDefinition', 'goToTypeDefinition'],
|
|
23
|
-
['implementation', 'goToImplementation']
|
|
24
|
-
];
|
|
20
|
+
const SHORTCUT_KINDS = [['definition', 'goToDefinition'], ['typeDefinition', 'goToTypeDefinition'], ['implementation', 'goToImplementation']];
|
|
25
21
|
const TOAST_ID = 'language-navigation';
|
|
26
22
|
/* The places of a result, each once: the two servers of a Vue file may both know the same one. `target` is the whole declaration when the server gave it. */
|
|
27
23
|
export function uniquePlaces(result) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
const seen = new Set();
|
|
25
|
+
const list = result === null ? [] : Array.isArray(result) ? result : [result];
|
|
26
|
+
return list.map(entry => 'targetUri' in entry ? {
|
|
27
|
+
location: {
|
|
28
|
+
uri: entry.targetUri,
|
|
29
|
+
range: entry.targetSelectionRange
|
|
30
|
+
},
|
|
31
|
+
target: entry.targetRange
|
|
32
|
+
} : {
|
|
33
|
+
location: entry,
|
|
34
|
+
target: null
|
|
35
|
+
}).filter(({
|
|
36
|
+
location
|
|
37
|
+
}) => {
|
|
38
|
+
const {
|
|
39
|
+
start
|
|
40
|
+
} = location.range;
|
|
41
|
+
const key = `${location.uri}\0${start.line}\0${start.character}`;
|
|
42
|
+
if (seen.has(key)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
seen.add(key);
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
43
48
|
}
|
|
44
49
|
/* The places of a result, each once. */
|
|
45
50
|
export function uniqueLocations(result) {
|
|
46
|
-
|
|
51
|
+
return uniquePlaces(result).map(({
|
|
52
|
+
location
|
|
53
|
+
}) => location);
|
|
47
54
|
}
|
|
48
55
|
/*
|
|
49
56
|
* Going to where a name is defined, declared, typed or implemented: Mod+click on the name or a shortcut
|
|
@@ -51,106 +58,117 @@ export function uniqueLocations(result) {
|
|
|
51
58
|
* the host; several are listed under the name to choose from.
|
|
52
59
|
*/
|
|
53
60
|
export class NavigationFeature {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
61
|
+
language;
|
|
62
|
+
constructor(language) {
|
|
63
|
+
this.language = language;
|
|
64
|
+
const {
|
|
65
|
+
editor
|
|
66
|
+
} = language;
|
|
67
|
+
const offs = [editor.onClick(click => {
|
|
68
|
+
if (!click.mod || click.alt || click.shift || !this.supports('definition')) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
void this.go('definition', click.position);
|
|
72
|
+
return true;
|
|
73
|
+
}), language.onKey(event => {
|
|
74
|
+
const found = SHORTCUT_KINDS.find(([, name]) => isShortcut(this.language.shortcuts[name], event));
|
|
75
|
+
if (found === undefined) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
void this.go(found[0]);
|
|
79
|
+
return true;
|
|
80
|
+
}, KEY_PRIORITY.navigation)];
|
|
81
|
+
language.onDispose(() => {
|
|
82
|
+
for (const off of offs) {
|
|
83
|
+
off();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
supports(kind) {
|
|
88
|
+
return this.language.project.service.supports(METHODS[kind], this.language.uri);
|
|
89
|
+
}
|
|
90
|
+
async go(kind, position = this.language.editor.getCaret()) {
|
|
91
|
+
const {
|
|
92
|
+
project,
|
|
93
|
+
uri,
|
|
94
|
+
editor
|
|
95
|
+
} = this.language;
|
|
96
|
+
if (!this.supports(kind)) {
|
|
97
|
+
this.tell(this.say('unavailable'));
|
|
98
|
+
return;
|
|
80
99
|
}
|
|
81
|
-
|
|
82
|
-
|
|
100
|
+
let result;
|
|
101
|
+
try {
|
|
102
|
+
result = await REQUESTS[kind](project.service, uri, position);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
if (!(error instanceof StaleResultError)) {
|
|
105
|
+
this.tell(this.say('failed', {
|
|
106
|
+
message: messageOf(error)
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
return;
|
|
83
110
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
catch (error) {
|
|
95
|
-
if (!(error instanceof StaleResultError)) {
|
|
96
|
-
this.tell(this.say('failed', { message: messageOf(error) }));
|
|
97
|
-
}
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const places = uniqueLocations(result);
|
|
101
|
-
if (places.length === 0) {
|
|
102
|
-
this.tell(this.say('none'));
|
|
103
|
-
}
|
|
104
|
-
else if (kind === 'definition' && places.length === 1 && places[0].uri === uri && rangeHolds(places[0].range, position)) {
|
|
105
|
-
// The name is its own definition, so what a person wants to see is where it is used.
|
|
106
|
-
void this.language.peek.open(position);
|
|
107
|
-
}
|
|
108
|
-
else if (places.length === 1) {
|
|
109
|
-
this.language.goTo(places[0]);
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
this.language.locations(places, position, this.say(`titles.${kind}`));
|
|
113
|
-
}
|
|
114
|
-
editor.focus();
|
|
111
|
+
const places = uniqueLocations(result);
|
|
112
|
+
if (places.length === 0) {
|
|
113
|
+
this.tell(this.say('none'));
|
|
114
|
+
} else if (kind === 'definition' && places.length === 1 && places[0].uri === uri && rangeHolds(places[0].range, position)) {
|
|
115
|
+
// The name is its own definition, so what a person wants to see is where it is used.
|
|
116
|
+
void this.language.peek.open(position);
|
|
117
|
+
} else if (places.length === 1) {
|
|
118
|
+
this.language.goTo(places[0]);
|
|
119
|
+
} else {
|
|
120
|
+
this.language.locations(places, position, this.say(`titles.${kind}`));
|
|
115
121
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (places.length === 1) {
|
|
133
|
-
this.language.goTo(places[0]);
|
|
134
|
-
}
|
|
135
|
-
else if (places.length > 1) {
|
|
136
|
-
this.language.locations(places, anchor, this.say('titles.symbol'));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
catch {
|
|
140
|
-
// A name that cannot be found is a link that does nothing, not an error.
|
|
141
|
-
}
|
|
122
|
+
editor.focus();
|
|
123
|
+
}
|
|
124
|
+
/*
|
|
125
|
+
* A name in the signature of a hover, which is a snippet and no document a server can be asked about by position.
|
|
126
|
+
* The symbol the signature declares goes to the definition the hover already knows; any other name is looked
|
|
127
|
+
* up by name among the symbols of the project. One match goes there at once, several are listed, and none says nothing.
|
|
128
|
+
*/
|
|
129
|
+
async goToName(name, anchor, own) {
|
|
130
|
+
const {
|
|
131
|
+
project,
|
|
132
|
+
uri,
|
|
133
|
+
editor
|
|
134
|
+
} = this.language;
|
|
135
|
+
if (own !== null) {
|
|
136
|
+
this.language.goTo(own);
|
|
137
|
+
return;
|
|
142
138
|
}
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
if (!project.service.supports('workspace/symbol', uri)) {
|
|
140
|
+
return;
|
|
145
141
|
}
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
try {
|
|
143
|
+
const places = placesOfName(await project.service.workspaceSymbols(uri, name), name, editor.getText());
|
|
144
|
+
if (places.length === 1) {
|
|
145
|
+
this.language.goTo(places[0]);
|
|
146
|
+
} else if (places.length > 1) {
|
|
147
|
+
this.language.locations(places, anchor, this.say('titles.symbol'));
|
|
148
|
+
}
|
|
149
|
+
} catch {
|
|
150
|
+
// A name that cannot be found is a link that does nothing, not an error.
|
|
148
151
|
}
|
|
152
|
+
}
|
|
153
|
+
tell(title) {
|
|
154
|
+
this.language.project.host.notify?.({
|
|
155
|
+
id: TOAST_ID,
|
|
156
|
+
kind: 'error',
|
|
157
|
+
title
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
say(key, options) {
|
|
161
|
+
return this.language.project.i18n.t(`editor:language.navigation.${key}`, options);
|
|
162
|
+
}
|
|
149
163
|
}
|
|
150
164
|
/* How a place reads in a list: the file and the line, with the folder it is in. */
|
|
151
165
|
export function locationRow(location, stored) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
166
|
+
const path = stored ?? fileUriToPath(location.uri) ?? location.uri;
|
|
167
|
+
const name = basenameOf(path);
|
|
168
|
+
const folder = path.slice(0, Math.max(0, path.length - name.length)).replace(/\/$/, '');
|
|
169
|
+
return {
|
|
170
|
+
label: `${name}:${location.range.start.line + 1}`,
|
|
171
|
+
detail: folder,
|
|
172
|
+
path: true
|
|
173
|
+
};
|
|
174
|
+
}
|
package/dist/panel-size.js
CHANGED
|
@@ -10,16 +10,16 @@ const PANEL_FALLBACK_AVAILABLE = 800;
|
|
|
10
10
|
export const PANEL_KEY_STEP = 22;
|
|
11
11
|
/* The tallest body for an editor that is `available` pixels high; never below the minimum, so a tiny editor still gets a usable panel. */
|
|
12
12
|
export function panelBodyMax(available) {
|
|
13
|
-
|
|
13
|
+
return Math.max(PANEL_BODY_MIN, Math.floor(available * PANEL_MAX_SHARE) - PANEL_CHROME);
|
|
14
14
|
}
|
|
15
15
|
export function clampPanelBody(height, available = PANEL_FALLBACK_AVAILABLE) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
if (!Number.isFinite(height)) {
|
|
17
|
+
return PANEL_BODY_HEIGHT;
|
|
18
|
+
}
|
|
19
|
+
return Math.min(panelBodyMax(available), Math.max(PANEL_BODY_MIN, Math.round(height)));
|
|
20
20
|
}
|
|
21
21
|
/* The height of the editor's scrolling area around a panel's row; the fallback stands in where nothing is laid out. */
|
|
22
22
|
export function availableHeightOf(container) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
23
|
+
const height = container?.closest('.se-viewport')?.clientHeight ?? 0;
|
|
24
|
+
return height > 0 ? height : PANEL_FALLBACK_AVAILABLE;
|
|
25
|
+
}
|