@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/inlay-hints.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { followModKey } from './definition-link.js';
|
|
2
|
-
import { comparePositions } from './diagnostics-model.js';
|
|
3
2
|
import { messageOf } from './error-message.js';
|
|
4
3
|
import { hoverTextOf, isEmptyHover } from './hover-content.js';
|
|
5
4
|
import { SHOW_DELAY_MS } from './hover.js';
|
|
6
5
|
import { lineTextOf } from './line-text.js';
|
|
6
|
+
import { comparePositions } from './positions.js';
|
|
7
7
|
import { Refresher } from './refresher.js';
|
|
8
8
|
import { realTimers } from './timers.js';
|
|
9
9
|
const METHOD = 'textDocument/inlayHint';
|
|
@@ -14,14 +14,14 @@ const PAUSE_MS = 300;
|
|
|
14
14
|
const DOUBLE_PRESS_MS = 500;
|
|
15
15
|
/* Lines asked for above and below what is in view, so a little scrolling stays inside what is already drawn. */
|
|
16
16
|
const MARGIN_LINES = 60;
|
|
17
|
-
|
|
17
|
+
function hintLabelOf(hint) {
|
|
18
18
|
return typeof hint.label === 'string' ? hint.label : hint.label.map(part => part.value).join('');
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
function drawableHints(hints) {
|
|
21
21
|
return hints.filter(hint => hintLabelOf(hint) !== '').sort((left, right) => comparePositions(left.position, right.position));
|
|
22
22
|
}
|
|
23
23
|
/* A hint as the editor draws it: a label with parts keeps them apart so each can be pointed at. */
|
|
24
|
-
|
|
24
|
+
function editorHintOf(hint, id) {
|
|
25
25
|
return {
|
|
26
26
|
id,
|
|
27
27
|
position: hint.position,
|
|
@@ -52,7 +52,7 @@ export function covers(asked, visible) {
|
|
|
52
52
|
return asked.start.line <= visible.start.line && asked.end.line >= visible.end.line;
|
|
53
53
|
}
|
|
54
54
|
/* The words of a tooltip: plain text is escaped so it reads as typed, Markdown goes through the hover card's own rendering. */
|
|
55
|
-
|
|
55
|
+
function tooltipTextOf(tooltip) {
|
|
56
56
|
if (tooltip === undefined) {
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
@@ -77,7 +77,7 @@ export function tooltipOf(hint, index) {
|
|
|
77
77
|
return tooltipTextOf(hint.label.find(candidate => candidate.tooltip !== undefined)?.tooltip);
|
|
78
78
|
}
|
|
79
79
|
/* Whether a server could still say more about the hint: nothing in it gives a tooltip, a place or a command yet. */
|
|
80
|
-
|
|
80
|
+
function lacksInfo(hint, index) {
|
|
81
81
|
if (hint.tooltip !== undefined) {
|
|
82
82
|
return false;
|
|
83
83
|
}
|
|
@@ -85,7 +85,7 @@ export function lacksInfo(hint, index) {
|
|
|
85
85
|
return !parts.some(part => part !== undefined && (part.tooltip !== undefined || part.location !== undefined || part.command !== undefined));
|
|
86
86
|
}
|
|
87
87
|
/* Whether the edits fit the text as it is now: positions inside it, each range in order, none overlapping the next. */
|
|
88
|
-
|
|
88
|
+
function editsFit(editor, edits) {
|
|
89
89
|
const end = editor.positionAt(Number.MAX_SAFE_INTEGER);
|
|
90
90
|
const inside = position => Number.isInteger(position.line) && Number.isInteger(position.character) && position.line >= 0 && position.character >= 0 && position.line <= end.line && position.character <= lineTextOf(editor, position.line).length;
|
|
91
91
|
const before = (left, right) => comparePositions(left, right) <= 0;
|
|
@@ -96,7 +96,7 @@ export function editsFit(editor, edits) {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
/* What a press does, from what is known of the hint: a double click inserts it and nothing else, Mod+click follows a part's place, a plain click runs its command. */
|
|
99
|
-
|
|
99
|
+
function actionOf(hint, click) {
|
|
100
100
|
if (click.clicks === 2) {
|
|
101
101
|
return hint.textEdits !== undefined && hint.textEdits.length > 0 ? {
|
|
102
102
|
kind: 'insert',
|
|
@@ -126,9 +126,9 @@ export function actionOf(hint, click) {
|
|
|
126
126
|
*/
|
|
127
127
|
export class InlayHintsFeature {
|
|
128
128
|
language;
|
|
129
|
+
peers;
|
|
129
130
|
timers;
|
|
130
131
|
refresher;
|
|
131
|
-
/* The lines the hints on screen were asked for. */
|
|
132
132
|
asked = null;
|
|
133
133
|
entries = new Map();
|
|
134
134
|
shown = [];
|
|
@@ -144,8 +144,9 @@ export class InlayHintsFeature {
|
|
|
144
144
|
pressCount = 0;
|
|
145
145
|
/* Counts what the pointer does, so a tooltip that was waited for is dropped once the pointer has moved on. */
|
|
146
146
|
request = 0;
|
|
147
|
-
constructor(language, timers = realTimers) {
|
|
147
|
+
constructor(language, peers, timers = realTimers) {
|
|
148
148
|
this.language = language;
|
|
149
|
+
this.peers = peers;
|
|
149
150
|
this.timers = timers;
|
|
150
151
|
const {
|
|
151
152
|
editor,
|
|
@@ -247,7 +248,7 @@ export class InlayHintsFeature {
|
|
|
247
248
|
this.updateLink();
|
|
248
249
|
if (target === null) {
|
|
249
250
|
if (this.cardOpen()) {
|
|
250
|
-
this.
|
|
251
|
+
this.peers.hover.release();
|
|
251
252
|
}
|
|
252
253
|
return;
|
|
253
254
|
}
|
|
@@ -264,12 +265,12 @@ export class InlayHintsFeature {
|
|
|
264
265
|
this.target = null;
|
|
265
266
|
this.updateLink();
|
|
266
267
|
if (this.cardOpen()) {
|
|
267
|
-
this.
|
|
268
|
+
this.peers.hover.hide();
|
|
268
269
|
}
|
|
269
270
|
}
|
|
270
271
|
/* Whether the card up is a tooltip, which is the only kind that has no footer. */
|
|
271
272
|
cardOpen() {
|
|
272
|
-
return this.language.popups.
|
|
273
|
+
return this.language.popups.slot('hover').get()?.info?.plain === true;
|
|
273
274
|
}
|
|
274
275
|
/* The card for a hint or part, once the server has said what it can. Says whether it opened. */
|
|
275
276
|
async showTooltip(target, request, pointer = true) {
|
|
@@ -287,11 +288,11 @@ export class InlayHintsFeature {
|
|
|
287
288
|
const text = tooltipOf(entry.hint, target.part);
|
|
288
289
|
if (text === null) {
|
|
289
290
|
if (this.cardOpen()) {
|
|
290
|
-
this.
|
|
291
|
+
this.peers.hover.hide();
|
|
291
292
|
}
|
|
292
293
|
return false;
|
|
293
294
|
}
|
|
294
|
-
this.
|
|
295
|
+
this.peers.hover.showText(entry.hint.position, text);
|
|
295
296
|
return true;
|
|
296
297
|
}
|
|
297
298
|
/* Asks the server for more of a hint, once; what it says is kept only while the text is the one the hint was made for. */
|
|
@@ -1,39 +1,59 @@
|
|
|
1
1
|
import type { EditorPosition } from '@adecore/editor';
|
|
2
2
|
import type { InlineCompletionItem, InlineCompletionResult, Range } from '@adecore/lsp';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LanguageContext } from './language-context.ts';
|
|
4
4
|
import { type Timers } from './timers.ts';
|
|
5
5
|
export interface InlineSuggestion {
|
|
6
|
-
readonly item: InlineCompletionItem;
|
|
7
6
|
readonly text: string;
|
|
8
7
|
readonly range: Range;
|
|
9
8
|
readonly rest: string;
|
|
9
|
+
readonly item?: InlineCompletionItem;
|
|
10
|
+
readonly accessory?: (container: HTMLElement) => (() => void) | void;
|
|
11
|
+
readonly words?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface InlineSuggestionRequest {
|
|
14
|
+
readonly caret: EditorPosition;
|
|
15
|
+
readonly triggerKind: 1 | 2;
|
|
16
|
+
readonly signal: AbortSignal;
|
|
17
|
+
}
|
|
18
|
+
export interface InlineSuggestionSource {
|
|
19
|
+
readonly enabled: boolean;
|
|
20
|
+
readonly automatic: boolean;
|
|
21
|
+
suggest(request: InlineSuggestionRequest): Promise<readonly InlineSuggestion[]>;
|
|
22
|
+
accepted?(suggestion: InlineSuggestion): void;
|
|
10
23
|
}
|
|
11
24
|
export declare function itemsOf(result: InlineCompletionResult): InlineCompletionItem[];
|
|
12
25
|
export declare function suggestionOf(item: InlineCompletionItem, caret: EditorPosition, textOf: (range: Range) => string): InlineSuggestion | null;
|
|
26
|
+
export declare function firstWord(text: string): string;
|
|
13
27
|
export declare class InlineCompletionFeature {
|
|
14
28
|
private readonly language;
|
|
15
29
|
private readonly timers;
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private timer;
|
|
20
|
-
private controller;
|
|
21
|
-
private revision;
|
|
30
|
+
private readonly servers;
|
|
31
|
+
private readonly sources;
|
|
32
|
+
private phase;
|
|
22
33
|
private accepting;
|
|
23
|
-
constructor(language:
|
|
34
|
+
constructor(language: LanguageContext, timers?: Timers);
|
|
24
35
|
get supported(): boolean;
|
|
25
36
|
get isEnabled(): boolean;
|
|
26
37
|
get current(): InlineSuggestion | null;
|
|
38
|
+
holds(source: InlineSuggestionSource): boolean;
|
|
39
|
+
addSource(source: InlineSuggestionSource, priority?: number): () => void;
|
|
27
40
|
configure(settings: {
|
|
28
41
|
readonly enabled?: boolean;
|
|
29
42
|
}): void;
|
|
30
|
-
|
|
43
|
+
private uses;
|
|
44
|
+
private asks;
|
|
45
|
+
trigger(): boolean;
|
|
46
|
+
triggerSource(source: InlineSuggestionSource): Promise<void>;
|
|
31
47
|
accept(): boolean;
|
|
48
|
+
acceptWord(): boolean;
|
|
32
49
|
cycle(step: 1 | -1): void;
|
|
33
50
|
hide(): void;
|
|
51
|
+
private enter;
|
|
52
|
+
private insert;
|
|
34
53
|
private tab;
|
|
35
54
|
private key;
|
|
36
55
|
private edited;
|
|
56
|
+
private fire;
|
|
37
57
|
private moved;
|
|
38
58
|
private ask;
|
|
39
59
|
private draw;
|