@adecore/editor-react 0.62.1 → 0.63.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/README.md +2 -2
- package/dist/AnchoredPopup.d.ts +2 -1
- package/dist/CompletionPopup.js +0 -2
- package/dist/DiffView.d.ts +1 -28
- package/dist/EditorView.js +0 -1
- package/dist/HoverSections.d.ts +1 -8
- package/dist/HoverSections.js +2 -2
- package/dist/LanguagePopups.js +30 -14
- package/dist/PanelResizeHandle.js +0 -1
- package/dist/PeekPanel.js +0 -1
- package/dist/PickPopup.js +0 -1
- package/dist/RenderedDocs.js +0 -2
- package/dist/SplitDiffView.d.ts +1 -1
- package/dist/SymbolPicker.js +0 -1
- package/dist/call-hierarchy-model.js +0 -4
- package/dist/call-hierarchy.d.ts +9 -2
- package/dist/call-hierarchy.js +51 -67
- package/dist/clipboard-history.d.ts +3 -0
- package/dist/clipboard-history.js +0 -1
- package/dist/code-actions-model.js +1 -1
- package/dist/code-actions.d.ts +14 -2
- package/dist/code-actions.js +14 -9
- package/dist/code-authors.js +4 -12
- package/dist/code-vision-model.d.ts +0 -1
- package/dist/code-vision-model.js +1 -2
- package/dist/code-vision.d.ts +11 -3
- package/dist/code-vision.js +13 -18
- package/dist/completion-call.d.ts +1 -1
- package/dist/completion-call.js +2 -1
- package/dist/completion-model.d.ts +5 -4
- package/dist/completion-model.js +4 -4
- package/dist/completion.d.ts +13 -4
- package/dist/completion.js +19 -18
- package/dist/context-menu-rows.d.ts +2 -1
- package/dist/context-menu.d.ts +9 -3
- package/dist/context-menu.js +17 -19
- package/dist/definition-link.d.ts +8 -2
- package/dist/definition-link.js +4 -2
- package/dist/diagnostics-model.d.ts +6 -8
- package/dist/diagnostics-model.js +1 -54
- package/dist/diagnostics.d.ts +9 -7
- package/dist/diagnostics.js +6 -4
- package/dist/diff-view-props.d.ts +28 -0
- package/dist/diff-view-props.js +1 -0
- package/dist/doc-comment-model.js +0 -2
- package/dist/document-colors.d.ts +9 -4
- package/dist/document-colors.js +7 -4
- package/dist/document-links.d.ts +2 -3
- package/dist/document-links.js +2 -3
- package/dist/document-query.d.ts +2 -2
- package/dist/edit-locations.js +4 -22
- package/dist/editor-language.d.ts +12 -7
- package/dist/editor-language.js +54 -45
- package/dist/emmet.d.ts +3 -2
- package/dist/folding.d.ts +2 -4
- package/dist/folding.js +1 -2
- package/dist/format-on-type.d.ts +8 -2
- package/dist/format-on-type.js +8 -6
- package/dist/highlights.d.ts +2 -6
- package/dist/highlights.js +3 -3
- package/dist/history.d.ts +8 -2
- package/dist/history.js +4 -2
- package/dist/host-types.d.ts +39 -22
- package/dist/hover-content.js +0 -1
- package/dist/hover.d.ts +13 -2
- package/dist/hover.js +25 -28
- package/dist/index.d.ts +19 -9
- package/dist/index.js +5 -2
- package/dist/inlay-hints.d.ts +12 -21
- package/dist/inlay-hints.js +16 -15
- package/dist/inline-completion.d.ts +30 -10
- package/dist/inline-completion.js +346 -102
- package/dist/key-priority.d.ts +1 -1
- package/dist/key-priority.js +2 -2
- package/dist/language-context.d.ts +30 -0
- package/dist/language-context.js +1 -0
- package/dist/language-ids.d.ts +0 -1
- package/dist/language-ids.js +0 -32
- package/dist/line-text.js +0 -1
- package/dist/linked-editing.d.ts +2 -4
- package/dist/linked-editing.js +1 -3
- package/dist/live-templates.d.ts +14 -2
- package/dist/live-templates.js +15 -10
- package/dist/locales/en.d.ts +357 -0
- package/dist/locales/en.js +356 -0
- package/dist/locales/nl.d.ts +357 -0
- package/dist/locales/nl.js +356 -0
- package/dist/markup-context.d.ts +7 -6
- package/dist/markup-context.js +0 -1
- package/dist/markup.d.ts +8 -2
- package/dist/markup.js +19 -20
- package/dist/models.d.ts +2 -1
- package/dist/models.js +2 -1
- package/dist/navigation-history.d.ts +7 -0
- package/dist/navigation.d.ts +11 -8
- package/dist/navigation.js +9 -20
- package/dist/panel-size.d.ts +4 -0
- package/dist/paste-history.d.ts +8 -2
- package/dist/paste-history.js +4 -2
- package/dist/patch-layout.d.ts +0 -4
- package/dist/patch-layout.js +1 -1
- package/dist/peek-model.js +0 -1
- package/dist/peek.d.ts +8 -2
- package/dist/peek.js +31 -42
- package/dist/pick.d.ts +4 -2
- package/dist/pick.js +38 -15
- package/dist/popups.d.ts +25 -20
- package/dist/popups.js +31 -15
- package/dist/positions.d.ts +7 -0
- package/dist/positions.js +54 -0
- package/dist/postfix.d.ts +11 -2
- package/dist/postfix.js +10 -6
- package/dist/project-language.d.ts +11 -3
- package/dist/project-language.js +40 -9
- package/dist/project-problems.d.ts +7 -1
- package/dist/project-problems.js +2 -1
- package/dist/rename-model.js +1 -1
- package/dist/rename.d.ts +2 -2
- package/dist/rename.js +17 -22
- package/dist/rendered-docs.d.ts +8 -2
- package/dist/rendered-docs.js +5 -4
- package/dist/selection-ranges.d.ts +2 -2
- package/dist/semantic-tokens.d.ts +2 -4
- package/dist/semantic-tokens.js +2 -2
- package/dist/shortcut-keys.d.ts +2 -1
- package/dist/signature.d.ts +2 -2
- package/dist/signature.js +9 -15
- package/dist/snippet-field-transforms.js +1 -1
- package/dist/snippet-insert.d.ts +4 -2
- package/dist/snippet-insert.js +9 -15
- package/dist/snippet-session.d.ts +9 -4
- package/dist/snippet-session.js +14 -14
- package/dist/snippet-transform-format.d.ts +2 -1
- package/dist/snippet-transform-queue.d.ts +2 -4
- package/dist/snippet-transform-queue.js +5 -37
- package/dist/snippet.d.ts +2 -1
- package/dist/surround-constructs.d.ts +1 -1
- package/dist/surround.d.ts +13 -2
- package/dist/surround.js +15 -8
- package/dist/symbol-links.d.ts +0 -1
- package/dist/symbol-links.js +1 -1
- package/dist/symbol-picker-model.d.ts +0 -1
- package/dist/symbol-picker-model.js +1 -2
- package/dist/symbol-picker.d.ts +2 -2
- package/dist/symbol-picker.js +5 -10
- package/dist/symbols.d.ts +4 -3
- package/dist/template-builtins.d.ts +1 -1
- package/dist/template-builtins.js +0 -1
- package/dist/template-context.d.ts +3 -3
- package/dist/template-context.js +2 -11
- package/dist/template-types.d.ts +20 -0
- package/dist/template-types.js +1 -0
- package/dist/templates.d.ts +5 -20
- package/dist/templates.js +0 -1
- package/dist/testing.d.ts +6 -0
- package/dist/testing.js +42 -0
- package/dist/use-problem-counts.d.ts +1 -1
- package/dist/word-diff.d.ts +1 -1
- package/dist/word-diff.js +16 -25
- package/dist/workspace-edit.d.ts +1 -24
- package/dist/workspace-edit.js +0 -1
- package/package.json +10 -9
- package/src/AnchoredPopup.tsx +1 -1
- package/src/CompletionPopup.tsx +0 -2
- package/src/DiffView.tsx +6 -38
- package/src/EditorView.tsx +0 -1
- package/src/HoverSections.tsx +2 -2
- package/src/LanguagePopups.tsx +20 -14
- package/src/PanelResizeHandle.tsx +0 -1
- package/src/PeekPanel.tsx +0 -1
- package/src/PickPopup.tsx +0 -1
- package/src/RenderedDocs.tsx +0 -2
- package/src/SplitDiffView.tsx +1 -1
- package/src/SymbolPicker.tsx +0 -1
- package/src/call-hierarchy-model.ts +0 -7
- package/src/call-hierarchy.ts +32 -31
- package/src/clipboard-history.ts +5 -2
- package/src/code-actions-model.ts +1 -4
- package/src/code-actions.ts +26 -10
- package/src/code-authors.ts +4 -15
- package/src/code-vision-model.ts +1 -2
- package/src/code-vision.ts +23 -19
- package/src/completion-call.ts +2 -2
- package/src/completion-model.ts +12 -7
- package/src/completion.ts +31 -16
- package/src/context-menu-rows.ts +1 -1
- package/src/context-menu.ts +19 -10
- package/src/definition-link.ts +12 -4
- package/src/diagnostics-model.ts +8 -55
- package/src/diagnostics.ts +11 -20
- package/src/diff-view-props.ts +38 -0
- package/src/doc-comment-model.ts +0 -2
- package/src/document-colors.ts +14 -6
- package/src/document-links.ts +5 -6
- package/src/document-query.ts +3 -3
- package/src/edit-locations.ts +4 -19
- package/src/editor-language.ts +74 -39
- package/src/emmet.ts +2 -3
- package/src/folding.ts +4 -5
- package/src/format-on-type.ts +14 -7
- package/src/highlights.ts +6 -6
- package/src/history.ts +12 -4
- package/src/host-types.ts +52 -33
- package/src/hover-content.ts +0 -1
- package/src/hover.ts +29 -22
- package/src/index.ts +25 -14
- package/src/inlay-hints.ts +23 -17
- package/src/inline-completion.ts +340 -90
- package/src/key-priority.ts +2 -2
- package/src/language-context.ts +60 -0
- package/src/language-ids.ts +0 -34
- package/src/line-text.ts +0 -1
- package/src/linked-editing.ts +4 -6
- package/src/live-templates.ts +27 -13
- package/src/locales/en.ts +356 -0
- package/src/locales/nl.ts +356 -0
- package/src/markup-context.ts +6 -9
- package/src/markup.ts +19 -10
- package/src/models.ts +2 -1
- package/src/navigation-history.ts +11 -0
- package/src/navigation.ts +18 -20
- package/src/panel-size.ts +8 -0
- package/src/paste-history.ts +12 -4
- package/src/patch-layout.ts +1 -1
- package/src/peek-model.ts +0 -1
- package/src/peek.ts +22 -18
- package/src/pick.ts +30 -16
- package/src/popups.ts +61 -40
- package/src/positions.ts +54 -0
- package/src/postfix.ts +21 -8
- package/src/project-language.ts +63 -14
- package/src/project-problems.ts +10 -2
- package/src/proposal-model.ts +0 -1
- package/src/rename-model.ts +1 -1
- package/src/rename.ts +21 -24
- package/src/rendered-docs.ts +13 -6
- package/src/selection-ranges.ts +2 -2
- package/src/semantic-tokens.ts +5 -5
- package/src/shortcut-keys.ts +1 -1
- package/src/signature.ts +8 -8
- package/src/snippet-field-transforms.ts +1 -1
- package/src/snippet-insert.ts +21 -14
- package/src/snippet-session.ts +25 -24
- package/src/snippet-transform-format.ts +1 -1
- package/src/snippet-transform-queue.ts +5 -51
- package/src/snippet.ts +1 -1
- package/src/surround-constructs.ts +1 -1
- package/src/surround.ts +24 -12
- package/src/symbol-links.ts +1 -1
- package/src/symbol-picker-model.ts +1 -4
- package/src/symbol-picker.ts +6 -7
- package/src/symbols.ts +3 -4
- package/src/template-builtins.ts +1 -2
- package/src/template-context.ts +5 -14
- package/src/template-types.ts +43 -0
- package/src/templates.ts +9 -45
- package/src/testing.ts +52 -0
- package/src/use-problem-counts.ts +1 -1
- package/src/word-diff.ts +17 -28
- package/src/workspace-edit.ts +1 -34
- package/dist/locales/en.json +0 -356
- package/dist/locales/nl.json +0 -356
- package/src/locales/en.json +0 -356
- package/src/locales/nl.json +0 -356
package/dist/project-language.js
CHANGED
|
@@ -6,8 +6,9 @@ import { NavigationHistory } from './navigation-history.js';
|
|
|
6
6
|
import { PANEL_BODY_HEIGHT } from './panel-size.js';
|
|
7
7
|
import { relativeTo } from './paths.js';
|
|
8
8
|
import { ProjectProblems, serviceProblems } from './project-problems.js';
|
|
9
|
-
import {
|
|
9
|
+
import { SnippetTransforms } from './snippet-transform-queue.js';
|
|
10
10
|
import { TemplateRegistry } from './templates.js';
|
|
11
|
+
import { realTimers } from './timers.js';
|
|
11
12
|
import { applyWorkspaceEdit } from './workspace-edit.js';
|
|
12
13
|
const UNSERVED = unservedLanguageService();
|
|
13
14
|
/* Sends one editor's edits to the document, holding them until the document is open. */
|
|
@@ -95,6 +96,7 @@ export class ProjectLanguage {
|
|
|
95
96
|
templates;
|
|
96
97
|
holders = new Map();
|
|
97
98
|
files;
|
|
99
|
+
snippetQueue = null;
|
|
98
100
|
/* The body height of the peek and call hierarchy panels, shared by the editors of the project. */
|
|
99
101
|
panelBodyHeight;
|
|
100
102
|
panelListeners = new Set();
|
|
@@ -102,23 +104,32 @@ export class ProjectLanguage {
|
|
|
102
104
|
lastPlace = null;
|
|
103
105
|
disposed = false;
|
|
104
106
|
subscriptions;
|
|
107
|
+
disposers = [];
|
|
105
108
|
/* The result id the server gave each document in its last workspace report, which the next asks with. */
|
|
106
109
|
workspaceResults = new Map();
|
|
107
110
|
constructor(service, host = {}) {
|
|
108
|
-
this.service = service;
|
|
109
111
|
this.host = host;
|
|
110
112
|
this.i18n = host.i18n ?? i18next;
|
|
111
113
|
this.folder = host.folder ?? '';
|
|
112
114
|
this.files = host.files ?? null;
|
|
115
|
+
this.service = typeof service === 'function' ? service(this) : service;
|
|
113
116
|
this.edits = new EditLocations(host.editHistoryLimit);
|
|
114
117
|
this.clipboard = host.clipboard ?? new ClipboardHistory();
|
|
115
118
|
this.templates = host.templates ?? new TemplateRegistry();
|
|
116
119
|
this.panelBodyHeight = host.panelBodyHeight ?? PANEL_BODY_HEIGHT;
|
|
117
|
-
this.problems = new ProjectProblems(host.problemSource ?? serviceProblems(service, uri => this.pathOfLocation(uri) ?? uri));
|
|
118
|
-
const shows = service.onShowDocument?.(params => this.showDocument(params));
|
|
119
|
-
const messages = host.onServerMessage === undefined ? undefined : service.onServerMessage?.(message => host.onServerMessage(message));
|
|
120
|
+
this.problems = new ProjectProblems(host.problemSource ?? serviceProblems(this.service, uri => this.pathOfLocation(uri) ?? uri));
|
|
121
|
+
const shows = this.service.onShowDocument?.(params => this.showDocument(params));
|
|
122
|
+
const messages = host.onServerMessage === undefined ? undefined : this.service.onServerMessage?.(message => host.onServerMessage(message));
|
|
120
123
|
this.subscriptions = [shows, messages].flatMap(subscription => subscription === undefined ? [] : [subscription]);
|
|
121
124
|
}
|
|
125
|
+
/* Runs `dispose` when the project is disposed, after the editors' documents are closed. */
|
|
126
|
+
onDispose(dispose) {
|
|
127
|
+
this.disposers.push(dispose);
|
|
128
|
+
}
|
|
129
|
+
/* The text of the editor that holds a document first, or undefined when no editor holds it. */
|
|
130
|
+
openTextOf(uri) {
|
|
131
|
+
return this.holders.get(uri)?.editors[0]?.getText();
|
|
132
|
+
}
|
|
122
133
|
/* Open panels of other editors of the project follow a resize. */
|
|
123
134
|
onPanelBodyChange(listener) {
|
|
124
135
|
this.panelListeners.add(listener);
|
|
@@ -159,7 +170,6 @@ export class ProjectLanguage {
|
|
|
159
170
|
willCreateFiles(targets) {
|
|
160
171
|
return this.service.willCreateFiles?.(filesOf(targets)) ?? Promise.resolve(null);
|
|
161
172
|
}
|
|
162
|
-
/* Tells the servers that files were made, once they are. */
|
|
163
173
|
didCreateFiles(targets) {
|
|
164
174
|
return this.service.didCreateFiles?.(filesOf(targets)) ?? Promise.resolve();
|
|
165
175
|
}
|
|
@@ -167,7 +177,6 @@ export class ProjectLanguage {
|
|
|
167
177
|
willDeleteFiles(targets) {
|
|
168
178
|
return this.service.willDeleteFiles?.(filesOf(targets)) ?? Promise.resolve(null);
|
|
169
179
|
}
|
|
170
|
-
/* Tells the servers that files were deleted, once they are. */
|
|
171
180
|
didDeleteFiles(targets) {
|
|
172
181
|
const files = filesOf(targets);
|
|
173
182
|
this.edits.forget(uri => files.some(file => file.directory ? uri.startsWith(`${file.uri}/`) : uri === file.uri));
|
|
@@ -178,7 +187,7 @@ export class ProjectLanguage {
|
|
|
178
187
|
* text file. A document of a scheme a server owns, such as a decompiled class, is read from that server.
|
|
179
188
|
*/
|
|
180
189
|
async readText(uri) {
|
|
181
|
-
const open = this.
|
|
190
|
+
const open = this.openTextOf(uri);
|
|
182
191
|
if (open !== undefined) {
|
|
183
192
|
return open;
|
|
184
193
|
}
|
|
@@ -193,6 +202,9 @@ export class ProjectLanguage {
|
|
|
193
202
|
* offers workspace diagnostics. A file the server reports as unchanged keeps what it had. False when no server offers them.
|
|
194
203
|
*/
|
|
195
204
|
async pullWorkspaceProblems(uri, options = {}) {
|
|
205
|
+
if (this.host.pullWorkspaceProblems !== undefined) {
|
|
206
|
+
return this.host.pullWorkspaceProblems(uri, options);
|
|
207
|
+
}
|
|
196
208
|
const {
|
|
197
209
|
service
|
|
198
210
|
} = this;
|
|
@@ -278,6 +290,22 @@ export class ProjectLanguage {
|
|
|
278
290
|
this.pendingCaret = null;
|
|
279
291
|
return pending.position;
|
|
280
292
|
}
|
|
293
|
+
/* A lease on the project's one snippet transform queue, which runs one job at a time for every editor; null when the host brought no worker. The queue keeps the clock of the first editor that asked. */
|
|
294
|
+
acquireSnippetTransforms(timers = realTimers) {
|
|
295
|
+
const factory = this.host.snippetTransformWorker;
|
|
296
|
+
if (factory === undefined) {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
if (this.snippetQueue === null) {
|
|
300
|
+
const queue = new SnippetTransforms(factory, timers, () => {
|
|
301
|
+
if (this.snippetQueue === queue) {
|
|
302
|
+
this.snippetQueue = null;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
this.snippetQueue = queue;
|
|
306
|
+
}
|
|
307
|
+
return this.snippetQueue.acquire();
|
|
308
|
+
}
|
|
281
309
|
/* Whether the editor is the first to hold the document, the one whose changes stand for the document's. */
|
|
282
310
|
holdsFirst(uri, editor) {
|
|
283
311
|
return this.holders.get(uri)?.editors[0] === editor;
|
|
@@ -364,7 +392,7 @@ export class ProjectLanguage {
|
|
|
364
392
|
for (const subscription of this.subscriptions) {
|
|
365
393
|
subscription.dispose();
|
|
366
394
|
}
|
|
367
|
-
|
|
395
|
+
this.snippetQueue?.dispose();
|
|
368
396
|
for (const [uri, holder] of this.holders) {
|
|
369
397
|
if (holder.sync === null) {
|
|
370
398
|
continue;
|
|
@@ -374,5 +402,8 @@ export class ProjectLanguage {
|
|
|
374
402
|
}
|
|
375
403
|
this.holders.clear();
|
|
376
404
|
this.problems.dispose();
|
|
405
|
+
for (const dispose of this.disposers.splice(0).reverse()) {
|
|
406
|
+
dispose();
|
|
407
|
+
}
|
|
377
408
|
}
|
|
378
409
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Diagnostic, LanguageService } from '@adecore/lsp';
|
|
2
|
-
import type { ProblemCounts } from './diagnostics.ts';
|
|
2
|
+
import type { ProblemCounts } from './diagnostics-model.ts';
|
|
3
3
|
export interface ProblemRow {
|
|
4
4
|
readonly diagnostic: Diagnostic;
|
|
5
5
|
readonly server: string;
|
|
@@ -14,6 +14,12 @@ export interface ProblemReport {
|
|
|
14
14
|
readonly server: string;
|
|
15
15
|
readonly diagnostics: readonly Diagnostic[];
|
|
16
16
|
}
|
|
17
|
+
export interface ProblemsHost {
|
|
18
|
+
readonly problemSource?: ProblemSource;
|
|
19
|
+
pullWorkspaceProblems?(uri: string, options: {
|
|
20
|
+
readonly signal?: AbortSignal;
|
|
21
|
+
}): Promise<boolean>;
|
|
22
|
+
}
|
|
17
23
|
export type ProblemSource = (listener: (report: ProblemReport) => void) => () => void;
|
|
18
24
|
export declare function serviceProblems(service: LanguageService, pathOf?: (uri: string) => string): ProblemSource;
|
|
19
25
|
export declare class ProjectProblems {
|
package/dist/project-problems.js
CHANGED
package/dist/rename-model.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isIdentifierCharacter } from './completion-model.js';
|
|
2
|
-
import { rangeHolds } from './
|
|
2
|
+
import { rangeHolds } from './positions.js';
|
|
3
3
|
import { textEntriesOf } from './workspace-edit.js';
|
|
4
4
|
/* The identifier the caret is in or touches; null where there is none. */
|
|
5
5
|
export function wordRangeAt(lineText, position) {
|
package/dist/rename.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LanguageContext } from './language-context.ts';
|
|
2
2
|
export declare class RenameFeature {
|
|
3
3
|
private readonly language;
|
|
4
4
|
private session;
|
|
5
|
-
constructor(language:
|
|
5
|
+
constructor(language: LanguageContext);
|
|
6
6
|
get isOpen(): boolean;
|
|
7
7
|
start(): Promise<void>;
|
|
8
8
|
submit(name: string, preview: boolean): Promise<void>;
|
package/dist/rename.js
CHANGED
|
@@ -139,7 +139,6 @@ export class RenameFeature {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
/* Applies the edit the preview showed. */
|
|
143
142
|
async confirm() {
|
|
144
143
|
const session = this.session;
|
|
145
144
|
if (session?.edit) {
|
|
@@ -154,7 +153,7 @@ export class RenameFeature {
|
|
|
154
153
|
}
|
|
155
154
|
/* The name was changed, which answers the failure under it. */
|
|
156
155
|
edited() {
|
|
157
|
-
if (this.language.popups.
|
|
156
|
+
if (this.language.popups.slot('rename').get()?.error != null) {
|
|
158
157
|
this.publish({
|
|
159
158
|
error: null
|
|
160
159
|
});
|
|
@@ -193,9 +192,7 @@ export class RenameFeature {
|
|
|
193
192
|
editor,
|
|
194
193
|
popups
|
|
195
194
|
} = this.language;
|
|
196
|
-
popups.
|
|
197
|
-
rename: null
|
|
198
|
-
});
|
|
195
|
+
popups.slot('rename').set(null);
|
|
199
196
|
editor.setHighlights([]);
|
|
200
197
|
editor.focus();
|
|
201
198
|
}
|
|
@@ -325,23 +322,21 @@ export class RenameFeature {
|
|
|
325
322
|
const {
|
|
326
323
|
popups
|
|
327
324
|
} = this.language;
|
|
328
|
-
const current = popups.
|
|
329
|
-
popups.
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
...patch
|
|
344
|
-
}
|
|
325
|
+
const current = popups.slot('rename').get();
|
|
326
|
+
popups.slot('rename').set({
|
|
327
|
+
phase: 'input',
|
|
328
|
+
range: session.target.range,
|
|
329
|
+
original: session.original,
|
|
330
|
+
placeholder: session.target.placeholder,
|
|
331
|
+
occurrences: null,
|
|
332
|
+
busy: false,
|
|
333
|
+
error: null,
|
|
334
|
+
name: session.target.placeholder,
|
|
335
|
+
files: [],
|
|
336
|
+
operations: [],
|
|
337
|
+
suggestions: [],
|
|
338
|
+
...current,
|
|
339
|
+
...patch
|
|
345
340
|
});
|
|
346
341
|
}
|
|
347
342
|
tell(kind, title) {
|
package/dist/rendered-docs.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DocComment } from '@adecore/editor';
|
|
2
2
|
import { type ParsedDocComment } from './doc-comment-model.ts';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LanguageContext } from './language-context.ts';
|
|
4
|
+
import type { NavigationFeature } from './navigation.ts';
|
|
4
5
|
import { type Timers } from './timers.ts';
|
|
5
6
|
export interface RenderedDocsSettings {
|
|
6
7
|
readonly renderDocComments: boolean;
|
|
@@ -12,8 +13,12 @@ export interface RenderedDocEntry {
|
|
|
12
13
|
readonly parsed: ParsedDocComment;
|
|
13
14
|
readonly container: HTMLElement;
|
|
14
15
|
}
|
|
16
|
+
interface RenderedDocsPeers {
|
|
17
|
+
readonly navigation: Pick<NavigationFeature, 'goToName'>;
|
|
18
|
+
}
|
|
15
19
|
export declare class RenderedDocsFeature {
|
|
16
20
|
private readonly language;
|
|
21
|
+
private readonly peers;
|
|
17
22
|
private readonly timers;
|
|
18
23
|
private settings;
|
|
19
24
|
private enabled;
|
|
@@ -33,7 +38,7 @@ export declare class RenderedDocsFeature {
|
|
|
33
38
|
private marked;
|
|
34
39
|
private stale;
|
|
35
40
|
private disposed;
|
|
36
|
-
constructor(language:
|
|
41
|
+
constructor(language: LanguageContext, peers: RenderedDocsPeers, timers?: Timers);
|
|
37
42
|
configure(settings: RenderedDocsSettings): void;
|
|
38
43
|
get all(): readonly DocComment[];
|
|
39
44
|
isRendered(comment: DocComment): boolean;
|
|
@@ -65,3 +70,4 @@ export declare class RenderedDocsFeature {
|
|
|
65
70
|
private sweep;
|
|
66
71
|
private bump;
|
|
67
72
|
}
|
|
73
|
+
export {};
|
package/dist/rendered-docs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { findDocComments } from '@adecore/editor';
|
|
2
|
-
import { comparePositions } from './diagnostics-model.js';
|
|
3
2
|
import { parseDocComment } from './doc-comment-model.js';
|
|
4
3
|
import { KEY_PRIORITY } from './key-priority.js';
|
|
5
4
|
import { lineTextOf } from './line-text.js';
|
|
5
|
+
import { comparePositions } from './positions.js';
|
|
6
6
|
import { isShortcut } from './shortcut-keys.js';
|
|
7
7
|
import { realTimers } from './timers.js';
|
|
8
8
|
const OWNER = 'rendered-docs';
|
|
@@ -48,6 +48,7 @@ function samePlace(range, position) {
|
|
|
48
48
|
*/
|
|
49
49
|
export class RenderedDocsFeature {
|
|
50
50
|
language;
|
|
51
|
+
peers;
|
|
51
52
|
timers;
|
|
52
53
|
settings = {
|
|
53
54
|
renderDocComments: false
|
|
@@ -71,8 +72,9 @@ export class RenderedDocsFeature {
|
|
|
71
72
|
/* The comments are from before the last edit, so nothing is decided from them until they are read again. */
|
|
72
73
|
stale = false;
|
|
73
74
|
disposed = false;
|
|
74
|
-
constructor(language, timers = realTimers) {
|
|
75
|
+
constructor(language, peers, timers = realTimers) {
|
|
75
76
|
this.language = language;
|
|
77
|
+
this.peers = peers;
|
|
76
78
|
this.timers = timers;
|
|
77
79
|
const {
|
|
78
80
|
editor
|
|
@@ -196,11 +198,10 @@ export class RenderedDocsFeature {
|
|
|
196
198
|
} = this.language;
|
|
197
199
|
return this.language.service.supports('workspace/symbol', uri);
|
|
198
200
|
}
|
|
199
|
-
/* Goes to what a link in a comment names. */
|
|
200
201
|
follow(name, comment) {
|
|
201
202
|
const member = name.split(/::|[#.\\]/).filter(part => part !== '');
|
|
202
203
|
const target = (member.at(-1) ?? name).replace(/\(\)$/, '');
|
|
203
|
-
void this.
|
|
204
|
+
void this.peers.navigation.goToName(target, startOf(comment), null);
|
|
204
205
|
}
|
|
205
206
|
/* By place in the document, so a row keeps its element when an edit above it moves its lines. */
|
|
206
207
|
idOf(comment) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EditorRange } from '@adecore/editor';
|
|
2
2
|
import type { SelectionRange } from '@adecore/lsp';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LanguageContext } from './language-context.ts';
|
|
4
4
|
export declare function selectionChainOf(selection: SelectionRange): EditorRange[];
|
|
5
5
|
export declare class SelectionRangesFeature {
|
|
6
|
-
constructor(language:
|
|
6
|
+
constructor(language: LanguageContext);
|
|
7
7
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LanguageContext } from './language-context.ts';
|
|
2
2
|
import { type Timers } from './timers.ts';
|
|
3
|
-
export declare const DEFAULT_RANGE_LINES = 5000;
|
|
4
|
-
export declare const DEFAULT_RANGE_CHARACTERS = 500000;
|
|
5
3
|
export interface SemanticTokensOptions {
|
|
6
4
|
rangeLines?: number;
|
|
7
5
|
rangeCharacters?: number;
|
|
@@ -17,7 +15,7 @@ export declare class SemanticTokensFeature {
|
|
|
17
15
|
private covered;
|
|
18
16
|
private drawn;
|
|
19
17
|
private epoch;
|
|
20
|
-
constructor(language:
|
|
18
|
+
constructor(language: LanguageContext, timers?: Timers, options?: SemanticTokensOptions);
|
|
21
19
|
private forget;
|
|
22
20
|
private legend;
|
|
23
21
|
private isLarge;
|
package/dist/semantic-tokens.js
CHANGED
|
@@ -11,8 +11,8 @@ const RANGE = 'textDocument/semanticTokens/range';
|
|
|
11
11
|
const PAUSE_MS = 200;
|
|
12
12
|
const SCROLL_PAUSE_MS = 100;
|
|
13
13
|
/* A document with more lines or characters than this is first asked for what is in view, when the server answers ranges. */
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const DEFAULT_RANGE_LINES = 5000;
|
|
15
|
+
const DEFAULT_RANGE_CHARACTERS = 500_000;
|
|
16
16
|
/*
|
|
17
17
|
* Colors from what the language servers know, over the grammar's guess. It asks after a pause in typing
|
|
18
18
|
* and when a server's offer changed, and keeps drawing the last answer meanwhile so the colors never blink out.
|
package/dist/shortcut-keys.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { KeyChord } from '@adecore/editor';
|
|
2
2
|
import { type Keymap } from '@adecore/editor/keymap';
|
|
3
|
-
|
|
3
|
+
interface LanguageShortcut extends KeyChord {
|
|
4
4
|
readonly apple: boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare function shortcutsOf(keymap: Keymap, apple: boolean): {
|
|
@@ -124,3 +124,4 @@ export declare function shortcutsOf(keymap: Keymap, apple: boolean): {
|
|
|
124
124
|
wrapWithAbbreviation: LanguageShortcut | null;
|
|
125
125
|
};
|
|
126
126
|
export declare function isShortcut(target: LanguageShortcut | null, event: KeyboardEvent): boolean;
|
|
127
|
+
export {};
|
package/dist/signature.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LanguageContext } from './language-context.ts';
|
|
2
2
|
import { type Timers } from './timers.ts';
|
|
3
3
|
export declare class SignatureFeature {
|
|
4
4
|
private readonly language;
|
|
@@ -8,7 +8,7 @@ export declare class SignatureFeature {
|
|
|
8
8
|
private controller;
|
|
9
9
|
private help;
|
|
10
10
|
private anchor;
|
|
11
|
-
constructor(language:
|
|
11
|
+
constructor(language: LanguageContext, timers?: Timers);
|
|
12
12
|
get isOpen(): boolean;
|
|
13
13
|
invoke(): void;
|
|
14
14
|
trigger(): void;
|
package/dist/signature.js
CHANGED
|
@@ -24,7 +24,7 @@ export class SignatureFeature {
|
|
|
24
24
|
editor
|
|
25
25
|
} = language;
|
|
26
26
|
const offs = [editor.onTextChange(change => this.edited(change)), editor.onCaret(() => this.retrigger()), editor.onBlur(() => this.close()), language.onKey(event => {
|
|
27
|
-
if (event.key === 'Escape' && this.isOpen && this.language.popups.
|
|
27
|
+
if (event.key === 'Escape' && this.isOpen && this.language.popups.slot('callHierarchy').get() === null) {
|
|
28
28
|
this.close();
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
@@ -45,7 +45,7 @@ export class SignatureFeature {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
get isOpen() {
|
|
48
|
-
return this.language.popups.
|
|
48
|
+
return this.language.popups.slot('signature').get() !== null;
|
|
49
49
|
}
|
|
50
50
|
/* Asks for the parameters of the call at the caret, as its key does. */
|
|
51
51
|
invoke() {
|
|
@@ -80,11 +80,9 @@ export class SignatureFeature {
|
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
82
|
this.help = next;
|
|
83
|
-
this.language.popups.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
model
|
|
87
|
-
}
|
|
83
|
+
this.language.popups.slot('signature').set({
|
|
84
|
+
anchor: this.anchor,
|
|
85
|
+
model
|
|
88
86
|
});
|
|
89
87
|
return true;
|
|
90
88
|
}
|
|
@@ -95,9 +93,7 @@ export class SignatureFeature {
|
|
|
95
93
|
this.help = null;
|
|
96
94
|
this.anchor = null;
|
|
97
95
|
if (this.isOpen) {
|
|
98
|
-
this.language.popups.
|
|
99
|
-
signature: null
|
|
100
|
-
});
|
|
96
|
+
this.language.popups.slot('signature').set(null);
|
|
101
97
|
}
|
|
102
98
|
}
|
|
103
99
|
options() {
|
|
@@ -186,11 +182,9 @@ export class SignatureFeature {
|
|
|
186
182
|
}
|
|
187
183
|
this.help = help;
|
|
188
184
|
this.anchor ??= caret;
|
|
189
|
-
this.language.popups.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
model
|
|
193
|
-
}
|
|
185
|
+
this.language.popups.slot('signature').set({
|
|
186
|
+
anchor: this.anchor,
|
|
187
|
+
model
|
|
194
188
|
});
|
|
195
189
|
}
|
|
196
190
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { comparePositions, shiftPosition } from './
|
|
1
|
+
import { comparePositions, shiftPosition } from './positions.js';
|
|
2
2
|
/* Each distinct job once, so a transform that several ranges share is computed once; `slotOf` is its index in `jobs`. */
|
|
3
3
|
export function jobTable() {
|
|
4
4
|
const jobs = [];
|
package/dist/snippet-insert.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Editor, EditorRange } from '@adecore/editor';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LanguageContext } from './language-context.ts';
|
|
3
|
+
import { type SnippetFeature } from './snippet-session.ts';
|
|
4
|
+
export type InsertingSnippets = Pick<SnippetFeature, 'applyEdits' | 'beginInstances' | 'isActive' | 'token' | 'transformVariables'>;
|
|
3
5
|
export interface SnippetPlacement {
|
|
4
6
|
readonly range: EditorRange;
|
|
5
7
|
readonly selectedText?: string;
|
|
@@ -7,4 +9,4 @@ export interface SnippetPlacement {
|
|
|
7
9
|
export declare function bodyWithIndentUnit(body: string, unit: string): string;
|
|
8
10
|
export declare function indentUnitOf(editor: Editor): string;
|
|
9
11
|
export declare function dedentLines(text: string, base?: string): string;
|
|
10
|
-
export declare function insertSnippet(language:
|
|
12
|
+
export declare function insertSnippet(language: LanguageContext, snippets: InsertingSnippets, source: string, placements: readonly SnippetPlacement[], extra?: (name: string) => string | undefined): Promise<boolean>;
|
package/dist/snippet-insert.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fileUriToPath } from '@adecore/lsp';
|
|
2
|
-
import { comparePositions, shiftPosition } from './diagnostics-model.js';
|
|
3
2
|
import { lineTextOf, textBeforeOf } from './line-text.js';
|
|
3
|
+
import { comparePositions, shiftPosition } from './positions.js';
|
|
4
4
|
import { wordRangeAt } from './rename-model.js';
|
|
5
5
|
import { jobTable } from './snippet-field-transforms.js';
|
|
6
6
|
import { indentSnippet } from './snippet-indent.js';
|
|
@@ -15,11 +15,9 @@ const MAX_CHARACTERS = 2_000_000;
|
|
|
15
15
|
const MAX_RANGES = 1_000;
|
|
16
16
|
const TOAST_ID = 'language-completion';
|
|
17
17
|
class LimitError extends Error {}
|
|
18
|
-
/* Each line's leading tabs become the editor's own indentation unit. */
|
|
19
18
|
export function bodyWithIndentUnit(body, unit) {
|
|
20
19
|
return unit === '\t' ? body : body.replace(/^\t+/gm, tabs => unit.repeat(tabs.length));
|
|
21
20
|
}
|
|
22
|
-
/* One level of the editor's indentation: spaces for a tab size, or a tab. */
|
|
23
21
|
export function indentUnitOf(editor) {
|
|
24
22
|
const {
|
|
25
23
|
tabSize,
|
|
@@ -42,12 +40,11 @@ function sizeOf(parsed) {
|
|
|
42
40
|
* variables are resolved for each placement (`extra` first, then the host's and the built-in ones), the lines are indented
|
|
43
41
|
* to the text before the placement, and a running session takes the insertion as a nested one. False when nothing was inserted.
|
|
44
42
|
*/
|
|
45
|
-
export async function insertSnippet(language, source, placements, extra) {
|
|
43
|
+
export async function insertSnippet(language, snippets, source, placements, extra) {
|
|
46
44
|
const {
|
|
47
45
|
editor,
|
|
48
46
|
project,
|
|
49
|
-
uri
|
|
50
|
-
snippets
|
|
47
|
+
uri
|
|
51
48
|
} = language;
|
|
52
49
|
if (placements.length === 0 || editor.isReadOnly?.() === true) {
|
|
53
50
|
return false;
|
|
@@ -102,7 +99,7 @@ export async function insertSnippet(language, source, placements, extra) {
|
|
|
102
99
|
throw new LimitError();
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
|
-
await transformVariables(language, template, drafts, current);
|
|
102
|
+
await transformVariables(language, snippets, template, drafts, current);
|
|
106
103
|
if (!current()) {
|
|
107
104
|
return false;
|
|
108
105
|
}
|
|
@@ -119,7 +116,7 @@ export async function insertSnippet(language, source, placements, extra) {
|
|
|
119
116
|
return false;
|
|
120
117
|
}
|
|
121
118
|
off();
|
|
122
|
-
place(language, drafts, starts, continuing && snippets.isActive && snippets.token === token);
|
|
119
|
+
place(language, snippets, drafts, starts, continuing && snippets.isActive && snippets.token === token);
|
|
123
120
|
editor.focus();
|
|
124
121
|
return true;
|
|
125
122
|
} catch (error) {
|
|
@@ -153,11 +150,10 @@ export async function insertSnippet(language, source, placements, extra) {
|
|
|
153
150
|
}
|
|
154
151
|
}
|
|
155
152
|
/* Runs the transforms of variables through the worker, once for all placements, and renders them again with the answers. */
|
|
156
|
-
async function transformVariables(language, template, drafts, current) {
|
|
153
|
+
async function transformVariables(language, snippets, template, drafts, current) {
|
|
157
154
|
const {
|
|
158
155
|
editor,
|
|
159
|
-
project
|
|
160
|
-
snippets
|
|
156
|
+
project
|
|
161
157
|
} = language;
|
|
162
158
|
const {
|
|
163
159
|
jobs,
|
|
@@ -189,11 +185,9 @@ async function transformVariables(language, template, drafts, current) {
|
|
|
189
185
|
draft.parsed = parsed;
|
|
190
186
|
});
|
|
191
187
|
}
|
|
192
|
-
|
|
193
|
-
function place(language, drafts, starts, nested) {
|
|
188
|
+
function place(language, snippets, drafts, starts, nested) {
|
|
194
189
|
const {
|
|
195
|
-
editor
|
|
196
|
-
snippets
|
|
190
|
+
editor
|
|
197
191
|
} = language;
|
|
198
192
|
const primary = drafts.at(-1).parsed;
|
|
199
193
|
if (primary.stops.length > 0) {
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import type { EditorApplyEditsOptions, EditorContentChange, EditorPosition, EditorRange } from '@adecore/editor';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LanguageContext } from './language-context.ts';
|
|
3
|
+
import type { PickFeature } from './pick.ts';
|
|
3
4
|
import { type SnippetTransformJob } from './snippet-transform-protocol.ts';
|
|
4
5
|
import type { SnippetField, SnippetStop } from './snippet.ts';
|
|
5
6
|
import { type Timers } from './timers.ts';
|
|
6
7
|
export declare function positionInInsertion(start: EditorPosition, text: string, offset: number): EditorPosition;
|
|
7
|
-
|
|
8
|
+
interface SnippetInsertion {
|
|
8
9
|
readonly start: EditorPosition;
|
|
9
10
|
readonly text: string;
|
|
10
11
|
readonly stops: readonly SnippetStop[];
|
|
11
12
|
readonly fields?: readonly SnippetField[];
|
|
12
13
|
}
|
|
13
|
-
type SnippetHost = Pick<
|
|
14
|
+
type SnippetHost = Pick<LanguageContext, 'editor' | 'onDispose' | 'popups' | 'onKey'> & Partial<Pick<LanguageContext, 'project'>>;
|
|
15
|
+
interface SnippetPeers {
|
|
16
|
+
readonly pick: Pick<PickFeature, 'close' | 'open'>;
|
|
17
|
+
}
|
|
14
18
|
export declare class SnippetFeature {
|
|
15
19
|
private readonly language;
|
|
20
|
+
private readonly peers;
|
|
16
21
|
private frames;
|
|
17
22
|
private placed;
|
|
18
23
|
private visiting;
|
|
@@ -24,7 +29,7 @@ export declare class SnippetFeature {
|
|
|
24
29
|
private readonly fieldTransforms;
|
|
25
30
|
private exitGeneration;
|
|
26
31
|
private detached;
|
|
27
|
-
constructor(language: SnippetHost, timers?: Timers);
|
|
32
|
+
constructor(language: SnippetHost, peers: SnippetPeers, timers?: Timers);
|
|
28
33
|
transformVariables(jobs: readonly SnippetTransformJob[], current?: () => boolean): Promise<readonly string[] | null>;
|
|
29
34
|
get hasPendingTransforms(): boolean;
|
|
30
35
|
settleTransforms(current: () => boolean, edited?: (changes: readonly EditorContentChange[], map: (range: EditorRange) => EditorRange) => void): Promise<boolean>;
|