@adecore/editor-react 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnchoredPopup.d.ts +2 -1
- package/dist/AnchoredPopup.js +2 -2
- package/dist/CallHierarchyPanel.js +6 -2
- package/dist/CodeAuthorsCard.d.ts +4 -0
- package/dist/CodeAuthorsCard.js +8 -4
- package/dist/CompletionPopup.js +7 -3
- package/dist/EditorView.d.ts +8 -3
- package/dist/EditorView.js +79 -9
- package/dist/HoverCard.d.ts +3 -1
- package/dist/HoverCard.js +2 -2
- package/dist/LanguagePopups.d.ts +8 -4
- package/dist/LanguagePopups.js +4 -4
- package/dist/PanelResizeHandle.d.ts +8 -0
- package/dist/PanelResizeHandle.js +71 -0
- package/dist/PeekPanel.js +6 -2
- package/dist/PickPopup.js +2 -1
- package/dist/RenameCard.js +10 -8
- package/dist/RenderedDocs.d.ts +10 -4
- package/dist/RenderedDocs.js +10 -6
- package/dist/call-hierarchy-model.js +3 -9
- package/dist/call-hierarchy.js +17 -17
- package/dist/code-actions.js +5 -2
- package/dist/completion-model.js +3 -1
- package/dist/completion.d.ts +4 -2
- package/dist/completion.js +49 -27
- package/dist/diagnostics-model.d.ts +1 -0
- package/dist/diagnostics-model.js +1 -1
- package/dist/diagnostics.d.ts +1 -0
- package/dist/diagnostics.js +28 -10
- package/dist/diff-overlays.js +2 -2
- package/dist/editor-language.d.ts +3 -1
- package/dist/editor-language.js +11 -1
- package/dist/format-on-type.js +2 -3
- package/dist/highlights.js +3 -2
- package/dist/history.js +3 -2
- package/dist/holder.d.ts +3 -3
- package/dist/holder.js +2 -1
- package/dist/host-types.d.ts +5 -0
- package/dist/hover.d.ts +5 -0
- package/dist/hover.js +13 -5
- package/dist/index.d.ts +6 -2
- package/dist/index.js +3 -1
- package/dist/key-priority.d.ts +23 -0
- package/dist/key-priority.js +39 -0
- package/dist/locales/en.json +5 -1
- package/dist/locales/nl.json +5 -1
- package/dist/models.d.ts +2 -2
- package/dist/models.js +2 -2
- package/dist/navigation.js +3 -2
- package/dist/panel-size.d.ts +6 -0
- package/dist/panel-size.js +25 -0
- package/dist/peek.d.ts +3 -1
- package/dist/peek.js +8 -3
- package/dist/pick.js +2 -1
- package/dist/popup-focus.d.ts +5 -0
- package/dist/popup-focus.js +12 -0
- package/dist/popups.d.ts +1 -1
- package/dist/project-language.d.ts +4 -0
- package/dist/project-language.js +23 -4
- package/dist/project-problems.d.ts +10 -1
- package/dist/project-problems.js +34 -10
- package/dist/proposal-model.d.ts +0 -1
- package/dist/proposal-model.js +0 -8
- package/dist/rename-model.d.ts +2 -1
- package/dist/rename-model.js +57 -0
- package/dist/rename.d.ts +1 -0
- package/dist/rename.js +21 -5
- package/dist/rendered-docs.d.ts +2 -0
- package/dist/rendered-docs.js +15 -8
- package/dist/signature.js +4 -3
- package/dist/snippet-session.d.ts +1 -1
- package/dist/snippet-session.js +8 -2
- package/dist/symbol-picker.js +3 -2
- package/dist/timers.d.ts +1 -0
- package/dist/timers.js +4 -0
- package/dist/use-panel-body.d.ts +6 -0
- package/dist/use-panel-body.js +13 -0
- package/package.json +6 -6
- package/src/AnchoredPopup.tsx +4 -2
- package/src/CallHierarchyPanel.tsx +9 -3
- package/src/CodeAuthorsCard.tsx +21 -12
- package/src/CompletionPopup.tsx +11 -1
- package/src/EditorView.tsx +122 -11
- package/src/HoverCard.tsx +6 -1
- package/src/LanguagePopups.tsx +23 -4
- package/src/PanelResizeHandle.tsx +104 -0
- package/src/PeekPanel.tsx +9 -3
- package/src/PickPopup.tsx +9 -1
- package/src/RenameCard.tsx +15 -9
- package/src/RenderedDocs.tsx +30 -8
- package/src/call-hierarchy-model.ts +15 -22
- package/src/call-hierarchy.ts +17 -17
- package/src/code-actions.ts +5 -2
- package/src/completion-model.ts +3 -1
- package/src/completion.ts +48 -28
- package/src/diagnostics-model.ts +1 -1
- package/src/diagnostics.ts +29 -13
- package/src/diff-overlays.tsx +12 -8
- package/src/editor-language.ts +13 -2
- package/src/format-on-type.ts +2 -3
- package/src/highlights.ts +3 -2
- package/src/history.ts +3 -2
- package/src/holder.ts +5 -4
- package/src/host-types.ts +9 -0
- package/src/hover.ts +19 -5
- package/src/index.ts +6 -2
- package/src/key-priority.ts +49 -0
- package/src/locales/en.json +5 -1
- package/src/locales/nl.json +5 -1
- package/src/models.ts +1 -1
- package/src/navigation.ts +3 -2
- package/src/panel-size.ts +28 -0
- package/src/peek.ts +8 -3
- package/src/pick.ts +2 -1
- package/src/popup-focus.ts +17 -0
- package/src/popups.ts +1 -2
- package/src/project-language.ts +25 -4
- package/src/project-problems.ts +46 -11
- package/src/proposal-model.ts +0 -9
- package/src/rename-model.ts +60 -1
- package/src/rename.ts +21 -5
- package/src/rendered-docs.ts +17 -8
- package/src/signature.ts +4 -3
- package/src/snippet-session.ts +9 -3
- package/src/symbol-picker.ts +3 -2
- package/src/timers.ts +5 -0
- package/src/use-panel-body.ts +17 -0
- package/dist/relative-time.d.ts +0 -1
- package/dist/relative-time.js +0 -9
- package/src/relative-time.ts +0 -10
package/dist/editor-language.js
CHANGED
|
@@ -11,6 +11,7 @@ import { FormatOnTypeFeature } from './format-on-type.js';
|
|
|
11
11
|
import { HighlightsFeature } from './highlights.js';
|
|
12
12
|
import { HistoryFeature } from './history.js';
|
|
13
13
|
import { HoverFeature } from './hover.js';
|
|
14
|
+
import { KeyDispatcher } from './key-priority.js';
|
|
14
15
|
import { NavigationFeature, locationRow } from './navigation.js';
|
|
15
16
|
import { PeekFeature } from './peek.js';
|
|
16
17
|
import { PickFeature } from './pick.js';
|
|
@@ -62,6 +63,7 @@ export class EditorLanguage {
|
|
|
62
63
|
formatOnType;
|
|
63
64
|
renderedDocs;
|
|
64
65
|
disposers = [];
|
|
66
|
+
keys = new KeyDispatcher();
|
|
65
67
|
disposed = false;
|
|
66
68
|
constructor(project, editor, uri, languageId, timers = realTimers, options = {}) {
|
|
67
69
|
this.editor = editor;
|
|
@@ -71,6 +73,7 @@ export class EditorLanguage {
|
|
|
71
73
|
this.project = project;
|
|
72
74
|
this.languageId = languageId;
|
|
73
75
|
this.document = project.acquire(uri, languageId, editor);
|
|
76
|
+
this.onDispose(editor.onKeyDown((event) => this.keys.dispatch(event)));
|
|
74
77
|
this.pick = new PickFeature(this, timers);
|
|
75
78
|
this.diagnostics = new DiagnosticsFeature(this);
|
|
76
79
|
this.hover = new HoverFeature(this, timers);
|
|
@@ -85,7 +88,7 @@ export class EditorLanguage {
|
|
|
85
88
|
this.codeActions = new CodeActionsFeature(this, timers);
|
|
86
89
|
this.rename = new RenameFeature(this);
|
|
87
90
|
this.navigation = new NavigationFeature(this);
|
|
88
|
-
this.peek = new PeekFeature(this);
|
|
91
|
+
this.peek = new PeekFeature(this, timers);
|
|
89
92
|
this.callHierarchy = new CallHierarchyFeature(this, timers);
|
|
90
93
|
this.symbolPicker = new SymbolPickerFeature(this);
|
|
91
94
|
this.contextMenu = new ContextMenuFeature(this);
|
|
@@ -154,6 +157,13 @@ export class EditorLanguage {
|
|
|
154
157
|
providers.dispose();
|
|
155
158
|
};
|
|
156
159
|
}
|
|
160
|
+
/*
|
|
161
|
+
* Lets `handler` see the editor's keys before every handler of a lower `priority`, the first to take a key
|
|
162
|
+
* winning. `KEY_PRIORITY` holds the features'; the default, 0, comes after all of them.
|
|
163
|
+
*/
|
|
164
|
+
onKey(handler, priority = 0) {
|
|
165
|
+
return this.keys.add(handler, priority);
|
|
166
|
+
}
|
|
157
167
|
/* Runs `dispose` when the editor lets go of its document. */
|
|
158
168
|
onDispose(dispose) {
|
|
159
169
|
this.disposers.push(dispose);
|
package/dist/format-on-type.js
CHANGED
|
@@ -20,12 +20,11 @@ function overlaps(edits) {
|
|
|
20
20
|
* second caret, a read-only editor or a snippet session, whose tab stops an edit could move. An answer is applied
|
|
21
21
|
* only while the text is exactly what it was asked about, and the caret where it was.
|
|
22
22
|
*
|
|
23
|
-
* The edits join the undo step of the typed character, so one undo takes both back.
|
|
24
|
-
* turns it off for a host that has a setting for it.
|
|
23
|
+
* The edits join the undo step of the typed character, so one undo takes both back. Off by default; a host enables it explicitly with `configure(true)`.
|
|
25
24
|
*/
|
|
26
25
|
export class FormatOnTypeFeature {
|
|
27
26
|
language;
|
|
28
|
-
enabled =
|
|
27
|
+
enabled = false;
|
|
29
28
|
/* Raised by every change of the text, so an answer for an older text is told from the one for the text that is. */
|
|
30
29
|
revision = 0;
|
|
31
30
|
controller = new AbortController();
|
package/dist/highlights.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KEY_PRIORITY } from './key-priority.js';
|
|
1
2
|
import { comparePositions, rangeHolds } from './diagnostics-model.js';
|
|
2
3
|
import { isIdentifierCharacter } from './completion-model.js';
|
|
3
4
|
import { Refresher } from './refresher.js';
|
|
@@ -57,13 +58,13 @@ export class HighlightsFeature {
|
|
|
57
58
|
this.current = [];
|
|
58
59
|
this.refresher.later();
|
|
59
60
|
}),
|
|
60
|
-
|
|
61
|
+
language.onKey((event) => {
|
|
61
62
|
const next = isShortcut(this.language.shortcuts.nextHighlight, event);
|
|
62
63
|
if (!next && !isShortcut(this.language.shortcuts.previousHighlight, event)) {
|
|
63
64
|
return false;
|
|
64
65
|
}
|
|
65
66
|
return this.step(next ? 1 : -1);
|
|
66
|
-
})
|
|
67
|
+
}, KEY_PRIORITY.highlights)
|
|
67
68
|
];
|
|
68
69
|
language.onDispose(() => {
|
|
69
70
|
for (const off of offs) {
|
package/dist/history.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { KEY_PRIORITY } from './key-priority.js';
|
|
1
2
|
import { isShortcut } from './shortcut-keys.js';
|
|
2
3
|
/* Back, Forward and the list of recent locations over the history the whole project shares. */
|
|
3
4
|
export class HistoryFeature {
|
|
4
5
|
language;
|
|
5
6
|
constructor(language) {
|
|
6
7
|
this.language = language;
|
|
7
|
-
const off = language.
|
|
8
|
+
const off = language.onKey((event) => {
|
|
8
9
|
if (isShortcut(this.language.shortcuts.historyBack, event)) {
|
|
9
10
|
this.back();
|
|
10
11
|
return true;
|
|
@@ -18,7 +19,7 @@ export class HistoryFeature {
|
|
|
18
19
|
return true;
|
|
19
20
|
}
|
|
20
21
|
return false;
|
|
21
|
-
});
|
|
22
|
+
}, KEY_PRIORITY.history);
|
|
22
23
|
language.onDispose(off);
|
|
23
24
|
}
|
|
24
25
|
/* Returns to where the caret was before the last jump; false when there is no such place. */
|
package/dist/holder.d.ts
CHANGED
package/dist/holder.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* One value that an effect sets and a render reads through `useSyncExternalStore`, without a state update inside the effect. */
|
|
1
2
|
export function createHolder() {
|
|
2
3
|
let value = null;
|
|
3
4
|
const listeners = new Set();
|
|
@@ -5,7 +6,7 @@ export function createHolder() {
|
|
|
5
6
|
get: () => value,
|
|
6
7
|
set: (next) => {
|
|
7
8
|
value = next;
|
|
8
|
-
for (const listener of listeners) {
|
|
9
|
+
for (const listener of [...listeners]) {
|
|
9
10
|
listener();
|
|
10
11
|
}
|
|
11
12
|
},
|
package/dist/host-types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { i18n } from 'i18next';
|
|
|
4
4
|
import type { Keymap } from '@adecore/editor/keymap';
|
|
5
5
|
import type { ProjectFiles } from './workspace-edit.ts';
|
|
6
6
|
import type { Place } from './navigation-history.ts';
|
|
7
|
+
import type { ProblemSource } from './project-problems.ts';
|
|
7
8
|
export interface DiskText {
|
|
8
9
|
text: string;
|
|
9
10
|
mtime: number;
|
|
@@ -30,6 +31,7 @@ export interface RenameSuggestionsRequest {
|
|
|
30
31
|
uri: string;
|
|
31
32
|
languageId: string;
|
|
32
33
|
name: string;
|
|
34
|
+
kind?: string;
|
|
33
35
|
context: string;
|
|
34
36
|
uses: readonly string[];
|
|
35
37
|
}
|
|
@@ -53,6 +55,9 @@ export interface LanguageHost {
|
|
|
53
55
|
readonly files?: ProjectFiles;
|
|
54
56
|
readonly apple?: boolean;
|
|
55
57
|
readonly keymap?: Keymap;
|
|
58
|
+
readonly panelBodyHeight?: number;
|
|
59
|
+
onPanelResize?(height: number): void;
|
|
60
|
+
readonly problemSource?: ProblemSource;
|
|
56
61
|
openPlace?(place: Place): void;
|
|
57
62
|
pathOfUri?(uri: string): string | null;
|
|
58
63
|
serverNames?(uri: string): readonly string[];
|
package/dist/hover.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import type { EditorLanguage } from './editor-language.ts';
|
|
|
3
3
|
import { type HoverText } from './hover-content.ts';
|
|
4
4
|
import { type Timers } from './timers.ts';
|
|
5
5
|
export declare const SHOW_DELAY_MS = 300;
|
|
6
|
+
export interface HoverSettings {
|
|
7
|
+
readonly referenceCount?: boolean;
|
|
8
|
+
}
|
|
6
9
|
export declare class HoverFeature {
|
|
7
10
|
private readonly language;
|
|
8
11
|
private readonly timers;
|
|
@@ -11,11 +14,13 @@ export declare class HoverFeature {
|
|
|
11
14
|
private hideTimer;
|
|
12
15
|
private countTimer;
|
|
13
16
|
private inCard;
|
|
17
|
+
private referenceCount;
|
|
14
18
|
private request;
|
|
15
19
|
private lookup;
|
|
16
20
|
private pinned;
|
|
17
21
|
private held;
|
|
18
22
|
constructor(language: EditorLanguage, timers?: Timers);
|
|
23
|
+
configure(settings: HoverSettings): void;
|
|
19
24
|
holdCard(inside: boolean): void;
|
|
20
25
|
quickInfo(): void;
|
|
21
26
|
showProblemsAt(position: EditorPosition): boolean;
|
package/dist/hover.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KEY_PRIORITY } from './key-priority.js';
|
|
1
2
|
import { rangeHolds } from './diagnostics-model.js';
|
|
2
3
|
import { hoverTextOf, isEmptyHover, locationsOf } from './hover-content.js';
|
|
3
4
|
import { lineTextOf } from './line-text.js';
|
|
@@ -23,6 +24,7 @@ export class HoverFeature {
|
|
|
23
24
|
hideTimer;
|
|
24
25
|
countTimer;
|
|
25
26
|
inCard = false;
|
|
27
|
+
referenceCount = true;
|
|
26
28
|
/* Counts every request, so an answer that arrives after the pointer moved on is dropped. */
|
|
27
29
|
request = 0;
|
|
28
30
|
lookup = null;
|
|
@@ -56,17 +58,17 @@ export class HoverFeature {
|
|
|
56
58
|
this.hide();
|
|
57
59
|
}
|
|
58
60
|
}),
|
|
59
|
-
|
|
61
|
+
language.onKey((event) => {
|
|
60
62
|
if (isShortcut(this.language.shortcuts.quickInfo, event)) {
|
|
61
63
|
this.quickInfo();
|
|
62
64
|
return true;
|
|
63
65
|
}
|
|
64
|
-
if (event.key === 'Escape' && this.language.popups.getState().hover !== null && this.language.popups.getState().callHierarchy
|
|
66
|
+
if (event.key === 'Escape' && this.language.popups.getState().hover !== null && this.language.popups.getState().callHierarchy === null) {
|
|
65
67
|
this.hide();
|
|
66
68
|
return true;
|
|
67
69
|
}
|
|
68
70
|
return false;
|
|
69
|
-
})
|
|
71
|
+
}, KEY_PRIORITY.hover)
|
|
70
72
|
];
|
|
71
73
|
language.onDispose(() => {
|
|
72
74
|
for (const off of offs) {
|
|
@@ -75,6 +77,12 @@ export class HoverFeature {
|
|
|
75
77
|
this.hide();
|
|
76
78
|
});
|
|
77
79
|
}
|
|
80
|
+
configure(settings) {
|
|
81
|
+
this.referenceCount = settings.referenceCount !== false;
|
|
82
|
+
if (!this.referenceCount) {
|
|
83
|
+
this.timers.clear(this.countTimer);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
78
86
|
/* The pointer entered or left the card, which is where a link in it is clicked. */
|
|
79
87
|
holdCard(inside) {
|
|
80
88
|
this.inCard = inside;
|
|
@@ -219,7 +227,7 @@ export class HoverFeature {
|
|
|
219
227
|
}
|
|
220
228
|
this.pinned = pinned;
|
|
221
229
|
this.present(position, problems, info, problems[0]?.diagnostic.range ?? range);
|
|
222
|
-
if (info !== null) {
|
|
230
|
+
if (info !== null && this.referenceCount) {
|
|
223
231
|
this.scheduleCount(position, request, controller.signal);
|
|
224
232
|
}
|
|
225
233
|
}
|
|
@@ -250,7 +258,7 @@ export class HoverFeature {
|
|
|
250
258
|
/* How many places use the symbol, which can take a while in a large project and so arrives after the card does. */
|
|
251
259
|
async count(position, key, request, signal) {
|
|
252
260
|
const { service } = this.language.project;
|
|
253
|
-
if (request !== this.request || !service.supports('textDocument/references', this.language.uri)) {
|
|
261
|
+
if (request !== this.request || !this.referenceCount || !service.supports('textDocument/references', this.language.uri)) {
|
|
254
262
|
return;
|
|
255
263
|
}
|
|
256
264
|
const found = await service.references(this.language.uri, position, false, { signal }).catch(() => null);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { EditorLanguage, type EditorLanguageOptions } from './editor-language.ts';
|
|
2
|
+
export { KEY_PRIORITY } from './key-priority.ts';
|
|
3
|
+
export { realTimers, type Timers } from './timers.ts';
|
|
2
4
|
export { DEFAULT_RANGE_LINES, DEFAULT_RANGE_CHARACTERS, type SemanticTokensOptions } from './semantic-tokens.ts';
|
|
3
5
|
export { ProjectLanguage, type FileOperationTarget } from './project-language.ts';
|
|
4
6
|
export type { LanguageDocumentHandle } from './project-language.ts';
|
|
@@ -7,6 +9,7 @@ export { EditorView } from './EditorView.tsx';
|
|
|
7
9
|
export { createHolder } from './holder.ts';
|
|
8
10
|
export type { EditorViewProps } from './EditorView.tsx';
|
|
9
11
|
export { LanguagePopups } from './LanguagePopups.tsx';
|
|
12
|
+
export type { LanguagePopupsProps } from './LanguagePopups.tsx';
|
|
10
13
|
export { AnchoredPopup } from './AnchoredPopup.tsx';
|
|
11
14
|
export { HoverCard } from './HoverCard.tsx';
|
|
12
15
|
export { CompletionPopup } from './CompletionPopup.tsx';
|
|
@@ -28,13 +31,14 @@ export type { EditorRendering } from './rendering-context.ts';
|
|
|
28
31
|
export { FindReplace } from './FindReplace.tsx';
|
|
29
32
|
export { ChangeReview } from './ChangeReview.tsx';
|
|
30
33
|
export type { ChangeReviewProps } from './ChangeReview.tsx';
|
|
31
|
-
export { ProjectProblems, countsOf, compareRows } from './project-problems.ts';
|
|
32
|
-
export type { ProblemFile, ProblemRow } from './project-problems.ts';
|
|
34
|
+
export { ProjectProblems, serviceProblems, countsOf, compareRows } from './project-problems.ts';
|
|
35
|
+
export type { ProblemFile, ProblemRow, ProblemReport, ProblemSource } from './project-problems.ts';
|
|
33
36
|
export { applyWorkspaceEdit, supportedResourceOperations } from './workspace-edit.ts';
|
|
34
37
|
export type { ProjectFiles, StagedFile, WorkspaceEditHost } from './workspace-edit.ts';
|
|
35
38
|
export { useProblemCounts } from './use-problem-counts.ts';
|
|
36
39
|
export type { ProblemCounts } from './diagnostics.ts';
|
|
37
40
|
export type { BlameSource, CodeVisionSettings } from './code-vision.ts';
|
|
41
|
+
export type { HoverSettings } from './hover.ts';
|
|
38
42
|
export type { Problem } from './diagnostics-model.ts';
|
|
39
43
|
export type { PopupState, PopupStore, HoverInfo, HoverView, CompletionView, CompletionDocs, CompletionRow, SignatureView, RenameView, RenameFileView, PeekView, CallHierarchyView, PickView, PickGroup, PickRow, PickPreview, SymbolsView, MenuView, AuthorsView } from './popups.ts';
|
|
40
44
|
export { RowHost, LineActionHost } from './row-host.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { EditorLanguage } from './editor-language.js';
|
|
2
|
+
export { KEY_PRIORITY } from './key-priority.js';
|
|
3
|
+
export { realTimers } from './timers.js';
|
|
2
4
|
export { DEFAULT_RANGE_LINES, DEFAULT_RANGE_CHARACTERS } from './semantic-tokens.js';
|
|
3
5
|
export { ProjectLanguage } from './project-language.js';
|
|
4
6
|
export { EditorView } from './EditorView.js';
|
|
@@ -21,7 +23,7 @@ export { EditorContextMenu } from './EditorContextMenu.js';
|
|
|
21
23
|
export { EditorRenderingProvider } from './rendering.js';
|
|
22
24
|
export { FindReplace } from './FindReplace.js';
|
|
23
25
|
export { ChangeReview } from './ChangeReview.js';
|
|
24
|
-
export { ProjectProblems, countsOf, compareRows } from './project-problems.js';
|
|
26
|
+
export { ProjectProblems, serviceProblems, countsOf, compareRows } from './project-problems.js';
|
|
25
27
|
export { applyWorkspaceEdit, supportedResourceOperations } from './workspace-edit.js';
|
|
26
28
|
export { useProblemCounts } from './use-problem-counts.js';
|
|
27
29
|
export { RowHost, LineActionHost } from './row-host.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EditorKeyHandler } from '@adecore/editor';
|
|
2
|
+
export declare const KEY_PRIORITY: {
|
|
3
|
+
readonly pick: 1500;
|
|
4
|
+
readonly diagnostics: 1400;
|
|
5
|
+
readonly hover: 1300;
|
|
6
|
+
readonly completion: 1200;
|
|
7
|
+
readonly snippets: 1100;
|
|
8
|
+
readonly signature: 1000;
|
|
9
|
+
readonly highlights: 900;
|
|
10
|
+
readonly codeActions: 800;
|
|
11
|
+
readonly rename: 700;
|
|
12
|
+
readonly navigation: 600;
|
|
13
|
+
readonly peek: 500;
|
|
14
|
+
readonly callHierarchy: 400;
|
|
15
|
+
readonly symbolPicker: 300;
|
|
16
|
+
readonly history: 200;
|
|
17
|
+
readonly renderedDocs: 100;
|
|
18
|
+
};
|
|
19
|
+
export declare class KeyDispatcher {
|
|
20
|
+
private readonly entries;
|
|
21
|
+
add(handler: EditorKeyHandler, priority: number): () => void;
|
|
22
|
+
dispatch(event: KeyboardEvent): boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Where each feature of an editor sees a key through `EditorLanguage.onKey`, the highest first. A hundred
|
|
3
|
+
* apart, so a handler of the app can stand between two features; 0, the default, comes after all of them.
|
|
4
|
+
*/
|
|
5
|
+
export const KEY_PRIORITY = {
|
|
6
|
+
pick: 1500,
|
|
7
|
+
diagnostics: 1400,
|
|
8
|
+
hover: 1300,
|
|
9
|
+
completion: 1200,
|
|
10
|
+
snippets: 1100,
|
|
11
|
+
signature: 1000,
|
|
12
|
+
highlights: 900,
|
|
13
|
+
codeActions: 800,
|
|
14
|
+
rename: 700,
|
|
15
|
+
navigation: 600,
|
|
16
|
+
peek: 500,
|
|
17
|
+
callHierarchy: 400,
|
|
18
|
+
symbolPicker: 300,
|
|
19
|
+
history: 200,
|
|
20
|
+
renderedDocs: 100
|
|
21
|
+
};
|
|
22
|
+
/* Hands a key to its handlers by priority until one takes it; of two of the same priority the one added first. */
|
|
23
|
+
export class KeyDispatcher {
|
|
24
|
+
entries = [];
|
|
25
|
+
add(handler, priority) {
|
|
26
|
+
const entry = { handler, priority };
|
|
27
|
+
const index = this.entries.findIndex((other) => other.priority < priority);
|
|
28
|
+
this.entries.splice(index === -1 ? this.entries.length : index, 0, entry);
|
|
29
|
+
return () => {
|
|
30
|
+
const at = this.entries.indexOf(entry);
|
|
31
|
+
if (at !== -1) {
|
|
32
|
+
this.entries.splice(at, 1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
dispatch(event) {
|
|
37
|
+
return [...this.entries].some((entry) => entry.handler(event));
|
|
38
|
+
}
|
|
39
|
+
}
|
package/dist/locales/en.json
CHANGED
|
@@ -82,6 +82,9 @@
|
|
|
82
82
|
"symbol": "Matches"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
+
"panel": {
|
|
86
|
+
"resize": "Resize panel"
|
|
87
|
+
},
|
|
85
88
|
"peek": {
|
|
86
89
|
"unavailable": "No language server finds references in this file",
|
|
87
90
|
"none": "No references found",
|
|
@@ -175,7 +178,8 @@
|
|
|
175
178
|
"details": "Details",
|
|
176
179
|
"none": "No suggestions",
|
|
177
180
|
"transformBusy": "Snippet transforms are busy; try again",
|
|
178
|
-
"transformFailed": "Snippet transform could not be applied"
|
|
181
|
+
"transformFailed": "Snippet transform could not be applied",
|
|
182
|
+
"failed": "Could not insert the suggestion: {{message}}"
|
|
179
183
|
},
|
|
180
184
|
"history": {
|
|
181
185
|
"recent": "Recent locations"
|
package/dist/locales/nl.json
CHANGED
|
@@ -82,6 +82,9 @@
|
|
|
82
82
|
"symbol": "Overeenkomsten"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
+
"panel": {
|
|
86
|
+
"resize": "Paneel vergroten of verkleinen"
|
|
87
|
+
},
|
|
85
88
|
"peek": {
|
|
86
89
|
"unavailable": "Geen language server vindt referenties in dit bestand",
|
|
87
90
|
"none": "Geen referenties gevonden",
|
|
@@ -175,7 +178,8 @@
|
|
|
175
178
|
"details": "Details",
|
|
176
179
|
"none": "Geen suggesties",
|
|
177
180
|
"transformBusy": "Snippettransformaties zijn bezig; probeer het opnieuw",
|
|
178
|
-
"transformFailed": "Snippettransformatie kon niet worden toegepast"
|
|
181
|
+
"transformFailed": "Snippettransformatie kon niet worden toegepast",
|
|
182
|
+
"failed": "De suggestie kon niet worden ingevoegd: {{message}}"
|
|
179
183
|
},
|
|
180
184
|
"history": {
|
|
181
185
|
"recent": "Recente plekken"
|
package/dist/models.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { isIdentifierCharacter, identifierPrefix, type MatchDetail, matchDetail, matchScore, editRangeOf, itemsOf, prefixFor, type Ranked, rankCompletions, matchedCharacters, qualifierOf, qualifiersOf, snippetToText, METHOD_KIND, FUNCTION_KIND, CONSTRUCTOR_KIND, CLASS_KIND, SNIPPET_FORMAT, type Insertion, type SnippetInsertionOptions, insertionOf, mirroredInsertions, documentationText, completionDocsOf, type KindTone, kindLetterOf, kindToneOf, type RowWindow, rowWindow } from './completion-model.ts';
|
|
2
2
|
export { PARAMETER_HINTS_COMMAND, type CallPlan, type CallSite, isCallItem, hasParameters, planCall, withParentheses } from './completion-call.ts';
|
|
3
|
-
export { type Problem, severityOf, markerOf, comparePositions, shiftPosition, shiftRange, rangeHolds, problemsAt, neighborProblem, codeLabelOf } from './diagnostics-model.ts';
|
|
3
|
+
export { type Problem, severityOf, markerOf, comparePositions, shiftPosition, endOfInsertion, shiftRange, rangeHolds, problemsAt, neighborProblem, codeLabelOf } from './diagnostics-model.ts';
|
|
4
4
|
export { type SignatureBlock, type HoverText, splitSignatures, hoverTextOf, isEmptyHover, locationsOf, sameRange, type DocTag, splitDocTags, type HoverSection, type BaselineLevel, type Baseline, docblockMarkdown, type MarkdownPart, markdownParts, hoverSectionsOf } from './hover-content.ts';
|
|
5
5
|
export { type SignatureViewModel, parameterSpan, signatureViewOf } from './signature-model.ts';
|
|
6
6
|
export { wordRangeAt, type RenameTarget, renameTargetOf, type Occurrences, occurrencesOf, type RenameRow, type RenameFile, renameRowsOf, renamePreviewOf } from './rename-model.ts';
|
|
@@ -15,7 +15,7 @@ export { resourceOperationsOf, type ResourceOperationView } from './workspace-ed
|
|
|
15
15
|
export { MAX_DECLARATIONS, type CodeVisionDeclaration, type DeclarationSource, startAfterComments, declarationsOf, usagesText } from './code-vision-model.ts';
|
|
16
16
|
export { UNCOMMITTED, mapBlame, type CodeAuthor, type CodeAuthorship, shortName, authorshipOf, authorsText } from './code-authors.ts';
|
|
17
17
|
export { type SnippetTransform, type SnippetStop, type SnippetRange, type SnippetField, type SnippetVariableResolver, type SnippetTemplate, compileSnippet, type ParsedSnippet, parseSnippet, tabOrder } from './snippet.ts';
|
|
18
|
-
export { type LineSpan, lineSpanOf, isEmptyRange, inlineRangeOf, type InlineProblem, problemsOnLines, type InlineAnswer, parseAnswer, fitReplacement,
|
|
18
|
+
export { type LineSpan, lineSpanOf, isEmptyRange, inlineRangeOf, type InlineProblem, problemsOnLines, type InlineAnswer, parseAnswer, fitReplacement, type DiffSegment, diffSegments, emphasisOf, offsetOf, textInRange, replaceRange, locateSelection } from './proposal-model.ts';
|
|
19
19
|
export { type LineReplacement, replaceLines, replaceAllLines } from './line-edits.ts';
|
|
20
20
|
export { replacedWords } from './word-diff.ts';
|
|
21
21
|
export { type FindOptions, type FindQuery, EMPTY_FIND_QUERY, type TextMatch, type CompiledFind, MATCH_LIMIT, compileFind, matchesIn, stepIndex } from './find-query.ts';
|
package/dist/models.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { isIdentifierCharacter, identifierPrefix, matchDetail, matchScore, editRangeOf, itemsOf, prefixFor, rankCompletions, matchedCharacters, qualifierOf, qualifiersOf, snippetToText, METHOD_KIND, FUNCTION_KIND, CONSTRUCTOR_KIND, CLASS_KIND, SNIPPET_FORMAT, insertionOf, mirroredInsertions, documentationText, completionDocsOf, kindLetterOf, kindToneOf, rowWindow } from './completion-model.js';
|
|
2
2
|
export { PARAMETER_HINTS_COMMAND, isCallItem, hasParameters, planCall, withParentheses } from './completion-call.js';
|
|
3
|
-
export { severityOf, markerOf, comparePositions, shiftPosition, shiftRange, rangeHolds, problemsAt, neighborProblem, codeLabelOf } from './diagnostics-model.js';
|
|
3
|
+
export { severityOf, markerOf, comparePositions, shiftPosition, endOfInsertion, shiftRange, rangeHolds, problemsAt, neighborProblem, codeLabelOf } from './diagnostics-model.js';
|
|
4
4
|
export { splitSignatures, hoverTextOf, isEmptyHover, locationsOf, sameRange, splitDocTags, docblockMarkdown, markdownParts, hoverSectionsOf } from './hover-content.js';
|
|
5
5
|
export { parameterSpan, signatureViewOf } from './signature-model.js';
|
|
6
6
|
export { wordRangeAt, renameTargetOf, occurrencesOf, renameRowsOf, renamePreviewOf } from './rename-model.js';
|
|
@@ -15,7 +15,7 @@ export { resourceOperationsOf } from './workspace-edit.js';
|
|
|
15
15
|
export { MAX_DECLARATIONS, startAfterComments, declarationsOf, usagesText } from './code-vision-model.js';
|
|
16
16
|
export { UNCOMMITTED, mapBlame, shortName, authorshipOf, authorsText } from './code-authors.js';
|
|
17
17
|
export { compileSnippet, parseSnippet, tabOrder } from './snippet.js';
|
|
18
|
-
export { lineSpanOf, isEmptyRange, inlineRangeOf, problemsOnLines, parseAnswer, fitReplacement,
|
|
18
|
+
export { lineSpanOf, isEmptyRange, inlineRangeOf, problemsOnLines, parseAnswer, fitReplacement, diffSegments, emphasisOf, offsetOf, textInRange, replaceRange, locateSelection } from './proposal-model.js';
|
|
19
19
|
export { replaceLines, replaceAllLines } from './line-edits.js';
|
|
20
20
|
export { replacedWords } from './word-diff.js';
|
|
21
21
|
export { EMPTY_FIND_QUERY, MATCH_LIMIT, compileFind, matchesIn, stepIndex } from './find-query.js';
|
package/dist/navigation.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StaleResultError, fileUriToPath } from '@adecore/lsp';
|
|
2
|
+
import { KEY_PRIORITY } from './key-priority.js';
|
|
2
3
|
import { basenameOf } from './paths.js';
|
|
3
4
|
import { rangeHolds } from './diagnostics-model.js';
|
|
4
5
|
import { placesOfName } from './symbol-links.js';
|
|
@@ -62,14 +63,14 @@ export class NavigationFeature {
|
|
|
62
63
|
void this.go('definition', click.position);
|
|
63
64
|
return true;
|
|
64
65
|
}),
|
|
65
|
-
|
|
66
|
+
language.onKey((event) => {
|
|
66
67
|
const found = SHORTCUT_KINDS.find(([, name]) => isShortcut(this.language.shortcuts[name], event));
|
|
67
68
|
if (found === undefined) {
|
|
68
69
|
return false;
|
|
69
70
|
}
|
|
70
71
|
void this.go(found[0]);
|
|
71
72
|
return true;
|
|
72
|
-
})
|
|
73
|
+
}, KEY_PRIORITY.navigation)
|
|
73
74
|
];
|
|
74
75
|
language.onDispose(() => {
|
|
75
76
|
for (const off of offs) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PANEL_BODY_HEIGHT = 180;
|
|
2
|
+
export declare const PANEL_BODY_MIN = 88;
|
|
3
|
+
export declare const PANEL_KEY_STEP = 22;
|
|
4
|
+
export declare function panelBodyMax(available: number): number;
|
|
5
|
+
export declare function clampPanelBody(height: number, available?: number): number;
|
|
6
|
+
export declare function availableHeightOf(container: HTMLElement | null): number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* The height of the list-and-preview area of a peek or a call hierarchy, which is what a person drags; the bands and the title bar around it stay. */
|
|
2
|
+
export const PANEL_BODY_HEIGHT = 180;
|
|
3
|
+
/* Four rows of 22px, so a list never shrinks to nothing. */
|
|
4
|
+
export const PANEL_BODY_MIN = 88;
|
|
5
|
+
/* What the bands and the title bar take of the panel, which the share of the editor has to leave room for. */
|
|
6
|
+
const PANEL_CHROME = 63;
|
|
7
|
+
/* The share of the editor's height a panel may take, so the line it belongs to stays in view. */
|
|
8
|
+
const PANEL_MAX_SHARE = 0.8;
|
|
9
|
+
const PANEL_FALLBACK_AVAILABLE = 800;
|
|
10
|
+
export const PANEL_KEY_STEP = 22;
|
|
11
|
+
/* The tallest body for an editor that is `available` pixels high; never below the minimum, so a tiny editor still gets a usable panel. */
|
|
12
|
+
export function panelBodyMax(available) {
|
|
13
|
+
return Math.max(PANEL_BODY_MIN, Math.floor(available * PANEL_MAX_SHARE) - PANEL_CHROME);
|
|
14
|
+
}
|
|
15
|
+
export function clampPanelBody(height, available = PANEL_FALLBACK_AVAILABLE) {
|
|
16
|
+
if (!Number.isFinite(height)) {
|
|
17
|
+
return PANEL_BODY_HEIGHT;
|
|
18
|
+
}
|
|
19
|
+
return Math.min(panelBodyMax(available), Math.max(PANEL_BODY_MIN, Math.round(height)));
|
|
20
|
+
}
|
|
21
|
+
/* The height of the editor's scrolling area around a panel's row; the fallback stands in where nothing is laid out. */
|
|
22
|
+
export function availableHeightOf(container) {
|
|
23
|
+
const height = container?.closest('.se-viewport')?.clientHeight ?? 0;
|
|
24
|
+
return height > 0 ? height : PANEL_FALLBACK_AVAILABLE;
|
|
25
|
+
}
|
package/dist/peek.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { EditorPosition } from '@adecore/editor';
|
|
2
2
|
import type { EditorLanguage } from './editor-language.ts';
|
|
3
3
|
import type { PeekView } from './popups.ts';
|
|
4
|
+
import { type Timers } from './timers.ts';
|
|
4
5
|
export declare const PEEK_HEIGHT = 241;
|
|
5
6
|
type PeekKind = PeekView['kind'];
|
|
6
7
|
export declare class PeekFeature {
|
|
7
8
|
private readonly language;
|
|
9
|
+
private readonly timers;
|
|
8
10
|
private kind;
|
|
9
11
|
private targets;
|
|
10
12
|
private texts;
|
|
@@ -12,7 +14,7 @@ export declare class PeekFeature {
|
|
|
12
14
|
private order;
|
|
13
15
|
private line;
|
|
14
16
|
private token;
|
|
15
|
-
constructor(language: EditorLanguage);
|
|
17
|
+
constructor(language: EditorLanguage, timers?: Timers);
|
|
16
18
|
get isOpen(): boolean;
|
|
17
19
|
open(position?: EditorPosition, kind?: PeekKind): Promise<void>;
|
|
18
20
|
openDefinition(position?: EditorPosition): Promise<void>;
|
package/dist/peek.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { StaleResultError } from '@adecore/lsp';
|
|
2
|
+
import { KEY_PRIORITY } from './key-priority.js';
|
|
2
3
|
import { uniquePlaces } from './navigation.js';
|
|
3
4
|
import { PEEK_READ_FILES, definitionSnippetOf, peekFilesOf, snippetOf } from './peek-model.js';
|
|
4
5
|
import { isShortcut } from './shortcut-keys.js';
|
|
5
6
|
import { messageOf } from './error-message.js';
|
|
7
|
+
import { realTimers, revealRow } from './timers.js';
|
|
6
8
|
const TOAST_ID = 'language-peek';
|
|
7
9
|
/* The block as the panel draws it: a hatched band, the header, eight lines of code and a hatched band, until the editor has measured it. */
|
|
8
10
|
export const PEEK_HEIGHT = 241;
|
|
@@ -20,6 +22,7 @@ function placeKey(location) {
|
|
|
20
22
|
*/
|
|
21
23
|
export class PeekFeature {
|
|
22
24
|
language;
|
|
25
|
+
timers;
|
|
23
26
|
kind = 'references';
|
|
24
27
|
/* The whole declaration of each place of a definition peek, where the server gave it. */
|
|
25
28
|
targets = new Map();
|
|
@@ -28,11 +31,12 @@ export class PeekFeature {
|
|
|
28
31
|
order = [];
|
|
29
32
|
line = 0;
|
|
30
33
|
token = 0;
|
|
31
|
-
constructor(language) {
|
|
34
|
+
constructor(language, timers = realTimers) {
|
|
32
35
|
this.language = language;
|
|
36
|
+
this.timers = timers;
|
|
33
37
|
const { editor } = language;
|
|
34
38
|
const offs = [
|
|
35
|
-
|
|
39
|
+
language.onKey((event) => {
|
|
36
40
|
if (isShortcut(this.language.shortcuts.peekReferences, event)) {
|
|
37
41
|
void this.open();
|
|
38
42
|
return true;
|
|
@@ -42,7 +46,7 @@ export class PeekFeature {
|
|
|
42
46
|
return true;
|
|
43
47
|
}
|
|
44
48
|
return this.key(event);
|
|
45
|
-
}),
|
|
49
|
+
}, KEY_PRIORITY.peek),
|
|
46
50
|
editor.onTextChange(() => this.close())
|
|
47
51
|
];
|
|
48
52
|
language.onDispose(() => {
|
|
@@ -179,6 +183,7 @@ export class PeekFeature {
|
|
|
179
183
|
const view = this.language.popups.getState().peek;
|
|
180
184
|
if (view !== null && view.container !== container) {
|
|
181
185
|
this.language.popups.setState({ peek: { ...view, container } });
|
|
186
|
+
revealRow(this.timers, container);
|
|
182
187
|
}
|
|
183
188
|
}
|
|
184
189
|
key(event) {
|
package/dist/pick.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KEY_PRIORITY } from './key-priority.js';
|
|
1
2
|
import { realTimers } from './timers.js';
|
|
2
3
|
const PREVIEW_DELAY_MS = 120;
|
|
3
4
|
/*
|
|
@@ -21,7 +22,7 @@ export class PickFeature {
|
|
|
21
22
|
this.timers = timers;
|
|
22
23
|
const { editor } = language;
|
|
23
24
|
const offs = [
|
|
24
|
-
|
|
25
|
+
language.onKey((event) => this.key(event), KEY_PRIORITY.pick),
|
|
25
26
|
editor.onTextChange(() => this.close()),
|
|
26
27
|
editor.onCaret(() => this.close()),
|
|
27
28
|
editor.onBlur(() => this.close())
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The handlers for a popup list whose rows the keyboard never enters: the text it belongs to keeps the
|
|
3
|
+
* focus, and the active row is only `aria-activedescendant` or a highlight. Chromium reports that row as
|
|
4
|
+
* the focused element, so a tool that focuses it before it types would otherwise pull the keys out of the
|
|
5
|
+
* text. A press on the list moves no focus, and a row that gets it anyway hands it straight back.
|
|
6
|
+
*/
|
|
7
|
+
export function keepFocusOutOfList(focusBack) {
|
|
8
|
+
return {
|
|
9
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
10
|
+
onFocus: () => focusBack()
|
|
11
|
+
};
|
|
12
|
+
}
|
package/dist/popups.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ export interface PopupState {
|
|
|
141
141
|
readonly pick: PickView | null;
|
|
142
142
|
readonly rename: RenameView | null;
|
|
143
143
|
readonly peek: PeekView | null;
|
|
144
|
-
readonly callHierarchy
|
|
144
|
+
readonly callHierarchy: CallHierarchyView | null;
|
|
145
145
|
readonly symbols: SymbolsView | null;
|
|
146
146
|
readonly menu: MenuView | null;
|
|
147
147
|
readonly authors: AuthorsView | null;
|
|
@@ -23,10 +23,14 @@ export declare class ProjectLanguage {
|
|
|
23
23
|
readonly history: NavigationHistory;
|
|
24
24
|
private readonly holders;
|
|
25
25
|
private readonly files;
|
|
26
|
+
panelBodyHeight: number;
|
|
27
|
+
private readonly panelListeners;
|
|
26
28
|
private pendingCaret;
|
|
27
29
|
private lastPlace;
|
|
28
30
|
private disposed;
|
|
29
31
|
constructor(service: LanguageService, host?: LanguageHost);
|
|
32
|
+
onPanelBodyChange(listener: (height: number) => void): () => void;
|
|
33
|
+
resizePanelBody(height: number): void;
|
|
30
34
|
pathOfLocation(uri: string): string | null;
|
|
31
35
|
applyWorkspaceEdit(edit: WorkspaceEdit): Promise<ApplyWorkspaceEditResult>;
|
|
32
36
|
willCreateFiles(targets: readonly FileOperationTarget[]): Promise<WorkspaceEdit | null>;
|