@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.
Files changed (137) hide show
  1. package/dist/AnchoredPopup.js +73 -19
  2. package/dist/AttributionCard.js +162 -4
  3. package/dist/BaselineStatus.js +62 -8
  4. package/dist/CallHierarchyPanel.js +977 -60
  5. package/dist/ChangeReview.js +76 -25
  6. package/dist/CodeAuthorsCard.js +314 -14
  7. package/dist/CompletionPopup.js +490 -83
  8. package/dist/DiffView.js +548 -181
  9. package/dist/EditorContextMenu.js +352 -34
  10. package/dist/EditorView.js +276 -99
  11. package/dist/FindReplace.js +525 -67
  12. package/dist/HoverCard.js +378 -38
  13. package/dist/HoverSections.js +367 -56
  14. package/dist/LanguagePopups.js +95 -34
  15. package/dist/Markdown.js +41 -6
  16. package/dist/PanelResizeHandle.js +199 -66
  17. package/dist/PathText.js +49 -7
  18. package/dist/PeekPanel.js +675 -72
  19. package/dist/PickPopup.js +304 -34
  20. package/dist/RenameCard.js +679 -85
  21. package/dist/RenderedDocs.js +329 -58
  22. package/dist/SignatureCard.js +91 -7
  23. package/dist/SplitDiffView.js +344 -254
  24. package/dist/SymbolPicker.js +440 -85
  25. package/dist/call-hierarchy-model.js +102 -68
  26. package/dist/call-hierarchy.js +458 -359
  27. package/dist/code-actions-model.js +88 -76
  28. package/dist/code-actions.js +372 -283
  29. package/dist/code-authors.js +64 -55
  30. package/dist/code-vision-model.js +134 -127
  31. package/dist/code-vision.js +224 -206
  32. package/dist/completion-call.js +94 -67
  33. package/dist/completion-model.js +334 -244
  34. package/dist/completion.js +840 -649
  35. package/dist/conflict-model.js +35 -29
  36. package/dist/context-menu-rows.js +42 -17
  37. package/dist/context-menu.js +64 -46
  38. package/dist/definition-link.js +88 -85
  39. package/dist/diagnostics-model.js +74 -55
  40. package/dist/diagnostics.js +121 -100
  41. package/dist/diff-expansion.js +38 -35
  42. package/dist/diff-overlays.js +144 -22
  43. package/dist/diff-syntax.js +65 -42
  44. package/dist/diff-wordmarks.js +26 -23
  45. package/dist/doc-comment-model.js +265 -216
  46. package/dist/editor-language.js +177 -152
  47. package/dist/error-message.js +2 -2
  48. package/dist/find-query.js +49 -36
  49. package/dist/folding.js +81 -62
  50. package/dist/format-on-type.js +86 -67
  51. package/dist/highlight-layers.js +19 -20
  52. package/dist/highlights.js +105 -83
  53. package/dist/history.js +44 -38
  54. package/dist/holder.js +18 -18
  55. package/dist/host-types.js +1 -1
  56. package/dist/hover-content.js +167 -129
  57. package/dist/hover.js +285 -245
  58. package/dist/index.js +10 -10
  59. package/dist/inlay-hints.js +369 -324
  60. package/dist/key-priority.js +34 -31
  61. package/dist/language-ids.js +45 -42
  62. package/dist/line-edits.js +74 -28
  63. package/dist/line-text.js +18 -3
  64. package/dist/locales/en.json +38 -38
  65. package/dist/locales/nl.json +41 -41
  66. package/dist/models.js +1 -1
  67. package/dist/navigation-history.js +40 -41
  68. package/dist/navigation.js +141 -123
  69. package/dist/panel-size.js +8 -8
  70. package/dist/patch-decorations.js +236 -160
  71. package/dist/patch-layout.js +331 -262
  72. package/dist/paths.js +3 -3
  73. package/dist/peek-model.js +86 -69
  74. package/dist/peek.js +254 -192
  75. package/dist/pick.js +164 -157
  76. package/dist/popup-focus.js +5 -5
  77. package/dist/popup-placement.js +36 -21
  78. package/dist/popups.js +13 -13
  79. package/dist/project-language.js +228 -211
  80. package/dist/project-problems.js +81 -69
  81. package/dist/proposal-model.js +163 -126
  82. package/dist/recent-choices.js +25 -25
  83. package/dist/refresher.js +44 -49
  84. package/dist/rename-model.js +113 -113
  85. package/dist/rename.js +321 -233
  86. package/dist/rendered-docs.d.ts +4 -2
  87. package/dist/rendered-docs.js +384 -318
  88. package/dist/rendering-context.js +5 -3
  89. package/dist/rendering.js +22 -4
  90. package/dist/review-group.js +42 -39
  91. package/dist/row-host.d.ts +4 -2
  92. package/dist/row-host.js +90 -78
  93. package/dist/selection-ranges.js +21 -17
  94. package/dist/semantic-delta.js +22 -19
  95. package/dist/semantic-model.js +86 -73
  96. package/dist/semantic-tokens.js +201 -162
  97. package/dist/shortcut-keys.js +16 -10
  98. package/dist/signature-model.js +34 -28
  99. package/dist/signature.js +177 -129
  100. package/dist/snippet-field-transforms.js +118 -106
  101. package/dist/snippet-indent.js +48 -43
  102. package/dist/snippet-range-order.js +11 -11
  103. package/dist/snippet-session.js +703 -667
  104. package/dist/snippet-transform-client.js +59 -59
  105. package/dist/snippet-transform-format.js +285 -263
  106. package/dist/snippet-transform-protocol.js +1 -1
  107. package/dist/snippet-transform-queue.js +163 -153
  108. package/dist/snippet-transform-worker.js +42 -35
  109. package/dist/snippet-variable-names.js +1 -36
  110. package/dist/snippet-variables.js +53 -63
  111. package/dist/snippet.js +477 -405
  112. package/dist/split-alignment.js +47 -35
  113. package/dist/split-scroll.js +42 -40
  114. package/dist/symbol-links.js +33 -25
  115. package/dist/symbol-picker-model.js +126 -116
  116. package/dist/symbol-picker.js +98 -59
  117. package/dist/symbols.js +117 -88
  118. package/dist/testing.js +248 -165
  119. package/dist/timers.js +35 -30
  120. package/dist/use-panel-body.js +49 -8
  121. package/dist/use-problem-counts.js +29 -15
  122. package/dist/view-state.js +54 -33
  123. package/dist/word-diff.js +18 -18
  124. package/dist/workspace-edit.js +300 -249
  125. package/package.json +6 -6
  126. package/src/CallHierarchyPanel.tsx +2 -2
  127. package/src/DiffView.tsx +3 -3
  128. package/src/FindReplace.tsx +2 -2
  129. package/src/LanguagePopups.tsx +2 -0
  130. package/src/PeekPanel.tsx +3 -3
  131. package/src/RenderedDocs.tsx +9 -10
  132. package/src/SymbolPicker.tsx +2 -2
  133. package/src/diff-overlays.tsx +6 -4
  134. package/src/locales/en.json +38 -38
  135. package/src/locales/nl.json +41 -41
  136. package/src/rendered-docs.ts +14 -3
  137. 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
