@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/testing.js CHANGED
@@ -1,168 +1,251 @@
1
1
  import { applyContentChanges, ErrorCodes, LspError, StaleResultError } from '@adecore/lsp';
2
2
  export { ManualTimers } from './timers.js';
3
3
  export class FakeLanguageService {
4
- documents = new Map();
5
- calls = [];
6
- providers = new Map();
7
- answers = new Map();
8
- diagnostics = new Set();
9
- changes = new Set();
10
- respond(method, answer, provider = {}) {
11
- this.answers.set(method, answer);
12
- this.providers.set(method, provider);
13
- }
14
- async openDocument(document) {
15
- const held = this.documents.get(document.uri);
16
- this.documents.set(document.uri, { ...document, version: held === undefined ? 1 : held.version + (held.text === document.text ? 0 : 1) });
17
- this.calls.push({ method: 'open', uri: document.uri, params: document, options: {} });
18
- await this.answers.get('open')?.(this.calls.at(-1));
19
- }
20
- async changeDocument(uri, changes) {
21
- const held = this.documents.get(uri);
22
- if (held === undefined) {
23
- throw new LspError('Document is not open', ErrorCodes.ServerNotInitialized);
24
- }
25
- held.text = applyContentChanges(held.text, changes);
26
- held.version++;
27
- this.calls.push({ method: 'change', uri, params: changes, options: {} });
28
- }
29
- async closeDocument(uri) {
30
- this.documents.delete(uri);
31
- this.calls.push({ method: 'close', uri, params: null, options: {} });
32
- }
33
- supports(method, _uri) {
34
- return this.providers.has(method);
35
- }
36
- providerOptions(method, _uri) {
37
- return this.providers.get(method);
38
- }
39
- onProvidersChanged(listener) {
40
- this.changes.add(listener);
41
- return { dispose: () => this.changes.delete(listener) };
42
- }
43
- onDiagnostics(listener) {
44
- this.diagnostics.add(listener);
45
- return { dispose: () => this.diagnostics.delete(listener) };
46
- }
47
- report(report) {
48
- for (const listener of this.diagnostics) {
49
- listener(report);
50
- }
51
- }
52
- refresh(uri) {
53
- for (const listener of this.changes) {
54
- listener(uri);
55
- }
56
- }
57
- async request(method, uri, params, options = {}) {
58
- if (!this.supports(method, uri)) {
59
- throw new LspError(`${method} is unavailable`, ErrorCodes.MethodNotFound);
60
- }
61
- options.signal?.throwIfAborted();
62
- const version = this.documents.get(uri)?.version;
63
- const call = { method, uri, params, options };
64
- this.calls.push(call);
65
- const result = await this.answers.get(method)?.(call);
66
- options.signal?.throwIfAborted();
67
- if (this.documents.get(uri)?.version !== version) {
68
- throw new StaleResultError(uri);
69
- }
70
- return result;
71
- }
72
- completion(uri, position, context, options = {}) {
73
- return this.request('textDocument/completion', uri, { position, context }, options);
74
- }
75
- resolveCompletion(uri, item, options = {}) {
76
- return this.request('completionItem/resolve', uri, item, options);
77
- }
78
- hover(uri, position, options = {}) {
79
- return this.request('textDocument/hover', uri, { position }, options);
80
- }
81
- signatureHelp(uri, position, context, options = {}) {
82
- return this.request('textDocument/signatureHelp', uri, { position, context }, options);
83
- }
84
- definition(uri, position, options = {}) {
85
- return this.request('textDocument/definition', uri, { position }, options);
86
- }
87
- declaration(uri, position, options = {}) {
88
- return this.request('textDocument/declaration', uri, { position }, options);
89
- }
90
- typeDefinition(uri, position, options = {}) {
91
- return this.request('textDocument/typeDefinition', uri, { position }, options);
92
- }
93
- implementation(uri, position, options = {}) {
94
- return this.request('textDocument/implementation', uri, { position }, options);
95
- }
96
- references(uri, position, includeDeclaration, options = {}) {
97
- return this.request('textDocument/references', uri, { position, context: { includeDeclaration } }, options);
98
- }
99
- documentHighlights(uri, position, options = {}) {
100
- return this.request('textDocument/documentHighlight', uri, { position }, options);
101
- }
102
- documentSymbols(uri, options = {}) {
103
- return this.request('textDocument/documentSymbol', uri, {}, options);
104
- }
105
- prepareRename(uri, position, options = {}) {
106
- return this.request('textDocument/prepareRename', uri, { position }, options);
107
- }
108
- rename(uri, position, newName, options = {}) {
109
- return this.request('textDocument/rename', uri, { position, newName }, options);
110
- }
111
- codeActions(uri, range, context, options = {}) {
112
- return this.request('textDocument/codeAction', uri, { range, context }, options);
113
- }
114
- resolveCodeAction(uri, action, options = {}) {
115
- return this.request('codeAction/resolve', uri, action, options);
116
- }
117
- executeCommand(uri, command, options = {}) {
118
- return this.request('workspace/executeCommand', uri, command, options);
119
- }
120
- formatting(uri, formatting, options = {}) {
121
- return this.request('textDocument/formatting', uri, { options: formatting }, options);
122
- }
123
- rangeFormatting(uri, range, formatting, options = {}) {
124
- return this.request('textDocument/rangeFormatting', uri, { range, options: formatting }, options);
125
- }
126
- onTypeFormatting(uri, position, ch, formatting, options = {}) {
127
- return this.request('textDocument/onTypeFormatting', uri, { position, ch, options: formatting }, options);
128
- }
129
- semanticTokens(uri, options = {}) {
130
- return this.request('textDocument/semanticTokens/full', uri, {}, options);
131
- }
132
- semanticTokensDelta(uri, previousResultId, options = {}) {
133
- return this.request('textDocument/semanticTokens/full/delta', uri, { previousResultId }, options);
134
- }
135
- semanticTokensRange(uri, range, options = {}) {
136
- return this.request('textDocument/semanticTokens/range', uri, { range }, options);
137
- }
138
- inlayHints(uri, range, options = {}) {
139
- return this.request('textDocument/inlayHint', uri, { range }, options);
140
- }
141
- resolveInlayHint(uri, hint, options = {}) {
142
- return this.request('inlayHint/resolve', uri, hint, options);
143
- }
144
- workspaceSymbols(uri, query, options = {}) {
145
- return this.request('workspace/symbol', uri, { query }, options);
146
- }
147
- foldingRanges(uri, options = {}) {
148
- return this.request('textDocument/foldingRange', uri, {}, options);
149
- }
150
- selectionRanges(uri, positions, options = {}) {
151
- return this.request('textDocument/selectionRange', uri, { positions }, options);
152
- }
153
- prepareCallHierarchy(uri, position, options = {}) {
154
- return this.request('textDocument/prepareCallHierarchy', uri, { position }, options);
155
- }
156
- incomingCalls(uri, item, options = {}) {
157
- return this.request('callHierarchy/incomingCalls', uri, { item }, options);
158
- }
159
- outgoingCalls(uri, item, options = {}) {
160
- return this.request('callHierarchy/outgoingCalls', uri, { item }, options);
161
- }
162
- codeLenses(uri, options = {}) {
163
- return this.request('textDocument/codeLens', uri, {}, options);
164
- }
165
- resolveCodeLens(uri, lens, options = {}) {
166
- return this.request('codeLens/resolve', uri, lens, options);
167
- }
168
- }
4
+ documents = new Map();
5
+ calls = [];
6
+ providers = new Map();
7
+ answers = new Map();
8
+ diagnostics = new Set();
9
+ changes = new Set();
10
+ respond(method, answer, provider = {}) {
11
+ this.answers.set(method, answer);
12
+ this.providers.set(method, provider);
13
+ }
14
+ async openDocument(document) {
15
+ const held = this.documents.get(document.uri);
16
+ this.documents.set(document.uri, {
17
+ ...document,
18
+ version: held === undefined ? 1 : held.version + (held.text === document.text ? 0 : 1)
19
+ });
20
+ this.calls.push({
21
+ method: 'open',
22
+ uri: document.uri,
23
+ params: document,
24
+ options: {}
25
+ });
26
+ await this.answers.get('open')?.(this.calls.at(-1));
27
+ }
28
+ async changeDocument(uri, changes) {
29
+ const held = this.documents.get(uri);
30
+ if (held === undefined) {
31
+ throw new LspError('Document is not open', ErrorCodes.ServerNotInitialized);
32
+ }
33
+ held.text = applyContentChanges(held.text, changes);
34
+ held.version++;
35
+ this.calls.push({
36
+ method: 'change',
37
+ uri,
38
+ params: changes,
39
+ options: {}
40
+ });
41
+ }
42
+ async closeDocument(uri) {
43
+ this.documents.delete(uri);
44
+ this.calls.push({
45
+ method: 'close',
46
+ uri,
47
+ params: null,
48
+ options: {}
49
+ });
50
+ }
51
+ supports(method, _uri) {
52
+ return this.providers.has(method);
53
+ }
54
+ providerOptions(method, _uri) {
55
+ return this.providers.get(method);
56
+ }
57
+ onProvidersChanged(listener) {
58
+ this.changes.add(listener);
59
+ return {
60
+ dispose: () => this.changes.delete(listener)
61
+ };
62
+ }
63
+ onDiagnostics(listener) {
64
+ this.diagnostics.add(listener);
65
+ return {
66
+ dispose: () => this.diagnostics.delete(listener)
67
+ };
68
+ }
69
+ report(report) {
70
+ for (const listener of this.diagnostics) {
71
+ listener(report);
72
+ }
73
+ }
74
+ refresh(uri) {
75
+ for (const listener of this.changes) {
76
+ listener(uri);
77
+ }
78
+ }
79
+ async request(method, uri, params, options = {}) {
80
+ if (!this.supports(method, uri)) {
81
+ throw new LspError(`${method} is unavailable`, ErrorCodes.MethodNotFound);
82
+ }
83
+ options.signal?.throwIfAborted();
84
+ const version = this.documents.get(uri)?.version;
85
+ const call = {
86
+ method,
87
+ uri,
88
+ params,
89
+ options
90
+ };
91
+ this.calls.push(call);
92
+ const result = await this.answers.get(method)?.(call);
93
+ options.signal?.throwIfAborted();
94
+ if (this.documents.get(uri)?.version !== version) {
95
+ throw new StaleResultError(uri);
96
+ }
97
+ return result;
98
+ }
99
+ completion(uri, position, context, options = {}) {
100
+ return this.request('textDocument/completion', uri, {
101
+ position,
102
+ context
103
+ }, options);
104
+ }
105
+ resolveCompletion(uri, item, options = {}) {
106
+ return this.request('completionItem/resolve', uri, item, options);
107
+ }
108
+ hover(uri, position, options = {}) {
109
+ return this.request('textDocument/hover', uri, {
110
+ position
111
+ }, options);
112
+ }
113
+ signatureHelp(uri, position, context, options = {}) {
114
+ return this.request('textDocument/signatureHelp', uri, {
115
+ position,
116
+ context
117
+ }, options);
118
+ }
119
+ definition(uri, position, options = {}) {
120
+ return this.request('textDocument/definition', uri, {
121
+ position
122
+ }, options);
123
+ }
124
+ declaration(uri, position, options = {}) {
125
+ return this.request('textDocument/declaration', uri, {
126
+ position
127
+ }, options);
128
+ }
129
+ typeDefinition(uri, position, options = {}) {
130
+ return this.request('textDocument/typeDefinition', uri, {
131
+ position
132
+ }, options);
133
+ }
134
+ implementation(uri, position, options = {}) {
135
+ return this.request('textDocument/implementation', uri, {
136
+ position
137
+ }, options);
138
+ }
139
+ references(uri, position, includeDeclaration, options = {}) {
140
+ return this.request('textDocument/references', uri, {
141
+ position,
142
+ context: {
143
+ includeDeclaration
144
+ }
145
+ }, options);
146
+ }
147
+ documentHighlights(uri, position, options = {}) {
148
+ return this.request('textDocument/documentHighlight', uri, {
149
+ position
150
+ }, options);
151
+ }
152
+ documentSymbols(uri, options = {}) {
153
+ return this.request('textDocument/documentSymbol', uri, {}, options);
154
+ }
155
+ prepareRename(uri, position, options = {}) {
156
+ return this.request('textDocument/prepareRename', uri, {
157
+ position
158
+ }, options);
159
+ }
160
+ rename(uri, position, newName, options = {}) {
161
+ return this.request('textDocument/rename', uri, {
162
+ position,
163
+ newName
164
+ }, options);
165
+ }
166
+ codeActions(uri, range, context, options = {}) {
167
+ return this.request('textDocument/codeAction', uri, {
168
+ range,
169
+ context
170
+ }, options);
171
+ }
172
+ resolveCodeAction(uri, action, options = {}) {
173
+ return this.request('codeAction/resolve', uri, action, options);
174
+ }
175
+ executeCommand(uri, command, options = {}) {
176
+ return this.request('workspace/executeCommand', uri, command, options);
177
+ }
178
+ formatting(uri, formatting, options = {}) {
179
+ return this.request('textDocument/formatting', uri, {
180
+ options: formatting
181
+ }, options);
182
+ }
183
+ rangeFormatting(uri, range, formatting, options = {}) {
184
+ return this.request('textDocument/rangeFormatting', uri, {
185
+ range,
186
+ options: formatting
187
+ }, options);
188
+ }
189
+ onTypeFormatting(uri, position, ch, formatting, options = {}) {
190
+ return this.request('textDocument/onTypeFormatting', uri, {
191
+ position,
192
+ ch,
193
+ options: formatting
194
+ }, options);
195
+ }
196
+ semanticTokens(uri, options = {}) {
197
+ return this.request('textDocument/semanticTokens/full', uri, {}, options);
198
+ }
199
+ semanticTokensDelta(uri, previousResultId, options = {}) {
200
+ return this.request('textDocument/semanticTokens/full/delta', uri, {
201
+ previousResultId
202
+ }, options);
203
+ }
204
+ semanticTokensRange(uri, range, options = {}) {
205
+ return this.request('textDocument/semanticTokens/range', uri, {
206
+ range
207
+ }, options);
208
+ }
209
+ inlayHints(uri, range, options = {}) {
210
+ return this.request('textDocument/inlayHint', uri, {
211
+ range
212
+ }, options);
213
+ }
214
+ resolveInlayHint(uri, hint, options = {}) {
215
+ return this.request('inlayHint/resolve', uri, hint, options);
216
+ }
217
+ workspaceSymbols(uri, query, options = {}) {
218
+ return this.request('workspace/symbol', uri, {
219
+ query
220
+ }, options);
221
+ }
222
+ foldingRanges(uri, options = {}) {
223
+ return this.request('textDocument/foldingRange', uri, {}, options);
224
+ }
225
+ selectionRanges(uri, positions, options = {}) {
226
+ return this.request('textDocument/selectionRange', uri, {
227
+ positions
228
+ }, options);
229
+ }
230
+ prepareCallHierarchy(uri, position, options = {}) {
231
+ return this.request('textDocument/prepareCallHierarchy', uri, {
232
+ position
233
+ }, options);
234
+ }
235
+ incomingCalls(uri, item, options = {}) {
236
+ return this.request('callHierarchy/incomingCalls', uri, {
237
+ item
238
+ }, options);
239
+ }
240
+ outgoingCalls(uri, item, options = {}) {
241
+ return this.request('callHierarchy/outgoingCalls', uri, {
242
+ item
243
+ }, options);
244
+ }
245
+ codeLenses(uri, options = {}) {
246
+ return this.request('textDocument/codeLens', uri, {}, options);
247
+ }
248
+ resolveCodeLens(uri, lens, options = {}) {
249
+ return this.request('codeLens/resolve', uri, lens, options);
250
+ }
251
+ }
package/dist/timers.js CHANGED
@@ -1,38 +1,43 @@
1
1
  export const realTimers = {
2
- set: (callback, delay) => setTimeout(callback, delay),
3
- clear: (handle) => clearTimeout(handle)
2
+ set: (callback, delay) => setTimeout(callback, delay),
3
+ clear: handle => clearTimeout(handle)
4
4
  };
