@adecore/editor-react 0.31.12 → 0.33.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/hover.js
CHANGED
|
@@ -16,267 +16,307 @@ const TOAST_ID = 'language-hover';
|
|
|
16
16
|
* the word or on the card itself, and goes when the text, the scroll or the focus moves.
|
|
17
17
|
*/
|
|
18
18
|
export class HoverFeature {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
19
|
+
language;
|
|
20
|
+
timers;
|
|
21
|
+
/* The counts asked for since the text last changed, by the symbol's position, so moving back to a name does not ask again. */
|
|
22
|
+
counts = new Map();
|
|
23
|
+
showTimer;
|
|
24
|
+
hideTimer;
|
|
25
|
+
countTimer;
|
|
26
|
+
inCard = false;
|
|
27
|
+
referenceCount = true;
|
|
28
|
+
/* Counts every request, so an answer that arrives after the pointer moved on is dropped. */
|
|
29
|
+
request = 0;
|
|
30
|
+
lookup = null;
|
|
31
|
+
/* A card the keyboard opened: scrolling does not take it away, since it was never under a pointer. Moving the caret does. */
|
|
32
|
+
pinned = false;
|
|
33
|
+
/* The card is being read: an explanation runs in it or is shown, so the pointer going elsewhere neither closes nor replaces it. */
|
|
34
|
+
held = false;
|
|
35
|
+
constructor(language, timers = realTimers) {
|
|
36
|
+
this.language = language;
|
|
37
|
+
this.timers = timers;
|
|
38
|
+
const {
|
|
39
|
+
editor
|
|
40
|
+
} = language;
|
|
41
|
+
const offs = [editor.onHover(hover => this.moved(hover)), editor.onTextChange(() => {
|
|
42
|
+
this.counts.clear();
|
|
43
|
+
this.hide();
|
|
44
|
+
}), editor.onClick(() => {
|
|
45
|
+
if (this.held) {
|
|
46
|
+
this.hide();
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}), editor.onViewChange(() => {
|
|
50
|
+
if (!this.pinned) {
|
|
51
|
+
this.hide();
|
|
52
|
+
}
|
|
53
|
+
}), editor.onCaret(() => {
|
|
54
|
+
if (this.pinned) {
|
|
55
|
+
this.hide();
|
|
56
|
+
}
|
|
57
|
+
}), language.onKey(event => {
|
|
58
|
+
if (isShortcut(this.language.shortcuts.quickInfo, event)) {
|
|
59
|
+
this.quickInfo();
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (event.key === 'Escape' && this.language.popups.getState().hover !== null && this.language.popups.getState().callHierarchy === null) {
|
|
63
|
+
this.hide();
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}, KEY_PRIORITY.hover)];
|
|
68
|
+
language.onDispose(() => {
|
|
69
|
+
for (const off of offs) {
|
|
70
|
+
off();
|
|
71
|
+
}
|
|
72
|
+
this.hide();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
configure(settings) {
|
|
76
|
+
this.referenceCount = settings.referenceCount !== false;
|
|
77
|
+
if (!this.referenceCount) {
|
|
78
|
+
this.timers.clear(this.countTimer);
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
}
|
|
81
|
+
/* The pointer entered or left the card, which is where a link in it is clicked. */
|
|
82
|
+
holdCard(inside) {
|
|
83
|
+
this.inCard = inside;
|
|
84
|
+
if (inside) {
|
|
85
|
+
this.timers.clear(this.hideTimer);
|
|
86
|
+
} else {
|
|
87
|
+
this.scheduleHide();
|
|
85
88
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
}
|
|
90
|
+
/* The card for the caret, as a pointer resting there would open it. */
|
|
91
|
+
quickInfo() {
|
|
92
|
+
const request = ++this.request;
|
|
93
|
+
this.timers.clear(this.showTimer);
|
|
94
|
+
void this.show(this.language.editor.getCaret(), request, true);
|
|
95
|
+
}
|
|
96
|
+
/* The problems at a position as a card, at once; what the servers say about the symbol is left for the pointer and Quick Info. */
|
|
97
|
+
showProblemsAt(position) {
|
|
98
|
+
const problems = this.language.diagnostics.at(position);
|
|
99
|
+
if (problems.length === 0) {
|
|
100
|
+
return false;
|
|
95
101
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
this.hide();
|
|
103
|
+
this.pinned = true;
|
|
104
|
+
this.present(position, problems, null, problems[0].diagnostic.range);
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
/* Keeps the card up until Escape, a press in the text, an edit or a move of the caret. */
|
|
108
|
+
keep() {
|
|
109
|
+
this.pinned = true;
|
|
110
|
+
this.held = true;
|
|
111
|
+
this.timers.clear(this.hideTimer);
|
|
112
|
+
}
|
|
113
|
+
/* A card of its own for a range, such as the explanation of a selection, which stays like the card Quick Info opens. */
|
|
114
|
+
showRange(range) {
|
|
115
|
+
this.hide();
|
|
116
|
+
this.keep();
|
|
117
|
+
this.present(range.start, [], null, range);
|
|
118
|
+
}
|
|
119
|
+
/* A card of text another feature brings, such as the tooltip of an inlay hint, which goes the way any hover card does. */
|
|
120
|
+
showText(position, text) {
|
|
121
|
+
this.hide();
|
|
122
|
+
this.present(position, [], {
|
|
123
|
+
text,
|
|
124
|
+
definition: null,
|
|
125
|
+
word: '',
|
|
126
|
+
references: null,
|
|
127
|
+
plain: true
|
|
128
|
+
}, null);
|
|
129
|
+
}
|
|
130
|
+
/* The pointer left what a card was opened for: it closes unless the pointer reaches the card in time. */
|
|
131
|
+
release() {
|
|
132
|
+
this.scheduleHide();
|
|
133
|
+
}
|
|
134
|
+
hide() {
|
|
135
|
+
this.pinned = false;
|
|
136
|
+
this.held = false;
|
|
137
|
+
this.request++;
|
|
138
|
+
this.lookup?.abort();
|
|
139
|
+
this.timers.clear(this.showTimer);
|
|
140
|
+
this.timers.clear(this.hideTimer);
|
|
141
|
+
this.timers.clear(this.countTimer);
|
|
142
|
+
this.inCard = false;
|
|
143
|
+
if (this.language.popups.getState().hover !== null) {
|
|
144
|
+
this.language.popups.setState({
|
|
145
|
+
hover: null
|
|
146
|
+
});
|
|
101
147
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
this.hide();
|
|
109
|
-
this.pinned = true;
|
|
110
|
-
this.present(position, problems, null, problems[0].diagnostic.range);
|
|
111
|
-
return true;
|
|
148
|
+
}
|
|
149
|
+
moved(hover) {
|
|
150
|
+
if (this.held) {
|
|
151
|
+
return;
|
|
112
152
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
153
|
+
this.timers.clear(this.showTimer);
|
|
154
|
+
if (hover === null) {
|
|
155
|
+
this.request++;
|
|
156
|
+
this.scheduleHide();
|
|
157
|
+
return;
|
|
118
158
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this.present(range.start, [], null, range);
|
|
159
|
+
const shown = this.language.popups.getState().hover;
|
|
160
|
+
if (shown !== null && rangeHolds(shown.subject, hover.position)) {
|
|
161
|
+
this.timers.clear(this.hideTimer);
|
|
162
|
+
return;
|
|
124
163
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
164
|
+
this.scheduleHide();
|
|
165
|
+
const request = ++this.request;
|
|
166
|
+
this.showTimer = this.timers.set(() => void this.show(hover.position, request, false), SHOW_DELAY_MS);
|
|
167
|
+
}
|
|
168
|
+
scheduleHide() {
|
|
169
|
+
this.timers.clear(this.hideTimer);
|
|
170
|
+
if (this.language.popups.getState().hover === null || this.inCard || this.held) {
|
|
171
|
+
return;
|
|
129
172
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
this.
|
|
173
|
+
this.hideTimer = this.timers.set(() => {
|
|
174
|
+
if (!this.inCard) {
|
|
175
|
+
this.hide();
|
|
176
|
+
}
|
|
177
|
+
}, HIDE_DELAY_MS);
|
|
178
|
+
}
|
|
179
|
+
/* What the servers say at a position: the hover text and the definition, each of which may be missing without the other. */
|
|
180
|
+
async ask(position, signal) {
|
|
181
|
+
const {
|
|
182
|
+
service
|
|
183
|
+
} = this.language.project;
|
|
184
|
+
const {
|
|
185
|
+
uri
|
|
186
|
+
} = this.language;
|
|
187
|
+
if (!service.supports('textDocument/hover', uri)) {
|
|
188
|
+
return {
|
|
189
|
+
info: null,
|
|
190
|
+
range: null
|
|
191
|
+
};
|
|
133
192
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.language.popups.setState({ hover: null });
|
|
145
|
-
}
|
|
193
|
+
const [hover, definition] = await Promise.all([service.hover(uri, position, {
|
|
194
|
+
signal
|
|
195
|
+
}).catch(() => null), service.supports('textDocument/definition', uri) ? service.definition(uri, position, {
|
|
196
|
+
signal
|
|
197
|
+
}).catch(() => null) : null]);
|
|
198
|
+
if (hover === null) {
|
|
199
|
+
return {
|
|
200
|
+
info: null,
|
|
201
|
+
range: null
|
|
202
|
+
};
|
|
146
203
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
this.request++;
|
|
154
|
-
this.scheduleHide();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const shown = this.language.popups.getState().hover;
|
|
158
|
-
if (shown !== null && rangeHolds(shown.subject, hover.position)) {
|
|
159
|
-
this.timers.clear(this.hideTimer);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
this.scheduleHide();
|
|
163
|
-
const request = ++this.request;
|
|
164
|
-
this.showTimer = this.timers.set(() => void this.show(hover.position, request, false), SHOW_DELAY_MS);
|
|
204
|
+
const text = hoverTextOf(hover);
|
|
205
|
+
if (isEmptyHover(text)) {
|
|
206
|
+
return {
|
|
207
|
+
info: null,
|
|
208
|
+
range: null
|
|
209
|
+
};
|
|
165
210
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
211
|
+
const {
|
|
212
|
+
editor
|
|
213
|
+
} = this.language;
|
|
214
|
+
const line = lineTextOf(editor, position.line);
|
|
215
|
+
const word = wordRangeAt(line, position);
|
|
216
|
+
return {
|
|
217
|
+
info: {
|
|
218
|
+
text,
|
|
219
|
+
definition: locationsOf(definition)[0] ?? null,
|
|
220
|
+
word: word === null ? '' : line.slice(word.start.character, word.end.character),
|
|
221
|
+
references: null
|
|
222
|
+
},
|
|
223
|
+
range: hover.range ?? null
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
async show(position, request, pinned) {
|
|
227
|
+
const problems = this.language.diagnostics.at(position);
|
|
228
|
+
this.lookup?.abort();
|
|
229
|
+
const controller = new AbortController();
|
|
230
|
+
this.lookup = controller;
|
|
231
|
+
const {
|
|
232
|
+
info,
|
|
233
|
+
range
|
|
234
|
+
} = await this.ask(position, controller.signal);
|
|
235
|
+
if (request !== this.request) {
|
|
236
|
+
return;
|
|
176
237
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const text = hoverTextOf(hover);
|
|
192
|
-
if (isEmptyHover(text)) {
|
|
193
|
-
return { info: null, range: null };
|
|
194
|
-
}
|
|
195
|
-
const { editor } = this.language;
|
|
196
|
-
const line = lineTextOf(editor, position.line);
|
|
197
|
-
const word = wordRangeAt(line, position);
|
|
198
|
-
return {
|
|
199
|
-
info: {
|
|
200
|
-
text,
|
|
201
|
-
definition: locationsOf(definition)[0] ?? null,
|
|
202
|
-
word: word === null ? '' : line.slice(word.start.character, word.end.character),
|
|
203
|
-
references: null
|
|
204
|
-
},
|
|
205
|
-
range: hover.range ?? null
|
|
206
|
-
};
|
|
238
|
+
if (problems.length === 0 && info === null) {
|
|
239
|
+
this.hide();
|
|
240
|
+
if (pinned && (await this.language.inlayHints.showTooltipAt(position))) {
|
|
241
|
+
this.pinned = true;
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (pinned) {
|
|
245
|
+
this.language.project.host.notify?.({
|
|
246
|
+
id: TOAST_ID,
|
|
247
|
+
kind: 'error',
|
|
248
|
+
title: this.language.project.i18n.t('editor:language.hover.none')
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return;
|
|
207
252
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
this.lookup = controller;
|
|
213
|
-
const { info, range } = await this.ask(position, controller.signal);
|
|
214
|
-
if (request !== this.request) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
if (problems.length === 0 && info === null) {
|
|
218
|
-
this.hide();
|
|
219
|
-
if (pinned && (await this.language.inlayHints.showTooltipAt(position))) {
|
|
220
|
-
this.pinned = true;
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (pinned) {
|
|
224
|
-
this.language.project.host.notify?.({ id: TOAST_ID, kind: 'error', title: this.language.project.i18n.t('editor:language.hover.none') });
|
|
225
|
-
}
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
this.pinned = pinned;
|
|
229
|
-
this.present(position, problems, info, problems[0]?.diagnostic.range ?? range);
|
|
230
|
-
if (info !== null && this.referenceCount) {
|
|
231
|
-
this.scheduleCount(position, request, controller.signal);
|
|
232
|
-
}
|
|
253
|
+
this.pinned = pinned;
|
|
254
|
+
this.present(position, problems, info, problems[0]?.diagnostic.range ?? range);
|
|
255
|
+
if (info !== null && this.referenceCount) {
|
|
256
|
+
this.scheduleCount(position, request, controller.signal);
|
|
233
257
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
258
|
+
}
|
|
259
|
+
present(position, problems, info, range) {
|
|
260
|
+
const subject = range ?? {
|
|
261
|
+
start: position,
|
|
262
|
+
end: position
|
|
263
|
+
};
|
|
264
|
+
this.timers.clear(this.hideTimer);
|
|
265
|
+
this.language.popups.setState({
|
|
266
|
+
hover: {
|
|
267
|
+
anchor: subject.start.line === position.line ? subject.start : position,
|
|
268
|
+
position,
|
|
269
|
+
subject,
|
|
270
|
+
problems,
|
|
271
|
+
info
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
/* The references of the symbol are counted once the card has stayed up a while, or at once when the text has not changed since they were. */
|
|
276
|
+
scheduleCount(position, request, signal) {
|
|
277
|
+
const key = `${position.line}:${this.wordStart(position)}`;
|
|
278
|
+
const known = this.counts.get(key);
|
|
279
|
+
if (known !== undefined) {
|
|
280
|
+
this.showCount(known, request);
|
|
281
|
+
return;
|
|
246
282
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
283
|
+
this.timers.clear(this.countTimer);
|
|
284
|
+
this.countTimer = this.timers.set(() => void this.count(position, key, request, signal), COUNT_DELAY_MS);
|
|
285
|
+
}
|
|
286
|
+
/* How many places use the symbol, which can take a while in a large project and so arrives after the card does. */
|
|
287
|
+
async count(position, key, request, signal) {
|
|
288
|
+
const {
|
|
289
|
+
service
|
|
290
|
+
} = this.language.project;
|
|
291
|
+
if (request !== this.request || !this.referenceCount || !service.supports('textDocument/references', this.language.uri)) {
|
|
292
|
+
return;
|
|
257
293
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
const found = await service.references(this.language.uri, position, false, { signal }).catch(() => null);
|
|
265
|
-
if (found === null) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
this.counts.set(key, found.length);
|
|
269
|
-
this.showCount(found.length, request);
|
|
294
|
+
const found = await service.references(this.language.uri, position, false, {
|
|
295
|
+
signal
|
|
296
|
+
}).catch(() => null);
|
|
297
|
+
if (found === null) {
|
|
298
|
+
return;
|
|
270
299
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
300
|
+
this.counts.set(key, found.length);
|
|
301
|
+
this.showCount(found.length, request);
|
|
302
|
+
}
|
|
303
|
+
showCount(count, request) {
|
|
304
|
+
const shown = this.language.popups.getState().hover;
|
|
305
|
+
if (request === this.request && shown?.info != null) {
|
|
306
|
+
this.language.popups.setState({
|
|
307
|
+
hover: {
|
|
308
|
+
...shown,
|
|
309
|
+
info: {
|
|
310
|
+
...shown.info,
|
|
311
|
+
references: count
|
|
312
|
+
}
|
|
275
313
|
}
|
|
314
|
+
});
|
|
276
315
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
316
|
+
}
|
|
317
|
+
/* Where the word at a position starts, which names the symbol for the cache. */
|
|
318
|
+
wordStart(position) {
|
|
319
|
+
const line = lineTextOf(this.language.editor, position.line);
|
|
320
|
+
return wordRangeAt(line, position)?.start.character ?? position.character;
|
|
321
|
+
}
|
|
322
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -3,15 +3,15 @@ export { KEY_PRIORITY } from './key-priority.js';
|
|
|
3
3
|
export { realTimers } from './timers.js';
|
|
4
4
|
export {} from './semantic-tokens.js';
|
|
5
5
|
export { ProjectLanguage } from './project-language.js';
|
|
6
|
-
export { EditorView } from
|
|
6
|
+
export { EditorView } from "./EditorView.js";
|
|
7
7
|
export { createHolder } from './holder.js';
|
|
8
|
-
export { LanguagePopups } from
|
|
9
|
-
export { AnchoredPopup } from
|
|
10
|
-
export { SignatureCard } from
|
|
8
|
+
export { LanguagePopups } from "./LanguagePopups.js";
|
|
9
|
+
export { AnchoredPopup } from "./AnchoredPopup.js";
|
|
10
|
+
export { SignatureCard } from "./SignatureCard.js";
|
|
11
11
|
export {} from './rendered-docs.js';
|
|
12
|
-
export { EditorRenderingProvider } from
|
|
13
|
-
export { FindReplace } from
|
|
14
|
-
export { ChangeReview } from
|
|
12
|
+
export { EditorRenderingProvider } from "./rendering.js";
|
|
13
|
+
export { FindReplace } from "./FindReplace.js";
|
|
14
|
+
export { ChangeReview } from "./ChangeReview.js";
|
|
15
15
|
export { ProjectProblems, serviceProblems, countsOf } from './project-problems.js';
|
|
16
16
|
export { applyWorkspaceEdit, supportedResourceOperations } from './workspace-edit.js';
|
|
17
17
|
export { useProblemCounts } from './use-problem-counts.js';
|
|
@@ -20,8 +20,8 @@ export { highlightLayers } from './highlight-layers.js';
|
|
|
20
20
|
export {} from './navigation-history.js';
|
|
21
21
|
export { openingPlace, viewStates, followViewStates, viewStateKey, forgetMovesFrom } from './view-state.js';
|
|
22
22
|
export { lspLanguageIdOf, shikiLanguageOf, shikiLanguageOfPath } from './language-ids.js';
|
|
23
|
-
export { AttributionCard } from
|
|
23
|
+
export { AttributionCard } from "./AttributionCard.js";
|
|
24
24
|
export { ReviewGroup, joinReviewGroup } from './review-group.js';
|
|
25
|
-
export { DiffView } from
|
|
25
|
+
export { DiffView } from "./DiffView.js";
|
|
26
26
|
export { diffSyntaxDocument } from './diff-syntax.js';
|
|
27
|
-
export { decoratePatch, usePatchDecorations } from './patch-decorations.js';
|
|
27
|
+
export { decoratePatch, usePatchDecorations } from './patch-decorations.js';
|