- 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 { editor } = language;
39
- const offs = [
40
- editor.onHover((hover) => this.moved(hover)),
41
- editor.onTextChange(() => {
42
- this.counts.clear();
43
- this.hide();
44
- }),
45
- editor.onClick(() => {
46
- if (this.held) {
47
- this.hide();
48
- }
49
- return false;
50
- }),
51
- editor.onViewChange(() => {
52
- if (!this.pinned) {
53
- this.hide();
54
- }
55
- }),
56
- editor.onCaret(() => {
57
- if (this.pinned) {
58
- this.hide();
59
- }
60
- }),
61
- language.onKey((event) => {
62
- if (isShortcut(this.language.shortcuts.quickInfo, event)) {
63
- this.quickInfo();
64
- return true;
65
- }
66
- if (event.key === 'Escape' && this.language.popups.getState().hover !== null && this.language.popups.getState().callHierarchy === null) {
67
- this.hide();
68
- return true;
69
- }
70
- return false;
71
- }, KEY_PRIORITY.hover)
72
- ];
73
- language.onDispose(() => {
74
- for (const off of offs) {
75
- off();
76
- }
77
- this.hide();
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
- configure(settings) {
81
- this.referenceCount = settings.referenceCount !== false;
82
- if (!this.referenceCount) {
83
- this.timers.clear(this.countTimer);
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
- /* The pointer entered or left the card, which is where a link in it is clicked. */
87
- holdCard(inside) {
88
- this.inCard = inside;
89
- if (inside) {
90
- this.timers.clear(this.hideTimer);
91
- }
92
- else {
93
- this.scheduleHide();
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
- /* The card for the caret, as a pointer resting there would open it. */
97
- quickInfo() {
98
- const request = ++this.request;
99
- this.timers.clear(this.showTimer);
100
- void this.show(this.language.editor.getCaret(), request, true);
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
- /* 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. */
103
- showProblemsAt(position) {
104
- const problems = this.language.diagnostics.at(position);
105
- if (problems.length === 0) {
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
- /* Keeps the card up until Escape, a press in the text, an edit or a move of the caret. */
114
- keep() {
115
- this.pinned = true;
116
- this.held = true;
117
- this.timers.clear(this.hideTimer);
153
+ this.timers.clear(this.showTimer);
154
+ if (hover === null) {
155
+ this.request++;
156
+ this.scheduleHide();
157
+ return;
118
158
  }
119
- /* A card of its own for a range, such as the explanation of a selection, which stays like the card Quick Info opens. */
120
- showRange(range) {
121
- this.hide();
122
- this.keep();
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
- /* A card of text another feature brings, such as the tooltip of an inlay hint, which goes the way any hover card does. */
126
- showText(position, text) {
127
- this.hide();
128
- this.present(position, [], { text, definition: null, word: '', references: null, plain: true }, null);
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
- /* The pointer left what a card was opened for: it closes unless the pointer reaches the card in time. */
131
- release() {
132
- this.scheduleHide();
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
- 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({ 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
- moved(hover) {
148
- if (this.held) {
149
- return;
150
- }
151
- this.timers.clear(this.showTimer);
152
- if (hover === null) {
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
- scheduleHide() {
167
- this.timers.clear(this.hideTimer);
168
- if (this.language.popups.getState().hover === null || this.inCard || this.held) {
169
- return;
170
- }
171
- this.hideTimer = this.timers.set(() => {
172
- if (!this.inCard) {
173
- this.hide();
174
- }
175
- }, HIDE_DELAY_MS);
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
- /* What the servers say at a position: the hover text and the definition, each of which may be missing without the other. */
178
- async ask(position, signal) {
179
- const { service } = this.language.project;
180
- const { uri } = this.language;
181
- if (!service.supports('textDocument/hover', uri)) {
182
- return { info: null, range: null };
183
- }
184
- const [hover, definition] = await Promise.all([
185
- service.hover(uri, position, { signal }).catch(() => null),
186
- service.supports('textDocument/definition', uri) ? service.definition(uri, position, { signal }).catch(() => null) : null
187
- ]);
188
- if (hover === null) {
189
- return { info: null, range: null };
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
- async show(position, request, pinned) {
209
- const problems = this.language.diagnostics.at(position);
210
- this.lookup?.abort();
211
- const controller = new AbortController();
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
- present(position, problems, info, range) {
235
- const subject = range ?? { start: position, end: position };
236
- this.timers.clear(this.hideTimer);
237
- this.language.popups.setState({
238
- hover: {
239
- anchor: subject.start.line === position.line ? subject.start : position,
240
- position,
241
- subject,
242
- problems,
243
- info
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
- /* 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. */
248
- scheduleCount(position, request, signal) {
249
- const key = `${position.line}:${this.wordStart(position)}`;
250
- const known = this.counts.get(key);
251
- if (known !== undefined) {
252
- this.showCount(known, request);
253
- return;
254
- }
255
- this.timers.clear(this.countTimer);
256
- this.countTimer = this.timers.set(() => void this.count(position, key, request, signal), COUNT_DELAY_MS);
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
- /* How many places use the symbol, which can take a while in a large project and so arrives after the card does. */
259
- async count(position, key, request, signal) {
260
- const { service } = this.language.project;
261
- if (request !== this.request || !this.referenceCount || !service.supports('textDocument/references', this.language.uri)) {
262
- return;
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
- showCount(count, request) {
272
- const shown = this.language.popups.getState().hover;
273
- if (request === this.request && shown?.info != null) {
274
- this.language.popups.setState({ hover: { ...shown, info: { ...shown.info, references: count } } });
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
- /* Where the word at a position starts, which names the symbol for the cache. */
278
- wordStart(position) {
279
- const line = lineTextOf(this.language.editor, position.line);
280
- return wordRangeAt(line, position)?.start.character ?? position.character;
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 './EditorView.js';
6
+ export { EditorView } from "./EditorView.js";
7
7
  export { createHolder } from './holder.js';
8
- export { LanguagePopups } from './LanguagePopups.js';
9
- export { AnchoredPopup } from './AnchoredPopup.js';
10
- export { SignatureCard } from './SignatureCard.js';
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 './rendering.js';
13
- export { FindReplace } from './FindReplace.js';
14
- export { ChangeReview } from './ChangeReview.js';
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 './AttributionCard.js';
23
+ export { AttributionCard } from "./AttributionCard.js";
24
24
  export { ReviewGroup, joinReviewGroup } from './review-group.js';
25
- export { DiffView } from './DiffView.js';
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';