5
5
  /* Runs what was scheduled when a test says how much time has passed. */
6
6
  export class ManualTimers {
7
- now = 0;
8
- next = 1;
9
- pending = new Map();
10
- set(callback, delay) {
11
- const id = this.next++;
12
- this.pending.set(id, { at: this.now + delay, callback });
13
- return id;
14
- }
15
- clear(handle) {
16
- this.pending.delete(handle);
17
- }
18
- advance(milliseconds) {
19
- const until = this.now + milliseconds;
20
- for (;;) {
21
- const due = [...this.pending].filter(([, entry]) => entry.at <= until).sort((left, right) => left[1].at - right[1].at)[0];
22
- if (due === undefined) {
23
- break;
24
- }
25
- this.now = due[1].at;
26
- this.pending.delete(due[0]);
27
- due[1].callback();
28
- }
29
- this.now = until;
30
- }
31
- get size() {
32
- return this.pending.size;
7
+ now = 0;
8
+ next = 1;
9
+ pending = new Map();
10
+ set(callback, delay) {
11
+ const id = this.next++;
12
+ this.pending.set(id, {
13
+ at: this.now + delay,
14
+ callback
15
+ });
16
+ return id;
17
+ }
18
+ clear(handle) {
19
+ this.pending.delete(handle);
20
+ }
21
+ advance(milliseconds) {
22
+ const until = this.now + milliseconds;
23
+ for (;;) {
24
+ const due = [...this.pending].filter(([, entry]) => entry.at <= until).sort((left, right) => left[1].at - right[1].at)[0];
25
+ if (due === undefined) {
26
+ break;
27
+ }
28
+ this.now = due[1].at;
29
+ this.pending.delete(due[0]);
30
+ due[1].callback();
33
31
  }
32
+ this.now = until;
33
+ }
34
+ get size() {
35
+ return this.pending.size;
36
+ }
34
37
  }
35
38
  /* Scrolls a row the editor opened under the caret line into view, which may sit at the bottom of the view with the row below the fold. The element is in the page a turn later. */
36
39
  export function revealRow(timers, container) {
37
- timers.set(() => container.scrollIntoView?.({ block: 'nearest' }), 0);
38
- }
40
+ timers.set(() => container.scrollIntoView?.({
41
+ block: 'nearest'
42
+ }), 0);
43
+ }
@@ -1,13 +1,54 @@
1
+ import { c as _c } from "react/compiler-runtime";
1
2
  import { useEffect, useState } from 'react';
