@adecore/editor-react 0.31.11 → 0.32.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.js +73 -19
- package/dist/AttributionCard.js +162 -4
- package/dist/BaselineStatus.js +62 -8
- package/dist/CallHierarchyPanel.js +977 -60
- package/dist/ChangeReview.js +76 -25
- package/dist/CodeAuthorsCard.js +314 -14
- package/dist/CompletionPopup.js +490 -83
- package/dist/DiffView.js +548 -181
- package/dist/EditorContextMenu.js +352 -34
- package/dist/EditorView.js +276 -99
- package/dist/FindReplace.js +525 -67
- package/dist/HoverCard.js +378 -38
- package/dist/HoverSections.js +367 -56
- package/dist/LanguagePopups.js +95 -34
- package/dist/Markdown.js +41 -6
- package/dist/PanelResizeHandle.js +199 -66
- package/dist/PathText.js +49 -7
- package/dist/PeekPanel.js +675 -72
- package/dist/PickPopup.js +304 -34
- package/dist/RenameCard.js +679 -85
- package/dist/RenderedDocs.js +329 -58
- package/dist/SignatureCard.js +91 -7
- package/dist/SplitDiffView.js +344 -254
- package/dist/SymbolPicker.js +440 -85
- package/dist/call-hierarchy-model.js +102 -68
- package/dist/call-hierarchy.js +458 -359
- package/dist/code-actions-model.js +88 -76
- package/dist/code-actions.js +372 -283
- package/dist/code-authors.js +64 -55
- package/dist/code-vision-model.js +134 -127
- package/dist/code-vision.js +224 -206
- package/dist/completion-call.js +94 -67
- package/dist/completion-model.js +334 -244
- package/dist/completion.js +840 -649
- package/dist/conflict-model.js +35 -29
- package/dist/context-menu-rows.js +42 -17
- package/dist/context-menu.js +64 -46
- package/dist/definition-link.js +88 -85
- package/dist/diagnostics-model.js +74 -55
- package/dist/diagnostics.js +121 -100
- package/dist/diff-expansion.js +38 -35
- package/dist/diff-overlays.js +144 -22
- package/dist/diff-syntax.js +65 -42
- package/dist/diff-wordmarks.js +26 -23
- package/dist/doc-comment-model.js +265 -216
- package/dist/editor-language.js +177 -152
- package/dist/error-message.js +2 -2
- package/dist/find-query.js +49 -36
- package/dist/folding.js +81 -62
- package/dist/format-on-type.js +86 -67
- package/dist/highlight-layers.js +19 -20
- package/dist/highlights.js +105 -83
- package/dist/history.js +44 -38
- package/dist/holder.js +18 -18
- package/dist/host-types.js +1 -1
- package/dist/hover-content.js +167 -129
- package/dist/hover.js +285 -245
- package/dist/index.js +10 -10
- package/dist/inlay-hints.js +369 -324
- package/dist/key-priority.js +34 -31
- package/dist/language-ids.js +45 -42
- package/dist/line-edits.js +74 -28
- package/dist/line-text.js +18 -3
- package/dist/locales/en.json +38 -38
- package/dist/locales/nl.json +41 -41
- package/dist/models.js +1 -1
- package/dist/navigation-history.js +40 -41
- package/dist/navigation.js +141 -123
- package/dist/panel-size.js +8 -8
- package/dist/patch-decorations.js +236 -160
- package/dist/patch-layout.js +331 -262
- package/dist/paths.js +3 -3
- package/dist/peek-model.js +86 -69
- package/dist/peek.js +254 -192
- package/dist/pick.js +164 -157
- package/dist/popup-focus.js +5 -5
- package/dist/popup-placement.js +36 -21
- package/dist/popups.js +13 -13
- package/dist/project-language.js +228 -211
- package/dist/project-problems.js +81 -69
- package/dist/proposal-model.js +163 -126
- package/dist/recent-choices.js +25 -25
- package/dist/refresher.js +44 -49
- package/dist/rename-model.js +113 -113
- package/dist/rename.js +321 -233
- package/dist/rendered-docs.d.ts +4 -2
- package/dist/rendered-docs.js +384 -318
- package/dist/rendering-context.js +5 -3
- package/dist/rendering.js +22 -4
- package/dist/review-group.js +42 -39
- package/dist/row-host.d.ts +4 -2
- package/dist/row-host.js +90 -78
- package/dist/selection-ranges.js +21 -17
- package/dist/semantic-delta.js +22 -19
- package/dist/semantic-model.js +86 -73
- package/dist/semantic-tokens.js +201 -162
- package/dist/shortcut-keys.js +16 -10
- package/dist/signature-model.js +34 -28
- package/dist/signature.js +177 -129
- package/dist/snippet-field-transforms.js +118 -106
- package/dist/snippet-indent.js +48 -43
- package/dist/snippet-range-order.js +11 -11
- package/dist/snippet-session.js +703 -667
- package/dist/snippet-transform-client.js +59 -59
- package/dist/snippet-transform-format.js +285 -263
- package/dist/snippet-transform-protocol.js +1 -1
- package/dist/snippet-transform-queue.js +163 -153
- package/dist/snippet-transform-worker.js +42 -35
- package/dist/snippet-variable-names.js +1 -36
- package/dist/snippet-variables.js +53 -63
- package/dist/snippet.js +477 -405
- package/dist/split-alignment.js +47 -35
- package/dist/split-scroll.js +42 -40
- package/dist/symbol-links.js +33 -25
- package/dist/symbol-picker-model.js +126 -116
- package/dist/symbol-picker.js +98 -59
- package/dist/symbols.js +117 -88
- package/dist/testing.js +248 -165
- package/dist/timers.js +35 -30
- package/dist/use-panel-body.js +49 -8
- package/dist/use-problem-counts.js +29 -15
- package/dist/view-state.js +54 -33
- package/dist/word-diff.js +18 -18
- package/dist/workspace-edit.js +300 -249
- package/package.json +6 -6
- package/src/CallHierarchyPanel.tsx +2 -2
- package/src/DiffView.tsx +3 -3
- package/src/FindReplace.tsx +2 -2
- package/src/LanguagePopups.tsx +2 -0
- package/src/PeekPanel.tsx +3 -3
- package/src/RenderedDocs.tsx +9 -10
- package/src/SymbolPicker.tsx +2 -2
- package/src/diff-overlays.tsx +6 -4
- package/src/locales/en.json +38 -38
- package/src/locales/nl.json +41 -41
- package/src/rendered-docs.ts +14 -3
- package/src/row-host.ts +14 -3
package/dist/format-on-type.js
CHANGED
|
@@ -6,8 +6,8 @@ const LINE_BREAK = /^\r?\n[ \t]*(\r?\n[ \t]*)?$/;
|
|
|
6
6
|
const DEDENTED = /^[ \t]+(\S)$/u;
|
|
7
7
|
/* The overlapping edits of a server answer have no single meaning, so an answer that has them is not applied. */
|
|
8
8
|
function overlaps(edits) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const ordered = [...edits].sort((left, right) => comparePositions(left.range.start, right.range.start));
|
|
10
|
+
return ordered.some((edit, index) => index > 0 && comparePositions(ordered[index - 1].range.end, edit.range.start) > 0);
|
|
11
11
|
}
|
|
12
12
|
/*
|
|
13
13
|
* Formatting while typing: after a person types one of the characters the server named in
|
|
@@ -23,73 +23,92 @@ function overlaps(edits) {
|
|
|
23
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)`.
|
|
24
24
|
*/
|
|
25
25
|
export class FormatOnTypeFeature {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
language;
|
|
27
|
+
enabled = false;
|
|
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. */
|
|
29
|
+
revision = 0;
|
|
30
|
+
controller = new AbortController();
|
|
31
|
+
constructor(language) {
|
|
32
|
+
this.language = language;
|
|
33
|
+
const off = language.editor.onTextChange(change => this.typed(change));
|
|
34
|
+
language.onDispose(() => {
|
|
35
|
+
off();
|
|
36
|
+
this.controller.abort();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
get isEnabled() {
|
|
40
|
+
return this.enabled;
|
|
41
|
+
}
|
|
42
|
+
/* Whether the server of this document formats on type and the service can ask it. */
|
|
43
|
+
get supported() {
|
|
44
|
+
const {
|
|
45
|
+
project,
|
|
46
|
+
uri
|
|
47
|
+
} = this.language;
|
|
48
|
+
return project.service.onTypeFormatting !== undefined && project.service.supports(METHOD, uri);
|
|
49
|
+
}
|
|
50
|
+
configure(enabled) {
|
|
51
|
+
this.enabled = enabled;
|
|
52
|
+
if (!enabled) {
|
|
53
|
+
this.controller.abort();
|
|
38
54
|
}
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
}
|
|
56
|
+
/* The characters that ask the server, the first one and the more. */
|
|
57
|
+
triggerCharacters() {
|
|
58
|
+
const options = this.language.project.service.providerOptions(METHOD, this.language.uri);
|
|
59
|
+
return options === undefined ? [] : [...(options.firstTriggerCharacter === undefined ? [] : [options.firstTriggerCharacter]), ...(options.moreTriggerCharacter ?? [])];
|
|
60
|
+
}
|
|
61
|
+
typed(change) {
|
|
62
|
+
const revision = ++this.revision;
|
|
63
|
+
this.controller.abort();
|
|
64
|
+
if (!this.enabled || change.source !== 'input' && change.typed !== true || change.changes.length !== 1 || !this.supported) {
|
|
65
|
+
return;
|
|
41
66
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
67
|
+
const {
|
|
68
|
+
editor,
|
|
69
|
+
snippets
|
|
70
|
+
} = this.language;
|
|
71
|
+
const {
|
|
72
|
+
text
|
|
73
|
+
} = change.changes[0];
|
|
74
|
+
const typed = LINE_BREAK.test(text) ? '\n' : Array.from(text).length === 1 ? text : DEDENTED.exec(text)?.[1] ?? null;
|
|
75
|
+
if (typed === null || !this.triggerCharacters().includes(typed)) {
|
|
76
|
+
return;
|
|
46
77
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (!enabled) {
|
|
50
|
-
this.controller.abort();
|
|
51
|
-
}
|
|
78
|
+
if (snippets.isActive || editor.isReadOnly?.() === true || editor.getSelections().length !== 1) {
|
|
79
|
+
return;
|
|
52
80
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
81
|
+
this.controller = new AbortController();
|
|
82
|
+
void this.ask(revision, typed, editor.getCaret(), this.controller.signal);
|
|
83
|
+
}
|
|
84
|
+
async ask(revision, typed, caret, signal) {
|
|
85
|
+
const {
|
|
86
|
+
editor,
|
|
87
|
+
project,
|
|
88
|
+
uri,
|
|
89
|
+
document
|
|
90
|
+
} = this.language;
|
|
91
|
+
try {
|
|
92
|
+
// The change of the typed character reaches the server before this question does.
|
|
93
|
+
await document.ready;
|
|
94
|
+
const edits = await project.service.onTypeFormatting(uri, caret, typed, {
|
|
95
|
+
...editor.getIndentation()
|
|
96
|
+
}, {
|
|
97
|
+
signal
|
|
98
|
+
});
|
|
99
|
+
const here = editor.getCaret();
|
|
100
|
+
const stale = revision !== this.revision || this.language.isDisposed || comparePositions(here, caret) !== 0;
|
|
101
|
+
if (stale || edits === null || edits.length === 0 || overlaps(edits)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
editor.applyEdits(edits.map(edit => ({
|
|
105
|
+
range: edit.range,
|
|
106
|
+
text: edit.newText
|
|
107
|
+
})), {
|
|
108
|
+
mergeUndo: true
|
|
109
|
+
});
|
|
110
|
+
} catch {
|
|
111
|
+
// A refusal or a failing server is not worth a notice per keystroke; the next trigger character asks again.
|
|
59
112
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
this.controller.abort();
|
|
63
|
-
if (!this.enabled || (change.source !== 'input' && change.typed !== true) || change.changes.length !== 1 || !this.supported) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const { editor, snippets } = this.language;
|
|
67
|
-
const { text } = change.changes[0];
|
|
68
|
-
const typed = LINE_BREAK.test(text) ? '\n' : Array.from(text).length === 1 ? text : (DEDENTED.exec(text)?.[1] ?? null);
|
|
69
|
-
if (typed === null || !this.triggerCharacters().includes(typed)) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (snippets.isActive || editor.isReadOnly?.() === true || editor.getSelections().length !== 1) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
this.controller = new AbortController();
|
|
76
|
-
void this.ask(revision, typed, editor.getCaret(), this.controller.signal);
|
|
77
|
-
}
|
|
78
|
-
async ask(revision, typed, caret, signal) {
|
|
79
|
-
const { editor, project, uri, document } = this.language;
|
|
80
|
-
try {
|
|
81
|
-
// The change of the typed character reaches the server before this question does.
|
|
82
|
-
await document.ready;
|
|
83
|
-
const edits = await project.service.onTypeFormatting(uri, caret, typed, { ...editor.getIndentation() }, { signal });
|
|
84
|
-
const here = editor.getCaret();
|
|
85
|
-
const stale = revision !== this.revision || this.language.isDisposed || comparePositions(here, caret) !== 0;
|
|
86
|
-
if (stale || edits === null || edits.length === 0 || overlaps(edits)) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
editor.applyEdits(edits.map((edit) => ({ range: edit.range, text: edit.newText })), { mergeUndo: true });
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
// A refusal or a failing server is not worth a notice per keystroke; the next trigger character asks again.
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
113
|
+
}
|
|
114
|
+
}
|
package/dist/highlight-layers.js
CHANGED
|
@@ -4,27 +4,26 @@
|
|
|
4
4
|
* another's from before an edit.
|
|
5
5
|
*/
|
|
6
6
|
export class HighlightLayers {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.owners.set(owner, provider);
|
|
18
|
-
}
|
|
19
|
-
this.editor.setLineHighlights([...this.owners.values()].flatMap((read) => read()));
|
|
7
|
+
editor;
|
|
8
|
+
owners = new Map();
|
|
9
|
+
constructor(editor) {
|
|
10
|
+
this.editor = editor;
|
|
11
|
+
}
|
|
12
|
+
set(owner, provider) {
|
|
13
|
+
if (provider === null) {
|
|
14
|
+
this.owners.delete(owner);
|
|
15
|
+
} else {
|
|
16
|
+
this.owners.set(owner, provider);
|
|
20
17
|
}
|
|
18
|
+
this.editor.setLineHighlights([...this.owners.values()].flatMap(read => read()));
|
|
19
|
+
}
|
|
21
20
|
}
|
|
22
21
|
const layers = new WeakMap();
|
|
23
22
|
export function highlightLayers(editor) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
23
|
+
let found = layers.get(editor);
|
|
24
|
+
if (found === undefined) {
|
|
25
|
+
found = new HighlightLayers(editor);
|
|
26
|
+
layers.set(editor, found);
|
|
27
|
+
}
|
|
28
|
+
return found;
|
|
29
|
+
}
|
package/dist/highlights.js
CHANGED
|
@@ -6,98 +6,120 @@ import { isShortcut } from './shortcut-keys.js';
|
|
|
6
6
|
import { realTimers } from './timers.js';
|
|
7
7
|
const METHOD = 'textDocument/documentHighlight';
|
|
8
8
|
const PAUSE_MS = 150;
|
|
9
|
-
const KINDS = {
|
|
9
|
+
const KINDS = {
|
|
10
|
+
1: 'text',
|
|
11
|
+
2: 'read',
|
|
12
|
+
3: 'write'
|
|
13
|
+
};
|
|
10
14
|
export function editorHighlightsOf(highlights) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
return highlights.filter(highlight => comparePositions(highlight.range.start, highlight.range.end) < 0).map(highlight => ({
|
|
16
|
+
range: highlight.range,
|
|
17
|
+
kind: KINDS[highlight.kind ?? 1] ?? 'text'
|
|
18
|
+
})).sort((left, right) => comparePositions(left.range.start, right.range.start));
|
|
15
19
|
}
|
|
16
20
|
/* The range before the caret when stepping back, or after it when stepping forward, wrapping round the document; null for no ranges. */
|
|
17
21
|
export function neighborRange(ranges, from, direction) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
if (ranges.length === 0) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const ordered = [...ranges].sort((left, right) => comparePositions(left.start, right.start));
|
|
26
|
+
if (direction === 1) {
|
|
27
|
+
return ordered.find(range => comparePositions(range.start, from) > 0) ?? ordered[0];
|
|
28
|
+
}
|
|
29
|
+
return [...ordered].reverse().find(range => comparePositions(range.start, from) < 0) ?? ordered[ordered.length - 1];
|
|
26
30
|
}
|
|
27
31
|
/*
|
|
28
32
|
* The other uses of the name at the caret, drawn softly in the text, which the next and previous highlight
|
|
29
33
|
* keys step through. They are asked for when the caret rests on a name and go with the next edit.
|
|
30
34
|
*/
|
|
31
35
|
export class HighlightsFeature {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
36
|
+
language;
|
|
37
|
+
refresher;
|
|
38
|
+
current = [];
|
|
39
|
+
constructor(language, timers = realTimers) {
|
|
40
|
+
this.language = language;
|
|
41
|
+
const {
|
|
42
|
+
editor,
|
|
43
|
+
project,
|
|
44
|
+
uri
|
|
45
|
+
} = language;
|
|
46
|
+
this.refresher = new Refresher(async signal => {
|
|
47
|
+
if (!project.service.supports(METHOD, uri) || !this.onName()) {
|
|
48
|
+
this.clear();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const result = await project.service.documentHighlights(uri, editor.getCaret(), {
|
|
52
|
+
signal
|
|
53
|
+
});
|
|
54
|
+
if (!signal.aborted) {
|
|
55
|
+
this.set(result === null ? [] : editorHighlightsOf(result));
|
|
56
|
+
}
|
|
57
|
+
}, PAUSE_MS, timers);
|
|
58
|
+
const offs = [editor.onCaret(position => {
|
|
59
|
+
// Moving along the same name keeps its marks, which is what makes stepping through them quiet.
|
|
60
|
+
if (!this.current.some(highlight => rangeHolds(highlight.range, position))) {
|
|
61
|
+
this.clear();
|
|
62
|
+
}
|
|
63
|
+
this.refresher.later();
|
|
64
|
+
}), editor.onTextChange(() => {
|
|
65
|
+
// The editor drops its marks with the edit; this follows, and asks again when the caret settles.
|
|
66
|
+
this.current = [];
|
|
67
|
+
this.refresher.later();
|
|
68
|
+
}), language.onKey(event => {
|
|
69
|
+
const next = isShortcut(this.language.shortcuts.nextHighlight, event);
|
|
70
|
+
if (!next && !isShortcut(this.language.shortcuts.previousHighlight, event)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return this.step(next ? 1 : -1);
|
|
74
|
+
}, KEY_PRIORITY.highlights)];
|
|
75
|
+
language.onDispose(() => {
|
|
76
|
+
for (const off of offs) {
|
|
77
|
+
off();
|
|
78
|
+
}
|
|
79
|
+
this.refresher.dispose();
|
|
80
|
+
editor.setHighlights([]);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/* Puts the caret on the next use of the name, or the one before; false when there are none. */
|
|
84
|
+
step(direction) {
|
|
85
|
+
const {
|
|
86
|
+
editor
|
|
87
|
+
} = this.language;
|
|
88
|
+
const target = neighborRange(this.current.map(highlight => highlight.range), editor.getCaret(), direction);
|
|
89
|
+
if (target === null) {
|
|
90
|
+
return false;
|
|
86
91
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
editor.setCaret(target.start, comparePositions(target.start, editor.getCaret()) > 0 ? 'centerDown' : 'centerUp');
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
onName() {
|
|
96
|
+
const {
|
|
97
|
+
editor
|
|
98
|
+
} = this.language;
|
|
99
|
+
const caret = editor.getCaret();
|
|
100
|
+
const before = caret.character > 0 ? editor.textInRange({
|
|
101
|
+
start: {
|
|
102
|
+
line: caret.line,
|
|
103
|
+
character: caret.character - 1
|
|
104
|
+
},
|
|
105
|
+
end: caret
|
|
106
|
+
}) : '';
|
|
107
|
+
const after = editor.textInRange({
|
|
108
|
+
start: caret,
|
|
109
|
+
end: {
|
|
110
|
+
line: caret.line,
|
|
111
|
+
character: caret.character + 1
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return before !== '' && isIdentifierCharacter(before) || after !== '' && isIdentifierCharacter(after);
|
|
115
|
+
}
|
|
116
|
+
set(highlights) {
|
|
117
|
+
this.current = highlights;
|
|
118
|
+
this.language.editor.setHighlights(highlights);
|
|
119
|
+
}
|
|
120
|
+
clear() {
|
|
121
|
+
if (this.current.length > 0) {
|
|
122
|
+
this.set([]);
|
|
93
123
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this.language.editor.setHighlights(highlights);
|
|
97
|
-
}
|
|
98
|
-
clear() {
|
|
99
|
-
if (this.current.length > 0) {
|
|
100
|
-
this.set([]);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
124
|
+
}
|
|
125
|
+
}
|
package/dist/history.js
CHANGED
|
@@ -2,43 +2,49 @@ import { KEY_PRIORITY } from './key-priority.js';
|
|
|
2
2
|
import { isShortcut } from './shortcut-keys.js';
|
|
3
3
|
/* Back, Forward and the list of recent locations over the history the whole project shares. */
|
|
4
4
|
export class HistoryFeature {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
}, KEY_PRIORITY.history);
|
|
23
|
-
language.onDispose(off);
|
|
24
|
-
}
|
|
25
|
-
/* Returns to where the caret was before the last jump; false when there is no such place. */
|
|
26
|
-
back() {
|
|
27
|
-
return this.visit(this.language.project.history.back(this.language.place));
|
|
28
|
-
}
|
|
29
|
-
forward() {
|
|
30
|
-
return this.visit(this.language.project.history.forward(this.language.place));
|
|
31
|
-
}
|
|
32
|
-
/* Lists the places of the history under the caret; choosing one jumps there like any other jump. */
|
|
33
|
-
recent() {
|
|
34
|
-
const places = this.language.project.history.recent(this.language.place);
|
|
35
|
-
this.language.locations(places.map((place) => ({ uri: place.uri, range: { start: place.position, end: place.position } })), this.language.editor.getCaret(), this.language.project.i18n.t('editor:language.history.recent'));
|
|
36
|
-
}
|
|
37
|
-
visit(place) {
|
|
38
|
-
if (place === null) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
this.language.visit(place);
|
|
5
|
+
language;
|
|
6
|
+
constructor(language) {
|
|
7
|
+
this.language = language;
|
|
8
|
+
const off = language.onKey(event => {
|
|
9
|
+
if (isShortcut(this.language.shortcuts.historyBack, event)) {
|
|
10
|
+
this.back();
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
if (isShortcut(this.language.shortcuts.historyForward, event)) {
|
|
14
|
+
this.forward();
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (isShortcut(this.language.shortcuts.recentLocations, event)) {
|
|
18
|
+
this.recent();
|
|
42
19
|
return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}, KEY_PRIORITY.history);
|
|
23
|
+
language.onDispose(off);
|
|
24
|
+
}
|
|
25
|
+
/* Returns to where the caret was before the last jump; false when there is no such place. */
|
|
26
|
+
back() {
|
|
27
|
+
return this.visit(this.language.project.history.back(this.language.place));
|
|
28
|
+
}
|
|
29
|
+
forward() {
|
|
30
|
+
return this.visit(this.language.project.history.forward(this.language.place));
|
|
31
|
+
}
|
|
32
|
+
/* Lists the places of the history under the caret; choosing one jumps there like any other jump. */
|
|
33
|
+
recent() {
|
|
34
|
+
const places = this.language.project.history.recent(this.language.place);
|
|
35
|
+
this.language.locations(places.map(place => ({
|
|
36
|
+
uri: place.uri,
|
|
37
|
+
range: {
|
|
38
|
+
start: place.position,
|
|
39
|
+
end: place.position
|
|
40
|
+
}
|
|
41
|
+
})), this.language.editor.getCaret(), this.language.project.i18n.t('editor:language.history.recent'));
|
|
42
|
+
}
|
|
43
|
+
visit(place) {
|
|
44
|
+
if (place === null) {
|
|
45
|
+
return false;
|
|
43
46
|
}
|
|
44
|
-
|
|
47
|
+
this.language.visit(place);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
}
|
package/dist/holder.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/* One value that an effect sets and a render reads through `useSyncExternalStore`, without a state update inside the effect. */
|
|
2
2
|
export function createHolder() {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
3
|
+
let value = null;
|
|
4
|
+
const listeners = new Set();
|
|
5
|
+
return {
|
|
6
|
+
get: () => value,
|
|
7
|
+
set: next => {
|
|
8
|
+
value = next;
|
|
9
|
+
for (const listener of [...listeners]) {
|
|
10
|
+
listener();
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
subscribe: listener => {
|
|
14
|
+
listeners.add(listener);
|
|
15
|
+
return () => {
|
|
16
|
+
listeners.delete(listener);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
package/dist/host-types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|