2
3
  import { clampPanelBody } from './panel-size.js';
3
4
  /* The body height of a panel, from the project that remembers it for the next one; `commit` hands it to the host. */
4
5
  export function usePanelBody(language) {
5
- const { project } = language;
6
- const [height, set] = useState(() => clampPanelBody(project.panelBodyHeight));
7
- useEffect(() => project.onPanelBodyChange((value) => set(clampPanelBody(value))), [project]);
8
- return {
9
- height,
10
- set,
11
- commit: (value) => project.resizePanelBody(value)
6
+ const $ = _c(10);
7
+ const {
8
+ project
9
+ } = language;
10
+ let t0;
11
+ if ($[0] !== project.panelBodyHeight) {
12
+ t0 = () => clampPanelBody(project.panelBodyHeight);
13
+ $[0] = project.panelBodyHeight;
14
+ $[1] = t0;
15
+ } else {
16
+ t0 = $[1];
17
+ }
18
+ const [height, set] = useState(t0);
19
+ let t1;
20
+ let t2;
21
+ if ($[2] !== project) {
22
+ t1 = () => project.onPanelBodyChange(value => set(clampPanelBody(value)));
23
+ t2 = [project];
24
+ $[2] = project;
25
+ $[3] = t1;
26
+ $[4] = t2;
27
+ } else {
28
+ t1 = $[3];
29
+ t2 = $[4];
30
+ }
31
+ useEffect(t1, t2);
32
+ let t3;
33
+ if ($[5] !== project) {
34
+ t3 = value_0 => project.resizePanelBody(value_0);
35
+ $[5] = project;
36
+ $[6] = t3;
37
+ } else {
38
+ t3 = $[6];
39
+ }
40
+ let t4;
41
+ if ($[7] !== height || $[8] !== t3) {
42
+ t4 = {
43
+ height,
44
+ set,
45
+ commit: t3
12
46
  };
13
- }
47
+ $[7] = height;
48
+ $[8] = t3;
49
+ $[9] = t4;
50
+ } else {
51
+ t4 = $[9];
52
+ }
53
+ return t4;
54
+ }
@@ -1,20 +1,34 @@
1
+ import { c as _c } from "react/compiler-runtime";
1
2
  import { useMemo, useSyncExternalStore } from 'react';
2
- const NONE = { error: 0, warning: 0, info: 0 };
3
+ const NONE = {
4
+ error: 0,
5
+ warning: 0,
6
+ info: 0
7
+ };
3
8
  function countsStore(language) {
4
- let current = language?.diagnostics.counts() ?? NONE;
5
- return {
6
- get: () => {
7
- const next = language?.diagnostics.counts() ?? NONE;
8
- if (next.error !== current.error || next.warning !== current.warning || next.info !== current.info) {
9
- current = next;
10
- }
11
- return current;
12
- },
13
- subscribe: (listener) => language?.diagnostics.onChange(listener) ?? (() => undefined)
14
- };
9
+ let current = language?.diagnostics.counts() ?? NONE;
10
+ return {
11
+ get: () => {
12
+ const next = language?.diagnostics.counts() ?? NONE;
13
+ if (next.error !== current.error || next.warning !== current.warning || next.info !== current.info) {
14
+ current = next;
15
+ }
16
+ return current;
17
+ },
18
+ subscribe: listener => language?.diagnostics.onChange(listener) ?? (() => undefined)
19
+ };
15
20
  }
16
21
  /* How many errors, warnings and infos the file has, said again when the servers report. */
17
22
  export function useProblemCounts(language) {
18
- const store = useMemo(() => countsStore(language), [language]);
19
- return useSyncExternalStore(store.subscribe, store.get);
20
- }
23
+ const $ = _c(2);
24
+ let t0;
25
+ if ($[0] !== language) {
26
+ t0 = countsStore(language);
27
+ $[0] = language;
28
+ $[1] = t0;
29
+ } else {
30
+ t0 = $[1];
31
+ }
32
+ const store = t0;
33
+ return useSyncExternalStore(store.subscribe, store.get);
34
+ }