@vscode/markdown-editor 0.0.2-11 → 0.0.2-110
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 +31 -0
- package/dist/commands.d.ts +67 -0
- package/dist/commands.js +185 -0
- package/dist/commands.js.map +1 -0
- package/dist/config-BGeaJqWk.js +286 -0
- package/dist/config-BGeaJqWk.js.map +1 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +1690 -140
- package/dist/index.js +7047 -2100
- package/dist/index.js.map +1 -1
- package/dist/markdown-editor.css +1 -0
- package/dist/stringEdit-CVDbCUBY.js +215 -0
- package/dist/stringEdit-CVDbCUBY.js.map +1 -0
- package/dist/web-editors.d.ts +297 -0
- package/dist/web-editors.js +7359 -0
- package/dist/web-editors.js.map +1 -0
- package/package.json +54 -15
- package/src/contrib/comments/commentInput.css +89 -0
- package/src/contrib/comments/commentWidget.css +60 -0
- package/src/contrib/find/find.css +347 -0
- package/src/view/editor.css +1196 -32
- package/src/view/themes/default.css +13 -4
- package/src/view/themes/github.css +16 -13
- package/src/view/themes/vscode-default.css +397 -0
- package/src/view/themes/{vscode.css → vscode-github.css} +124 -62
- package/dist/_observables/assert.d.ts +0 -2
- package/dist/_observables/deps.d.ts +0 -28
- package/dist/_observables/disposables.d.ts +0 -19
- package/dist/_observables/equals.d.ts +0 -32
- package/dist/_observables/index.d.ts +0 -2
- package/dist/_observables/observableInternal/base.d.ts +0 -172
- package/dist/_observables/observableInternal/changeTracker.d.ts +0 -44
- package/dist/_observables/observableInternal/commonFacade/cancellation.d.ts +0 -24
- package/dist/_observables/observableInternal/commonFacade/deps.d.ts +0 -24
- package/dist/_observables/observableInternal/debugLocation.d.ts +0 -21
- package/dist/_observables/observableInternal/debugName.d.ts +0 -33
- package/dist/_observables/observableInternal/experimental/deferUnobserve.d.ts +0 -16
- package/dist/_observables/observableInternal/experimental/reducer.d.ts +0 -37
- package/dist/_observables/observableInternal/experimental/utils.d.ts +0 -15
- package/dist/_observables/observableInternal/index.d.ts +0 -25
- package/dist/_observables/observableInternal/logging/consoleObservableLogger.d.ts +0 -40
- package/dist/_observables/observableInternal/logging/debugGetDependencyGraph.d.ts +0 -4
- package/dist/_observables/observableInternal/logging/debugger/debuggerRpc.d.ts +0 -4
- package/dist/_observables/observableInternal/logging/debugger/devToolsLogger.d.ts +0 -43
- package/dist/_observables/observableInternal/logging/debugger/rpc.d.ts +0 -41
- package/dist/_observables/observableInternal/logging/debugger/utils.d.ts +0 -13
- package/dist/_observables/observableInternal/logging/logging.d.ts +0 -30
- package/dist/_observables/observableInternal/map.d.ts +0 -18
- package/dist/_observables/observableInternal/observables/baseObservable.d.ts +0 -58
- package/dist/_observables/observableInternal/observables/constObservable.d.ts +0 -5
- package/dist/_observables/observableInternal/observables/derived.d.ts +0 -46
- package/dist/_observables/observableInternal/observables/derivedImpl.d.ts +0 -83
- package/dist/_observables/observableInternal/observables/lazyObservableValue.d.ts +0 -27
- package/dist/_observables/observableInternal/observables/observableFromEvent.d.ts +0 -37
- package/dist/_observables/observableInternal/observables/observableSignal.d.ts +0 -11
- package/dist/_observables/observableInternal/observables/observableSignalFromEvent.d.ts +0 -5
- package/dist/_observables/observableInternal/observables/observableValue.d.ts +0 -37
- package/dist/_observables/observableInternal/observables/observableValueOpts.d.ts +0 -8
- package/dist/_observables/observableInternal/reactions/autorun.d.ts +0 -56
- package/dist/_observables/observableInternal/reactions/autorunImpl.d.ts +0 -53
- package/dist/_observables/observableInternal/set.d.ts +0 -17
- package/dist/_observables/observableInternal/transaction.d.ts +0 -27
- package/dist/_observables/observableInternal/utils/promise.d.ts +0 -75
- package/dist/_observables/observableInternal/utils/runOnChange.d.ts +0 -7
- package/dist/_observables/observableInternal/utils/utils.d.ts +0 -43
- package/dist/_observables/observableInternal/utils/utilsCancellation.d.ts +0 -10
- package/dist/_observables/observableInternal/utils/valueWithChangeEvent.d.ts +0 -10
- package/dist/_observables/utils.d.ts +0 -15
- package/dist/observables.d.ts +0 -4
- package/dist/observables.js +0 -439
- package/dist/observables.js.map +0 -1
- package/dist/runOnChange-C00UIwqQ.js +0 -1538
- package/dist/runOnChange-C00UIwqQ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
import { Disposable } from '
|
|
2
|
-
import { IDisposable } from '
|
|
3
|
-
import { IObservable } from '
|
|
4
|
-
import { IObservableWithChange } from '
|
|
5
|
-
import { ISettableObservable } from '
|
|
6
|
-
import { ITransaction } from '
|
|
1
|
+
import { Disposable } from '@vscode/observables';
|
|
2
|
+
import { IDisposable } from '@vscode/observables';
|
|
3
|
+
import { IObservable } from '@vscode/observables';
|
|
4
|
+
import { IObservableWithChange } from '@vscode/observables';
|
|
5
|
+
import { ISettableObservable } from '@vscode/observables';
|
|
6
|
+
import { ITransaction } from '@vscode/observables';
|
|
7
7
|
import { MonarchTokenizer } from 'monaco-editor/esm/vs/editor/standalone/common/monarch/monarchLexer.js';
|
|
8
8
|
|
|
9
|
+
declare interface AddedItem {
|
|
10
|
+
readonly kind: 'added';
|
|
11
|
+
readonly node: AstNode;
|
|
12
|
+
readonly modifiedStart: number;
|
|
13
|
+
readonly insertedLocal: readonly AnnotatedRange[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A word/character-level highlight inside a single block, in that block's
|
|
18
|
+
* *local* coordinate space (`0` = block start). `inserted` ranges live on a
|
|
19
|
+
* modified/added block, `deleted` ranges on an original/removed block.
|
|
20
|
+
*/
|
|
21
|
+
declare interface AnnotatedRange {
|
|
22
|
+
readonly range: OffsetRange;
|
|
23
|
+
readonly kind: 'inserted' | 'deleted';
|
|
24
|
+
}
|
|
25
|
+
|
|
9
26
|
/** Every concrete node kind, for exhaustive consumer-side dispatch. */
|
|
10
|
-
export declare type AnyAstNode = TextAstNode | MarkerAstNode | GlueAstNode | ThematicBreakAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode | HeadingAstNode | ParagraphAstNode | CodeBlockAstNode | MathBlockAstNode | BlockQuoteAstNode | ListAstNode | ListItemAstNode | TableAstNode | TableRowAstNode | TableCellAstNode | DocumentAstNode;
|
|
27
|
+
export declare type AnyAstNode = TextAstNode | MarkerAstNode | GlueAstNode | ThematicBreakAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode | HeadingAstNode | ParagraphAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | VideoAstNode | BlockQuoteAstNode | ListAstNode | ListItemAstNode | TableAstNode | TableRowAstNode | TableCellAstNode | DocumentAstNode | UnhandledBlockAstNode;
|
|
11
28
|
|
|
12
|
-
declare type AnyViewData = DocumentViewData | BlockViewData | InlineViewData | ListItemViewData | TableRowViewData | TableCellViewData | MarkerViewData | GlueViewData;
|
|
29
|
+
declare type AnyViewData = DocumentViewData | BlockViewData | InlineViewData | ListItemViewData | TableRowViewData | TableCellViewData | MarkerViewData | GlueViewData | DiffHunkViewData | DiffDecorationViewData;
|
|
13
30
|
|
|
14
31
|
export declare abstract class AstNode {
|
|
15
32
|
abstract readonly kind: string;
|
|
@@ -55,15 +72,16 @@ declare interface AstVisualizationNode {
|
|
|
55
72
|
}
|
|
56
73
|
|
|
57
74
|
/**
|
|
58
|
-
* Strategy for hosts that
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* (`navigator.clipboard`), which webviews are granted.
|
|
75
|
+
* Strategy for hosts that intercept native clipboard shortcuts, notably
|
|
76
|
+
* VS Code webviews. Their preload prevents the default Ctrl/Cmd+C/X/V handling
|
|
77
|
+
* and forwards the keydowns to the host. This strategy handles the keystrokes
|
|
78
|
+
* directly using the async {@link Clipboard} API (`navigator.clipboard`),
|
|
79
|
+
* which webviews are granted.
|
|
64
80
|
*
|
|
65
81
|
* Cut deletes synchronously once the text is captured; the clipboard write is
|
|
66
82
|
* fire-and-forget. Paste must wait for the async read before inserting.
|
|
83
|
+
* Handled keydowns must not reach the host, which may replay native clipboard
|
|
84
|
+
* commands even when the browser's default has been prevented.
|
|
67
85
|
*/
|
|
68
86
|
export declare class AsyncClipboardStrategy implements IClipboardStrategy {
|
|
69
87
|
private readonly _clipboard;
|
|
@@ -71,7 +89,7 @@ export declare class AsyncClipboardStrategy implements IClipboardStrategy {
|
|
|
71
89
|
connect(context: IClipboardContext): IDisposable;
|
|
72
90
|
}
|
|
73
91
|
|
|
74
|
-
export declare type BlockAstNode = HeadingAstNode | ParagraphAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode;
|
|
92
|
+
export declare type BlockAstNode = HeadingAstNode | ParagraphAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | VideoAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode | UnhandledBlockAstNode;
|
|
75
93
|
|
|
76
94
|
/**
|
|
77
95
|
* A block-level node. Every block may carry a {@link leadingTrivia} glue — the
|
|
@@ -92,7 +110,7 @@ declare abstract class BlockAstNodeBase extends AstNode {
|
|
|
92
110
|
/**
|
|
93
111
|
* One block's place in the rendered document.
|
|
94
112
|
*
|
|
95
|
-
*
|
|
113
|
+
* Geometry is in editor-local CSS pixels. `height` is either a real DOM measurement
|
|
96
114
|
* (`isMeasured: true`) or an estimate produced when the block is not
|
|
97
115
|
* currently mounted (`isMeasured: false`). Estimates exist so virtual
|
|
98
116
|
* rendering can size the scroll container without mounting every block.
|
|
@@ -107,6 +125,13 @@ export declare interface BlockMeasurement {
|
|
|
107
125
|
readonly block: BlockAstNode;
|
|
108
126
|
readonly absoluteStart: number;
|
|
109
127
|
readonly height: number;
|
|
128
|
+
/** Local border box when mounted and measured. */
|
|
129
|
+
readonly rect: Rect2D | undefined;
|
|
130
|
+
/** Local horizontal padding-box clip when this block scrolls horizontally. */
|
|
131
|
+
readonly viewportClip: {
|
|
132
|
+
readonly left: number;
|
|
133
|
+
readonly right: number;
|
|
134
|
+
} | undefined;
|
|
110
135
|
readonly isMeasured: boolean;
|
|
111
136
|
readonly visualLineMap: VisualLineMap | undefined;
|
|
112
137
|
readonly viewNode: ViewNode | undefined;
|
|
@@ -126,11 +151,22 @@ export declare class BlockQuoteAstNode extends BlockAstNodeBase {
|
|
|
126
151
|
declare class BlockQuoteViewData {
|
|
127
152
|
readonly ast: BlockQuoteAstNode;
|
|
128
153
|
readonly content: readonly AnyViewData[];
|
|
154
|
+
/** False while a pending paragraph replaces the final marker-only line. */
|
|
155
|
+
readonly showFinalMarkerOnlyLine: boolean;
|
|
129
156
|
readonly kind = "blockQuote";
|
|
130
|
-
constructor(ast: BlockQuoteAstNode, content: readonly AnyViewData[]
|
|
157
|
+
constructor(ast: BlockQuoteAstNode, content: readonly AnyViewData[],
|
|
158
|
+
/** False while a pending paragraph replaces the final marker-only line. */
|
|
159
|
+
showFinalMarkerOnlyLine: boolean);
|
|
131
160
|
}
|
|
132
161
|
|
|
133
|
-
|
|
162
|
+
/**
|
|
163
|
+
* All blocks whose source range intersects `[start, endExclusive]`. A
|
|
164
|
+
* collapsed range (start === endExclusive) matches the block containing
|
|
165
|
+
* that offset (with the same boundary rule as {@link findBlockAtOffset}).
|
|
166
|
+
*/
|
|
167
|
+
export declare function blocksIntersecting(doc: DocumentAstNode, start: SourceOffset, endExclusive: SourceOffset): BlockAstNode[];
|
|
168
|
+
|
|
169
|
+
declare type BlockViewData = HeadingViewData | ParagraphViewData | FrontMatterViewData | CodeBlockViewData | MathBlockViewData | ThematicBreakViewData | VideoViewData | BlockQuoteViewData | ListViewData | TableViewData | UnhandledBlockViewData;
|
|
134
170
|
|
|
135
171
|
/**
|
|
136
172
|
* Base view node for everything the editor renders, generic over the
|
|
@@ -151,6 +187,17 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
|
|
|
151
187
|
constructor(data: T, dom: globalThis.Node, children: readonly ViewNode[]);
|
|
152
188
|
get block(): BlockAstNode;
|
|
153
189
|
get element(): HTMLElement;
|
|
190
|
+
/**
|
|
191
|
+
* The horizontal scroll viewport for selection/caret clipping
|
|
192
|
+
* ({@link blockViewportClip}). For most blocks the scroller *is*
|
|
193
|
+
* {@link element} — a code / math / unhandled block's `element` is the very
|
|
194
|
+
* `overflow-x: auto` box that scrolls. A table is the exception: its
|
|
195
|
+
* `element` stays the inner `<table>` (so the active/markers classes and
|
|
196
|
+
* `.md-table` theme styling are unaffected), but the box that actually
|
|
197
|
+
* scrolls is the wrapping `.md-table-wrapper`, so {@link TableViewNode}
|
|
198
|
+
* overrides this to return that wrapper.
|
|
199
|
+
*/
|
|
200
|
+
get scrollElement(): HTMLElement;
|
|
154
201
|
/**
|
|
155
202
|
* Whether this already-built node can stand in for `data` unchanged. The
|
|
156
203
|
* builder preserves view-data identity for any subtree whose ast and
|
|
@@ -158,7 +205,7 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
|
|
|
158
205
|
* single identity check captures "nothing in my subtree changed" — and its
|
|
159
206
|
* whole subtree, and any session it owns, are kept as-is.
|
|
160
207
|
*/
|
|
161
|
-
canReuse(data: AnyViewData): boolean;
|
|
208
|
+
canReuse(data: AnyViewData, _options: BlockViewOptions | undefined): boolean;
|
|
162
209
|
/**
|
|
163
210
|
* Called by the view after this block is mounted and measured, with the
|
|
164
211
|
* block's rendered height in px. The default is a no-op; subclasses whose
|
|
@@ -171,12 +218,20 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
|
|
|
171
218
|
export declare interface BlockViewOptions {
|
|
172
219
|
readonly renderCustomCodeBlock?: (language: string, content: string) => HTMLElement | undefined;
|
|
173
220
|
readonly onToggleCheckbox?: (item: ListItemAstNode, newChecked: boolean) => void;
|
|
221
|
+
/** Temporarily yields the host editor's text input while a nested control owns focus. */
|
|
222
|
+
readonly suspendEditContextWhileFocused?: (element: HTMLElement) => IDisposable;
|
|
223
|
+
/**
|
|
224
|
+
* Supplies live, declarative metadata for recognized links. The editor owns
|
|
225
|
+
* the markup and styling; providers own lookup, caching, and updates.
|
|
226
|
+
*/
|
|
227
|
+
readonly linkPresentationProvider?: ILinkPresentationProvider;
|
|
174
228
|
/**
|
|
175
229
|
* Opens a link's URL. Called when the user activates a link: a plain click
|
|
176
230
|
* while the link's block is inactive (rendered), or a Ctrl/Cmd+click while it
|
|
177
|
-
* is active (source shown).
|
|
231
|
+
* is active (source shown). Return `false` to use the anchor's native
|
|
232
|
+
* navigation behavior.
|
|
178
233
|
*/
|
|
179
|
-
readonly onOpenLink?: (url: string, event: MouseEvent) => void;
|
|
234
|
+
readonly onOpenLink?: (url: string, event: MouseEvent) => false | void;
|
|
180
235
|
/**
|
|
181
236
|
* Colours fenced code blocks. When set, a code block's content is rendered
|
|
182
237
|
* as a sequence of token spans instead of one plain text node. This is the
|
|
@@ -196,16 +251,43 @@ export declare interface BlockViewOptions {
|
|
|
196
251
|
* `katexEditableIdentifiers.ts`).
|
|
197
252
|
*/
|
|
198
253
|
readonly renderMath?: (request: MathRenderRequest) => MathRendering | undefined;
|
|
254
|
+
/**
|
|
255
|
+
* Pluggable factory for an in-place, interactive editor that replaces the
|
|
256
|
+
* *rendered* (inactive) form of a fenced code block — see
|
|
257
|
+
* {@link IEmbeddedCodeEditor}. When it returns an editor for the block's
|
|
258
|
+
* language, that editor's element is mounted instead of the highlighted
|
|
259
|
+
* code, and content flows both ways as string edits. Returning `undefined`
|
|
260
|
+
* falls back to the default rendering. EXPERIMENTAL.
|
|
261
|
+
*/
|
|
262
|
+
readonly embeddedCodeEditorFactory?: IEmbeddedCodeEditorFactory;
|
|
263
|
+
/** Current read-only state forwarded to embedded code editors. */
|
|
264
|
+
readonly embeddedCodeEditorReadOnly?: boolean;
|
|
265
|
+
/** Identity used to invalidate previously created embedded editors. */
|
|
266
|
+
readonly embeddedCodeEditorFactoryVersion?: unknown;
|
|
267
|
+
/**
|
|
268
|
+
* Called when an {@link IEmbeddedCodeEditor} edits its content. `contentEdit`
|
|
269
|
+
* is in the block's *content* coordinates; the host translates it to a
|
|
270
|
+
* document edit (via {@link CodeBlockAstNode.codeOffset} and the block's
|
|
271
|
+
* offset) and applies it to the model.
|
|
272
|
+
*/
|
|
273
|
+
readonly onEmbeddedCodeEditorEdit?: (block: CodeBlockAstNode, contentEdit: StringEdit) => void;
|
|
199
274
|
}
|
|
200
275
|
|
|
201
276
|
export declare class CodeBlockAstNode extends BlockAstNodeBase {
|
|
277
|
+
/** First token of the fenced code block info string, used for syntax highlighting. */
|
|
202
278
|
readonly language: string;
|
|
279
|
+
/** Complete fenced code block info string, including metadata after the language token. */
|
|
280
|
+
readonly infoString: string;
|
|
203
281
|
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
204
282
|
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
205
283
|
readonly kind = "codeBlock";
|
|
206
284
|
private _previous?;
|
|
207
285
|
private _contentEdit?;
|
|
208
|
-
constructor(
|
|
286
|
+
constructor(
|
|
287
|
+
/** First token of the fenced code block info string, used for syntax highlighting. */
|
|
288
|
+
language: string,
|
|
289
|
+
/** Complete fenced code block info string, including metadata after the language token. */
|
|
290
|
+
infoString: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
|
|
209
291
|
get children(): readonly AstNode[];
|
|
210
292
|
get openFence(): MarkerAstNode | undefined;
|
|
211
293
|
get closeFence(): MarkerAstNode | undefined;
|
|
@@ -271,10 +353,226 @@ export declare class CodeBlockViewNode extends BlockViewNode<CodeBlockViewData>
|
|
|
271
353
|
* its predecessor's subscription explicitly.
|
|
272
354
|
*/
|
|
273
355
|
private _snapshotSub;
|
|
356
|
+
/**
|
|
357
|
+
* An in-place interactive editor (e.g. an iframe) mounted instead of the
|
|
358
|
+
* rendered code. Like {@link _session} it is adopted from `previous` across
|
|
359
|
+
* rebuilds so the underlying editor keeps its state, and must be disposed
|
|
360
|
+
* manually (a node reused as `previous` is never {@link dispose}d).
|
|
361
|
+
*/
|
|
362
|
+
private _embeddedEditor;
|
|
363
|
+
private readonly _embeddedEditorFactoryVersion;
|
|
364
|
+
private readonly _embeddedEditorReadOnly;
|
|
365
|
+
canReuse(data: AnyViewData, options: BlockViewOptions | undefined): boolean;
|
|
274
366
|
constructor(data: CodeBlockViewData, options: BlockViewOptions | undefined, previous: ViewNode | undefined);
|
|
275
367
|
dispose(): void;
|
|
276
368
|
}
|
|
277
369
|
|
|
370
|
+
/**
|
|
371
|
+
* Canonical editor command catalog. Standalone keyboard handling and host
|
|
372
|
+
* integrations derive their command registration and default keybindings from
|
|
373
|
+
* this list.
|
|
374
|
+
*/
|
|
375
|
+
export declare const commands: readonly EditorCommandDefinition[];
|
|
376
|
+
|
|
377
|
+
/** A persistent comment anchored to a source range. */
|
|
378
|
+
declare interface Comment_2 {
|
|
379
|
+
readonly id: string;
|
|
380
|
+
/** Source range the comment refers to (its highlighted region). */
|
|
381
|
+
readonly range: OffsetRange;
|
|
382
|
+
/** The comment text. */
|
|
383
|
+
readonly body: string;
|
|
384
|
+
/** Display name of the author, if any. */
|
|
385
|
+
readonly author?: string;
|
|
386
|
+
/** Creation time (epoch ms), used to render a relative timestamp. */
|
|
387
|
+
readonly createdAt?: number;
|
|
388
|
+
}
|
|
389
|
+
export { Comment_2 as Comment }
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* The compact editing state for a markdown comment.
|
|
393
|
+
*
|
|
394
|
+
* The widget owns its DOM and draft state but not its position. The comment-mode
|
|
395
|
+
* controller mounts it next to the active selection.
|
|
396
|
+
*/
|
|
397
|
+
export declare class CommentInputWidget extends Disposable {
|
|
398
|
+
private readonly _options?;
|
|
399
|
+
readonly element: HTMLElement;
|
|
400
|
+
private readonly _textarea;
|
|
401
|
+
private readonly _measure;
|
|
402
|
+
private readonly _submitButton;
|
|
403
|
+
private readonly _value;
|
|
404
|
+
/** Live, untrimmed textarea content. */
|
|
405
|
+
get value(): IObservable<string>;
|
|
406
|
+
/** The raw textarea, exposed so a host can move focus into it. */
|
|
407
|
+
get inputElement(): HTMLTextAreaElement;
|
|
408
|
+
constructor(_options?: CommentInputWidgetOptions | undefined);
|
|
409
|
+
focus(): void;
|
|
410
|
+
setText(text: string): void;
|
|
411
|
+
clear(): void;
|
|
412
|
+
private _submit;
|
|
413
|
+
private _autoSize;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export declare interface CommentInputWidgetOptions {
|
|
417
|
+
/** Placeholder shown while the textarea is empty. Defaults to "Add comment". */
|
|
418
|
+
readonly placeholder?: string;
|
|
419
|
+
/** Called after the textarea changes size. */
|
|
420
|
+
readonly onDidChangeSize?: () => void;
|
|
421
|
+
/**
|
|
422
|
+
* Called when the user submits a non-empty comment (Enter or the add button).
|
|
423
|
+
* The text is trimmed; never called with an empty string.
|
|
424
|
+
*/
|
|
425
|
+
readonly onSubmit?: (text: string) => void;
|
|
426
|
+
/** Called when the user dismisses the input (Escape). */
|
|
427
|
+
readonly onCancel?: () => void;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Comment mode — a compact "add a comment" affordance layered on top of
|
|
432
|
+
* the editor *without modifying it*. It reads the editor's public observables
|
|
433
|
+
* ({@link EditorModel.readonlyMode}, {@link EditorModel.selection}) and the
|
|
434
|
+
* exposed {@link EditorView.caretRect} geometry, and mounts a
|
|
435
|
+
* {@link CommentInputWidget} into {@link EditorView.overlayContainer}.
|
|
436
|
+
*
|
|
437
|
+
* Behaviour:
|
|
438
|
+
* - Only active in read-only mode (the "review" view).
|
|
439
|
+
* - When a user-created selection is non-empty, the input box appears next to
|
|
440
|
+
* the caret (the selection's active end) but does NOT take focus, so keyboard
|
|
441
|
+
* selection keeps working. Programmatic selections such as find matches do
|
|
442
|
+
* not summon it. Press Tab to move focus into the box, then type.
|
|
443
|
+
* - The box appears on mouse-up, not mid-drag, so it doesn't flicker/jump
|
|
444
|
+
* while a selection is being dragged out (keyboard selection shows at once).
|
|
445
|
+
* - While the box has focus or holds a draft it is frozen in place (selection
|
|
446
|
+
* changes, drags and clicks no longer move it). It is dismissed by Escape,
|
|
447
|
+
* by submitting, or by blurring an empty box.
|
|
448
|
+
* - The editor's logical caret geometry remains available for anchoring in
|
|
449
|
+
* read-only mode even though the painted caret is hidden. While the box has
|
|
450
|
+
* focus, `.md-comment-active` also suppresses the painted caret in any mode.
|
|
451
|
+
*/
|
|
452
|
+
export declare class CommentModeController extends Disposable {
|
|
453
|
+
private readonly _model;
|
|
454
|
+
private readonly _view;
|
|
455
|
+
private readonly _options?;
|
|
456
|
+
private static _isCommentableSelectionSource;
|
|
457
|
+
private readonly _widget;
|
|
458
|
+
private readonly _gap;
|
|
459
|
+
private _visible;
|
|
460
|
+
private _anchorX;
|
|
461
|
+
private _pinnedRange;
|
|
462
|
+
/**
|
|
463
|
+
* The range a comment was just submitted for. The box stays hidden for it
|
|
464
|
+
* until the selection changes, so submitting doesn't immediately re-summon an
|
|
465
|
+
* empty box on the still-selected text.
|
|
466
|
+
*/
|
|
467
|
+
private _submittedRange;
|
|
468
|
+
constructor(_model: EditorModel, _view: EditorView, _options?: CommentModeControllerOptions | undefined);
|
|
469
|
+
private _update;
|
|
470
|
+
private _show;
|
|
471
|
+
private _layoutHorizontally;
|
|
472
|
+
/** Force-hide and clear the box (used by Escape and submit). */
|
|
473
|
+
private _hide;
|
|
474
|
+
/**
|
|
475
|
+
* Hide unless the user is engaged with the box: it has focus or holds a
|
|
476
|
+
* non-empty draft. This preserves in-progress text and keeps a focused box
|
|
477
|
+
* open (it is dismissed explicitly via Escape/submit, or by blurring it).
|
|
478
|
+
*/
|
|
479
|
+
private _autoHide;
|
|
480
|
+
private _widgetHasFocus;
|
|
481
|
+
/**
|
|
482
|
+
* The visible viewport (client coords) used for the flip-above decision: the
|
|
483
|
+
* nearest scrollable ancestor of the editor. `.md-editor` itself spans the
|
|
484
|
+
* full document height and never clips, so measuring against it would always
|
|
485
|
+
* report room below. Falls back to the window when nothing scrolls.
|
|
486
|
+
*/
|
|
487
|
+
private _getViewportRect;
|
|
488
|
+
private _hideAndRefocus;
|
|
489
|
+
private _submit;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export declare interface CommentModeControllerOptions {
|
|
493
|
+
/** Called when the user submits a comment for the current selection. */
|
|
494
|
+
readonly onSubmit?: (submission: CommentSubmission) => void;
|
|
495
|
+
/** Gap (px) between the bottom of the selection and the top of the input box. */
|
|
496
|
+
readonly gap?: number;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Seedable store of {@link Comment}s for the comment-mode contribution. It has
|
|
501
|
+
* no opinion on rendering or persistence — a host seeds it via
|
|
502
|
+
* {@link set}/{@link add} and observes {@link comments}.
|
|
503
|
+
*/
|
|
504
|
+
export declare class CommentsModel {
|
|
505
|
+
private readonly _comments;
|
|
506
|
+
/** Monotonic counter for ids of comments created via {@link create}. */
|
|
507
|
+
private _sequence;
|
|
508
|
+
/** The current comments, in insertion order. */
|
|
509
|
+
get comments(): IObservable<readonly Comment_2[]>;
|
|
510
|
+
/** Replace the whole comment set. */
|
|
511
|
+
set(comments: readonly Comment_2[]): void;
|
|
512
|
+
/**
|
|
513
|
+
* Create a comment from a user submission and append it, generating its `id`
|
|
514
|
+
* and `createdAt` here so id/time allocation stays the store's concern (the
|
|
515
|
+
* UI only supplies the range and text). Returns the created comment.
|
|
516
|
+
*/
|
|
517
|
+
create(input: {
|
|
518
|
+
range: OffsetRange;
|
|
519
|
+
body: string;
|
|
520
|
+
author?: string;
|
|
521
|
+
}): Comment_2;
|
|
522
|
+
/** Append a comment. */
|
|
523
|
+
add(comment: Comment_2): void;
|
|
524
|
+
/** Remove a comment by id. */
|
|
525
|
+
remove(id: string): void;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/** A comment the user submitted, with the source range it was anchored to. */
|
|
529
|
+
export declare interface CommentSubmission {
|
|
530
|
+
readonly text: string;
|
|
531
|
+
readonly range: OffsetRange;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/** Displays posted comments beside their source ranges. */
|
|
535
|
+
export declare class CommentsView extends Disposable {
|
|
536
|
+
private readonly _model;
|
|
537
|
+
private readonly _view;
|
|
538
|
+
private readonly _layer;
|
|
539
|
+
private readonly _entries;
|
|
540
|
+
private _order;
|
|
541
|
+
private _pendingRevealCommentId;
|
|
542
|
+
constructor(_model: CommentsModel, _view: EditorView);
|
|
543
|
+
revealComment(id: string): void;
|
|
544
|
+
private _reconcile;
|
|
545
|
+
private _relayout;
|
|
546
|
+
private _revealPendingComment;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/** Compact posted state for a markdown comment. */
|
|
550
|
+
export declare class CommentWidget {
|
|
551
|
+
private readonly _domNode;
|
|
552
|
+
private readonly _disposables;
|
|
553
|
+
get element(): HTMLElement;
|
|
554
|
+
constructor(options: CommentWidgetOptions);
|
|
555
|
+
dispose(): void;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export declare interface CommentWidgetOptions {
|
|
559
|
+
/** The posted comment body. */
|
|
560
|
+
readonly body: string;
|
|
561
|
+
/** If provided, shows a delete action and invokes it when activated. */
|
|
562
|
+
readonly onDelete?: () => void;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/** The lossless source slices of a complete block HTML comment. */
|
|
566
|
+
declare interface CompleteHtmlCommentSource extends HtmlCommentSourceBase {
|
|
567
|
+
readonly kind: 'complete';
|
|
568
|
+
readonly closing: '-->';
|
|
569
|
+
readonly trailingWhitespace: string;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export declare const copyLinesDown: EditCommand;
|
|
573
|
+
|
|
574
|
+
export declare const copyLinesUp: EditCommand;
|
|
575
|
+
|
|
278
576
|
/**
|
|
279
577
|
* A {@link MonacoSyntaxHighlighter} preloaded with a handful of common Monarch
|
|
280
578
|
* grammars (plus the usual short aliases). Unknown languages fall back to an
|
|
@@ -285,13 +583,16 @@ export declare class CodeBlockViewNode extends BlockViewNode<CodeBlockViewData>
|
|
|
285
583
|
*/
|
|
286
584
|
export declare function createDefaultMonacoSyntaxHighlighter(monaco: IMonarchApi, grammars: IDefaultMonarchGrammars): MonacoSyntaxHighlighter;
|
|
287
585
|
|
|
288
|
-
export declare type CursorCommand = (ctx: CursorCommandContext) =>
|
|
586
|
+
export declare type CursorCommand = (ctx: CursorCommandContext) => CursorPosition;
|
|
289
587
|
|
|
290
588
|
export declare interface CursorCommandContext {
|
|
291
589
|
readonly text: string;
|
|
292
590
|
readonly selection: Selection_2;
|
|
293
591
|
readonly document: DocumentAstNode;
|
|
294
592
|
readonly activeBlock: BlockAstNode | undefined;
|
|
593
|
+
readonly markerVisibleBlocks: ReadonlySet<BlockAstNode>;
|
|
594
|
+
readonly wordNavigationConfig: WordNavigationConfig;
|
|
595
|
+
readonly cursorPosition: CursorPosition;
|
|
295
596
|
}
|
|
296
597
|
|
|
297
598
|
export declare const cursorDocumentEnd: CursorCommand;
|
|
@@ -300,6 +601,8 @@ export declare const cursorDocumentStart: CursorCommand;
|
|
|
300
601
|
|
|
301
602
|
export declare const cursorDown: VisualCursorCommand;
|
|
302
603
|
|
|
604
|
+
export declare type CursorKeyboardAction = 'left' | 'right' | 'up' | 'down' | 'wordLeft' | 'wordRight' | 'visualLineStart' | 'visualLineEnd' | 'logicalLineStart' | 'logicalLineEnd' | 'documentStart' | 'documentEnd';
|
|
605
|
+
|
|
303
606
|
export declare const cursorLeft: CursorCommand;
|
|
304
607
|
|
|
305
608
|
export declare const cursorLineEnd: CursorCommand;
|
|
@@ -309,12 +612,26 @@ export declare const cursorLineStart: CursorCommand;
|
|
|
309
612
|
export declare const cursorMoveLeft: CursorCommand;
|
|
310
613
|
|
|
311
614
|
export declare interface CursorMoveResult {
|
|
312
|
-
readonly
|
|
615
|
+
readonly position: CursorPosition;
|
|
313
616
|
readonly desiredColumn: number | undefined;
|
|
314
617
|
}
|
|
315
618
|
|
|
316
619
|
export declare const cursorMoveRight: CursorCommand;
|
|
317
620
|
|
|
621
|
+
/** The cursor's position in either source text or a source-less visual line. */
|
|
622
|
+
export declare type CursorPosition = {
|
|
623
|
+
readonly kind: 'source';
|
|
624
|
+
readonly offset: SourceOffset;
|
|
625
|
+
} | {
|
|
626
|
+
readonly kind: 'virtual';
|
|
627
|
+
readonly line: VirtualCursorLine;
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
export declare namespace CursorPosition {
|
|
631
|
+
export function source(offset: SourceOffset): CursorPosition;
|
|
632
|
+
export function virtual(line: VirtualCursorLine): CursorPosition;
|
|
633
|
+
}
|
|
634
|
+
|
|
318
635
|
export declare const cursorRight: CursorCommand;
|
|
319
636
|
|
|
320
637
|
export declare const cursorUp: VisualCursorCommand;
|
|
@@ -323,49 +640,131 @@ export declare const cursorUp: VisualCursorCommand;
|
|
|
323
640
|
* Owns the blinking cursor DOM element.
|
|
324
641
|
*
|
|
325
642
|
* The rendering pipeline is a single `derived` whose compute callback
|
|
326
|
-
* asks the {@link VisualLineMap} for the caret rect at the current
|
|
327
|
-
*
|
|
643
|
+
* asks the {@link VisualLineMap} for the caret rect at the current source or
|
|
644
|
+
* virtual position, writes it to {@link element}, and returns a
|
|
328
645
|
* {@link CursorViewRendering} value as proof. An autorun keeps the
|
|
329
646
|
* derived subscribed.
|
|
330
647
|
*/
|
|
331
648
|
export declare class CursorView extends Disposable {
|
|
332
|
-
private readonly _parent;
|
|
333
649
|
readonly element: HTMLElement;
|
|
334
650
|
readonly rendering: IObservable<CursorViewRendering>;
|
|
335
|
-
constructor(
|
|
651
|
+
constructor(options: CursorViewOptions);
|
|
336
652
|
}
|
|
337
653
|
|
|
338
654
|
export declare interface CursorViewOptions {
|
|
339
|
-
readonly
|
|
655
|
+
readonly position: IObservable<CursorPosition | undefined>;
|
|
340
656
|
readonly visualLineMap: IObservable<VisualLineMap>;
|
|
341
657
|
/**
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* entry. Takes priority over the normal offset-based placement.
|
|
658
|
+
* The mounted blocks, used to hide the caret when it sits at an offset that
|
|
659
|
+
* has been scrolled out of its (horizontally scrolling) block's viewport —
|
|
660
|
+
* matching how the selection is clipped there.
|
|
346
661
|
*/
|
|
347
|
-
readonly
|
|
662
|
+
readonly blocks?: IObservable<readonly SelectionBlock[]>;
|
|
348
663
|
}
|
|
349
664
|
|
|
350
665
|
export declare class CursorViewRendering {
|
|
351
|
-
readonly
|
|
666
|
+
readonly position: CursorPosition;
|
|
352
667
|
readonly visible: boolean;
|
|
353
668
|
readonly rect: Rect2D;
|
|
354
|
-
constructor(
|
|
669
|
+
constructor(position: CursorPosition, visible: boolean, rect: Rect2D);
|
|
355
670
|
}
|
|
356
671
|
|
|
672
|
+
export declare const cursorVisualLineEnd: VisualCursorCommand;
|
|
673
|
+
|
|
674
|
+
export declare const cursorVisualLineStart: VisualCursorCommand;
|
|
675
|
+
|
|
357
676
|
export declare const cursorWordLeft: CursorCommand;
|
|
358
677
|
|
|
359
678
|
export declare const cursorWordRight: CursorCommand;
|
|
360
679
|
|
|
680
|
+
export declare const DEFAULT_INDENTATION_CONFIG: IndentationConfig;
|
|
681
|
+
|
|
682
|
+
export declare const DEFAULT_WORD_NAVIGATION_CONFIG: WordNavigationConfig;
|
|
683
|
+
|
|
684
|
+
export declare const DEFAULT_WORD_SEPARATORS = "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";
|
|
685
|
+
|
|
361
686
|
export declare const deleteLeft: EditCommand;
|
|
362
687
|
|
|
688
|
+
export declare const deleteLineLeft: EditCommand;
|
|
689
|
+
|
|
690
|
+
export declare const deleteLineRight: EditCommand;
|
|
691
|
+
|
|
692
|
+
export declare const deleteLines: EditCommand;
|
|
693
|
+
|
|
363
694
|
export declare const deleteRight: EditCommand;
|
|
364
695
|
|
|
365
696
|
export declare const deleteWordLeft: EditCommand;
|
|
366
697
|
|
|
367
698
|
export declare const deleteWordRight: EditCommand;
|
|
368
699
|
|
|
700
|
+
/**
|
|
701
|
+
* A read-only "removed" decoration: an original block rendered (red) above its
|
|
702
|
+
* place in the modified document, occupying vertical space like a view-zone but
|
|
703
|
+
* contributing **zero** source length, so the editor's source mapping stays the
|
|
704
|
+
* modified document and editing is unaffected. Used for `removed` and the
|
|
705
|
+
* original side of a `replaced` block in editor diff mode.
|
|
706
|
+
*/
|
|
707
|
+
declare class DiffDecorationViewData {
|
|
708
|
+
readonly ast: AstNode;
|
|
709
|
+
readonly side: BlockViewData;
|
|
710
|
+
readonly deletedRanges: readonly DiffHighlightRange[];
|
|
711
|
+
/** True when the whole block was removed: solid red band, no word rects. */
|
|
712
|
+
readonly whole: boolean;
|
|
713
|
+
/** Absolute offset of this block in the *original* document. */
|
|
714
|
+
readonly originalStart: number;
|
|
715
|
+
readonly kind = "diffDecoration";
|
|
716
|
+
constructor(ast: AstNode, side: BlockViewData, deletedRanges: readonly DiffHighlightRange[],
|
|
717
|
+
/** True when the whole block was removed: solid red band, no word rects. */
|
|
718
|
+
whole: boolean,
|
|
719
|
+
/** Absolute offset of this block in the *original* document. */
|
|
720
|
+
originalStart: number);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/** A word/character highlight inside one diff side, in block-local coords. */
|
|
724
|
+
declare interface DiffHighlightRange {
|
|
725
|
+
readonly range: OffsetRange;
|
|
726
|
+
readonly kind: 'inserted' | 'deleted';
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* A changed block rendered as its original form stacked over its modified form
|
|
731
|
+
* (either side may be absent for a pure deletion/insertion). It is itself a
|
|
732
|
+
* document child the renderer mounts like a block; its {@link ast} is the
|
|
733
|
+
* surviving side's ast, used only for view-node identity/reuse.
|
|
734
|
+
*/
|
|
735
|
+
declare class DiffHunkViewData {
|
|
736
|
+
readonly ast: AstNode;
|
|
737
|
+
readonly original: DiffSideViewData | undefined;
|
|
738
|
+
readonly modified: DiffSideViewData | undefined;
|
|
739
|
+
readonly kind = "diffHunk";
|
|
740
|
+
constructor(ast: AstNode, original: DiffSideViewData | undefined, modified: DiffSideViewData | undefined);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* The recursive classification of a diff. Each item describes one aligned
|
|
745
|
+
* position in the merged document:
|
|
746
|
+
*
|
|
747
|
+
* - `unchanged` — render the (modified) node once, neutral.
|
|
748
|
+
* - `added` — exists only in the modified document (green).
|
|
749
|
+
* - `removed` — exists only in the original document (red).
|
|
750
|
+
* - `replaced` — a *leaf* block changed in place → render original over
|
|
751
|
+
* modified, with word-level {@link AnnotatedRange}s on each.
|
|
752
|
+
* - `nested` — a *container* changed → render it once and diff its
|
|
753
|
+
* {@link NestedItem.children} recursively.
|
|
754
|
+
*
|
|
755
|
+
* Offsets ({@link UnchangedItem.modifiedStart} etc.) are absolute in their
|
|
756
|
+
* respective documents, so a renderer/visualizer can slice the source text.
|
|
757
|
+
*/
|
|
758
|
+
declare type DiffItem = UnchangedItem | AddedItem | RemovedItem | ReplacedItem | NestedItem;
|
|
759
|
+
|
|
760
|
+
/** One side (original or modified) of a {@link DiffHunkViewData}. */
|
|
761
|
+
declare interface DiffSideViewData {
|
|
762
|
+
readonly view: BlockViewData;
|
|
763
|
+
/** Render in active form (markers/whitespace visible). */
|
|
764
|
+
readonly active: boolean;
|
|
765
|
+
readonly ranges: readonly DiffHighlightRange[];
|
|
766
|
+
}
|
|
767
|
+
|
|
369
768
|
export declare class DocumentAstNode extends AstNode {
|
|
370
769
|
readonly content: readonly (BlockAstNode | GlueAstNode)[];
|
|
371
770
|
readonly kind = "document";
|
|
@@ -390,14 +789,21 @@ declare interface DocumentBlockViewData {
|
|
|
390
789
|
readonly view: BlockViewData;
|
|
391
790
|
}
|
|
392
791
|
|
|
393
|
-
/** A mounted document child: a block, a run of inter-block glue,
|
|
394
|
-
* transient empty paragraph (see {@link PendingParagraphViewData})
|
|
792
|
+
/** A mounted document child: a block, a run of inter-block glue, the
|
|
793
|
+
* transient empty paragraph (see {@link PendingParagraphViewData}), or a
|
|
794
|
+
* {@link DiffHunkViewData diff hunk} (stacked original/modified blocks). */
|
|
395
795
|
declare interface DocumentChildViewData {
|
|
396
796
|
readonly absoluteStart: number;
|
|
397
797
|
/** For a block: selection reaches it. For glue: always false (unowned, hidden). */
|
|
398
798
|
readonly isActive: boolean;
|
|
399
|
-
readonly view: BlockViewData | GlueViewData | PendingParagraphViewData;
|
|
400
|
-
readonly kind: 'block' | 'glue' | 'pendingParagraph';
|
|
799
|
+
readonly view: BlockViewData | GlueViewData | PendingParagraphViewData | DiffHunkViewData | DiffDecorationViewData;
|
|
800
|
+
readonly kind: 'block' | 'glue' | 'pendingParagraph' | 'diffHunk' | 'diffDecoration';
|
|
801
|
+
/**
|
|
802
|
+
* Diff mode: how this (modified) block changed. `added` = a whole new block
|
|
803
|
+
* (strong green band, no inline rects); `modified` = a partial change (light
|
|
804
|
+
* band + inline rects on the changed words).
|
|
805
|
+
*/
|
|
806
|
+
readonly diffKind?: 'added' | 'modified';
|
|
401
807
|
}
|
|
402
808
|
|
|
403
809
|
/**
|
|
@@ -454,7 +860,7 @@ declare class DocumentViewData {
|
|
|
454
860
|
export declare class DocumentViewNode extends ViewNode {
|
|
455
861
|
readonly blocks: readonly DocumentBlock[];
|
|
456
862
|
/** The transient empty-paragraph element, when one is armed. */
|
|
457
|
-
readonly
|
|
863
|
+
readonly pendingParagraph?: PendingParagraphViewNode | undefined;
|
|
458
864
|
static create(viewData: DocumentViewData, options: BlockViewOptions | undefined, previous: DocumentViewNode | undefined): DocumentViewNode;
|
|
459
865
|
private constructor();
|
|
460
866
|
/** The stable content element this document mounts its children into. */
|
|
@@ -476,6 +882,26 @@ export declare type EditCommand = (ctx: CursorCommandContext) => {
|
|
|
476
882
|
readonly selection: Selection_2;
|
|
477
883
|
} | undefined;
|
|
478
884
|
|
|
885
|
+
export declare type EditKeyboardAction = 'deleteLeft' | 'deleteRight' | 'deleteWordLeft' | 'deleteWordRight' | 'deleteLineLeft' | 'deleteLineRight' | 'copyLinesUp' | 'copyLinesDown' | 'moveLinesUp' | 'moveLinesDown' | 'deleteLines' | 'joinLines';
|
|
886
|
+
|
|
887
|
+
export declare interface EditorCommandDefinition {
|
|
888
|
+
readonly id: `markdown.editor.${string}`;
|
|
889
|
+
readonly title: string;
|
|
890
|
+
readonly action: EditorKeyboardAction;
|
|
891
|
+
readonly keybindings: readonly EditorCommandKeybinding[];
|
|
892
|
+
/**
|
|
893
|
+
* Local commands must execute synchronously in the webview instead of being
|
|
894
|
+
* forwarded through the VS Code keybinding service.
|
|
895
|
+
*/
|
|
896
|
+
readonly routing?: 'host' | 'local';
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
export declare interface EditorCommandKeybinding {
|
|
900
|
+
readonly key: string;
|
|
901
|
+
readonly modifiers?: KeyboardModifiers;
|
|
902
|
+
readonly platforms?: readonly KeyboardPlatform[];
|
|
903
|
+
}
|
|
904
|
+
|
|
479
905
|
/**
|
|
480
906
|
* Translates raw browser input (mouse, keyboard, EditContext) into model
|
|
481
907
|
* mutations. Knows about DOM event types but never reads/writes the DOM
|
|
@@ -484,19 +910,45 @@ export declare type EditCommand = (ctx: CursorCommandContext) => {
|
|
|
484
910
|
*
|
|
485
911
|
* Owns the only non-derivable controller state:
|
|
486
912
|
* - `_desiredColumn` — sticky column for up/down navigation
|
|
913
|
+
* - `_clickCount` / `_lastPointerDown` — multi-click detection for pointer
|
|
914
|
+
* input, since `pointerdown` events (unlike `mousedown`) don't populate
|
|
915
|
+
* `detail` with a click count.
|
|
487
916
|
*/
|
|
488
917
|
export declare class EditorController extends Disposable {
|
|
489
918
|
private readonly _model;
|
|
490
919
|
private readonly _view;
|
|
920
|
+
readonly findController: FindController | undefined;
|
|
491
921
|
private _desiredColumn;
|
|
922
|
+
private readonly _keyboardPlatform;
|
|
923
|
+
private readonly _keyboardProfile;
|
|
924
|
+
private readonly _forwardedKeyboardProfile;
|
|
925
|
+
private readonly _historyStrategy;
|
|
926
|
+
private readonly _indentation;
|
|
927
|
+
private readonly _tabFocusStatus;
|
|
928
|
+
private _tabMovesFocus;
|
|
929
|
+
/** Indentation copied by the most recent fenced-code Enter, while still untouched. */
|
|
930
|
+
private _generatedIndentation;
|
|
931
|
+
/** Running click count for the current multi-click sequence (1, 2, 3, …). */
|
|
932
|
+
private _clickCount;
|
|
933
|
+
/** Timestamp and position of the previous pointer-down, for multi-click detection. */
|
|
934
|
+
private _lastPointerDown;
|
|
492
935
|
constructor(_model: EditorModel, _view: EditorView, options?: EditorControllerOptions);
|
|
493
936
|
private readonly _handleTextUpdate;
|
|
494
|
-
private
|
|
937
|
+
private _insertText;
|
|
938
|
+
private _remainingGeneratedIndentation;
|
|
939
|
+
/** Handle typed, pasted, or command-generated text while a paragraph is pending. */
|
|
940
|
+
private _handlePendingInput;
|
|
941
|
+
private _deletePendingText;
|
|
942
|
+
private readonly _handlePointerDown;
|
|
495
943
|
private _makeCursorContext;
|
|
496
944
|
private _makeVisualCursorContext;
|
|
497
945
|
private _executeCursorCommand;
|
|
498
946
|
private _executeEditCommand;
|
|
947
|
+
private _runUndoableEdit;
|
|
499
948
|
private _executeVisualCursorCommand;
|
|
949
|
+
private _cursorDown;
|
|
950
|
+
private _setUserSelection;
|
|
951
|
+
private _applyCursorPosition;
|
|
500
952
|
/** Move the cursor down one visual line (Arrow Down). */
|
|
501
953
|
cursorDown(extend?: boolean): void;
|
|
502
954
|
/** Move the cursor up one visual line (Arrow Up). */
|
|
@@ -504,12 +956,34 @@ export declare class EditorController extends Disposable {
|
|
|
504
956
|
private _selectedText;
|
|
505
957
|
private readonly _updateModifierState;
|
|
506
958
|
private readonly _clearModifierState;
|
|
959
|
+
/**
|
|
960
|
+
* Drop any native DOM selection over the rendered text.
|
|
961
|
+
*
|
|
962
|
+
* The editor paints selection from `model.selection`, so a browser
|
|
963
|
+
* selection there is always spurious: nothing reads it (copy/cut read the
|
|
964
|
+
* model, hit-testing uses the measured layout) and nothing clears it, so it
|
|
965
|
+
* lingers as a second highlight even after the caret moves away.
|
|
966
|
+
* {@link isCaretMotionKey} stops the common source synchronously; this is
|
|
967
|
+
* the backstop for the rest of the browser's editing commands, which are
|
|
968
|
+
* platform- and version-specific and cannot be enumerated (Shift+PageDown
|
|
969
|
+
* and macOS Shift+Ctrl+B both reach one today).
|
|
970
|
+
*
|
|
971
|
+
* Scoped twice so it only ever discards selections the editor owns: the
|
|
972
|
+
* range must touch the rendered text (overlays such as comment widgets sit
|
|
973
|
+
* beside it and stay selectable), and input focus must still be inside this
|
|
974
|
+
* editor (so a host find-in-page, which selects while its own input is
|
|
975
|
+
* focused, is left alone).
|
|
976
|
+
*/
|
|
977
|
+
private readonly _discardNativeSelection;
|
|
507
978
|
private readonly _handleKeyDown;
|
|
979
|
+
executeCommand(command: EditorCommandDefinition): void;
|
|
980
|
+
private _executeKeyboardAction;
|
|
508
981
|
/**
|
|
509
982
|
* Context-aware Enter: splits / line-breaks via {@link insertSmartEnter}, or
|
|
510
983
|
* arms a transient empty paragraph when at the end of a paragraph.
|
|
511
984
|
*/
|
|
512
985
|
private _smartEnter;
|
|
986
|
+
private _registerTabFocusAccessibility;
|
|
513
987
|
}
|
|
514
988
|
|
|
515
989
|
/** Options for an {@link EditorController}. */
|
|
@@ -520,10 +994,81 @@ export declare interface EditorControllerOptions {
|
|
|
520
994
|
* strategy (e.g. `AsyncClipboardStrategy`) in hosts that swallow them.
|
|
521
995
|
*/
|
|
522
996
|
readonly clipboardStrategy?: IClipboardStrategy;
|
|
997
|
+
/**
|
|
998
|
+
* Where undo and redo are executed: `LocalHistoryStrategy` for a
|
|
999
|
+
* self-contained editor, or a strategy that forwards to the host's own
|
|
1000
|
+
* document history. Left unset, the chords are passed on to the host.
|
|
1001
|
+
*/
|
|
1002
|
+
readonly historyStrategy?: IHistoryStrategy;
|
|
1003
|
+
readonly keyboardPlatform?: KeyboardPlatform;
|
|
1004
|
+
readonly keyboardProfile?: KeyboardProfile;
|
|
1005
|
+
/**
|
|
1006
|
+
* Bindings owned by the host. Matching events have their browser default
|
|
1007
|
+
* suppressed but continue propagating so the host keybinding service sees them.
|
|
1008
|
+
*/
|
|
1009
|
+
readonly forwardedKeyboardProfile?: KeyboardProfile;
|
|
1010
|
+
/** Tab-stop settings used outside semantic list indentation. */
|
|
1011
|
+
readonly indentation?: IndentationConfig;
|
|
1012
|
+
readonly find?: false;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* The editor overlay's local CSS-pixel coordinate space.
|
|
1017
|
+
*
|
|
1018
|
+
* Browser geometry and pointer APIs expose viewport client coordinates. This
|
|
1019
|
+
* boundary converts them immediately into the coordinate system shared by the
|
|
1020
|
+
* editor content and its overlays. Range rectangles are axis-aligned, so the
|
|
1021
|
+
* current implementation deliberately supports positive axis-aligned scale and
|
|
1022
|
+
* translation only.
|
|
1023
|
+
*/
|
|
1024
|
+
export declare class EditorCoordinateSpace {
|
|
1025
|
+
private readonly _getLocalToClientMatrix;
|
|
1026
|
+
static forSvgOverlay(overlay: SVGSVGElement): EditorCoordinateSpace;
|
|
1027
|
+
private constructor();
|
|
1028
|
+
capture(): EditorCoordinateTransform;
|
|
523
1029
|
}
|
|
524
1030
|
|
|
1031
|
+
/** A stable coordinate conversion captured for one measurement operation. */
|
|
1032
|
+
export declare class EditorCoordinateTransform {
|
|
1033
|
+
private readonly _localToClient;
|
|
1034
|
+
private readonly _clientToLocal;
|
|
1035
|
+
constructor(_localToClient: DOMMatrix);
|
|
1036
|
+
toLocalPoint(point: Pick<Point2D, 'x' | 'y'>): Point2D;
|
|
1037
|
+
toClientPoint(point: Pick<Point2D, 'x' | 'y'>): Point2D;
|
|
1038
|
+
toLocalRect(rect: Pick<DOMRectReadOnly, 'left' | 'top' | 'width' | 'height'>): Rect2D;
|
|
1039
|
+
toClientRect(rect: Pick<Rect2D, 'left' | 'top' | 'width' | 'height'>): Rect2D;
|
|
1040
|
+
private _convertRect;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
export declare type EditorKeyboardAction = {
|
|
1044
|
+
readonly kind: 'cursor';
|
|
1045
|
+
readonly command: CursorKeyboardAction;
|
|
1046
|
+
readonly extend: boolean;
|
|
1047
|
+
} | {
|
|
1048
|
+
readonly kind: 'edit';
|
|
1049
|
+
readonly command: EditKeyboardAction;
|
|
1050
|
+
} | {
|
|
1051
|
+
readonly kind: 'history';
|
|
1052
|
+
readonly command: HistoryKeyboardAction;
|
|
1053
|
+
} | {
|
|
1054
|
+
readonly kind: 'tab';
|
|
1055
|
+
readonly command: TabKeyboardAction;
|
|
1056
|
+
} | {
|
|
1057
|
+
readonly kind: 'toggleTabFocus';
|
|
1058
|
+
} | {
|
|
1059
|
+
readonly kind: 'toggleReadonly';
|
|
1060
|
+
} | {
|
|
1061
|
+
readonly kind: 'selectAll';
|
|
1062
|
+
} | {
|
|
1063
|
+
readonly kind: 'enter';
|
|
1064
|
+
readonly command: 'smartEnter' | 'insertParagraph' | 'insertHardLineBreak';
|
|
1065
|
+
};
|
|
1066
|
+
|
|
525
1067
|
export declare class EditorModel {
|
|
526
1068
|
private readonly _parser;
|
|
1069
|
+
private readonly _sourceEditListeners;
|
|
1070
|
+
private readonly _sourceTextIds;
|
|
1071
|
+
private _lastSourceTextId;
|
|
527
1072
|
/**
|
|
528
1073
|
* The most recent edit applied to {@link sourceText}, used by
|
|
529
1074
|
* {@link document} to let the parser link incrementally edited code
|
|
@@ -532,11 +1077,24 @@ export declare class EditorModel {
|
|
|
532
1077
|
*/
|
|
533
1078
|
private _pendingEdit;
|
|
534
1079
|
readonly sourceText: ISettableObservable<StringValue, void>;
|
|
1080
|
+
readonly wordNavigationConfig: ISettableObservable<WordNavigationConfig, void>;
|
|
1081
|
+
/**
|
|
1082
|
+
* Read-only mode. When `true`, the editor never reveals a block's source
|
|
1083
|
+
* markers (markdown special characters like `**`, `#`, list bullets, code
|
|
1084
|
+
* fences, `$…$`) — every block stays in its clean rendered form regardless of
|
|
1085
|
+
* where the caret/selection is — and text-editing commands are ignored.
|
|
1086
|
+
* Explicit interactions with rendered controls, such as task checkboxes,
|
|
1087
|
+
* remain available. Plain text selection still works everywhere (so the user
|
|
1088
|
+
* can copy). The default (`false`) is the normal editing mode where the active
|
|
1089
|
+
* block reveals its markers.
|
|
1090
|
+
*/
|
|
1091
|
+
readonly readonlyMode: ISettableObservable<boolean, void>;
|
|
535
1092
|
/**
|
|
536
1093
|
* The current selection, or `undefined` when the editor has no caret
|
|
537
1094
|
* (e.g. an inactive/unfocused rendering).
|
|
538
1095
|
*/
|
|
539
1096
|
readonly selection: ISettableObservable<Selection_2 | undefined, void>;
|
|
1097
|
+
readonly selectionSource: ISettableObservable<SelectionSource, void>;
|
|
540
1098
|
/**
|
|
541
1099
|
* Whether a Ctrl/Cmd modifier is currently held. Set by the controller from
|
|
542
1100
|
* live keyboard state; the view reads it to show the link-open affordance
|
|
@@ -544,6 +1102,14 @@ export declare class EditorModel {
|
|
|
544
1102
|
* whose block is active.
|
|
545
1103
|
*/
|
|
546
1104
|
readonly ctrlOrMetaDown: ISettableObservable<boolean, void>;
|
|
1105
|
+
/**
|
|
1106
|
+
* Whether a pointer-driven selection drag is currently in progress. Set by
|
|
1107
|
+
* the controller between the pointer-down that starts the drag and the
|
|
1108
|
+
* pointer-up/cancel that ends it. Contributions read it to defer UI that
|
|
1109
|
+
* would otherwise flicker mid-drag (e.g. the comment input box appears only
|
|
1110
|
+
* once the drag ends).
|
|
1111
|
+
*/
|
|
1112
|
+
readonly isSelecting: ISettableObservable<boolean, void>;
|
|
547
1113
|
/**
|
|
548
1114
|
* Gutter markers (source-control style change indicators) painted in the
|
|
549
1115
|
* left gutter. Each entry maps a source {@link OffsetRange} to a change kind
|
|
@@ -563,16 +1129,19 @@ export declare class EditorModel {
|
|
|
563
1129
|
* The transient empty-paragraph editing state, or `undefined` when none is
|
|
564
1130
|
* armed. See {@link PendingParagraph}. This is *not* document data — it is
|
|
565
1131
|
* cleared by any source edit and lives only between the Enter that armed it
|
|
566
|
-
* and the next
|
|
1132
|
+
* and the next content-producing edit.
|
|
567
1133
|
*/
|
|
568
1134
|
readonly pendingParagraph: ISettableObservable<PendingParagraph | undefined, void>;
|
|
1135
|
+
/** Switches between editing and locked mode and clears transient edit intent. */
|
|
1136
|
+
toggleReadonlyMode(): void;
|
|
569
1137
|
readonly cursorOffset: IObservableWithChange<number | undefined, void>;
|
|
1138
|
+
readonly cursorPosition: IObservableWithChange<CursorPosition | undefined, void>;
|
|
570
1139
|
/**
|
|
571
1140
|
* The parsed document. Threads the previous document into the parser so
|
|
572
1141
|
* unchanged blocks keep their object identity across reparses (see
|
|
573
1142
|
* {@link MarkdownParser.parse}). Writing `previous` inside the compute is
|
|
574
|
-
*
|
|
575
|
-
*
|
|
1143
|
+
* safe: unchanged source reuses it directly, while changed source produces
|
|
1144
|
+
* a result structurally identical to a full reparse.
|
|
576
1145
|
*/
|
|
577
1146
|
readonly document: IObservableWithChange<DocumentAstNode, void>;
|
|
578
1147
|
/**
|
|
@@ -589,28 +1158,62 @@ export declare class EditorModel {
|
|
|
589
1158
|
* collapsed this is a one-element set holding {@link activeBlock}.
|
|
590
1159
|
*/
|
|
591
1160
|
readonly activeBlocks: IObservableWithChange<Set<BlockAstNode>, void>;
|
|
1161
|
+
/**
|
|
1162
|
+
* The baseline document to diff against. When set, the editor renders in
|
|
1163
|
+
* diff mode: the modified document ({@link document}) stays editable, while
|
|
1164
|
+
* the baseline's removed/changed blocks are shown as read-only decorations.
|
|
1165
|
+
* `undefined` (the default) renders normally.
|
|
1166
|
+
*/
|
|
1167
|
+
readonly baseline: ISettableObservable<StringValue | undefined, void>;
|
|
1168
|
+
private readonly _baselineDocument;
|
|
1169
|
+
/**
|
|
1170
|
+
* The diff of {@link baseline} → {@link document}, or `undefined` when no
|
|
1171
|
+
* baseline is set. The view renders the {@link DiffItem}s as stacked
|
|
1172
|
+
* decorations; `insertedRanges` (modified-side change spans) drive the green
|
|
1173
|
+
* word-level highlight.
|
|
1174
|
+
*/
|
|
1175
|
+
readonly diff: IObservableWithChange< {
|
|
1176
|
+
items: DiffItem[];
|
|
1177
|
+
insertedRanges: OffsetRange[];
|
|
1178
|
+
changedBlocks: Set<BlockAstNode>;
|
|
1179
|
+
} | undefined, void>;
|
|
1180
|
+
readonly markerVisibleBlocks: IObservableWithChange<Set<BlockAstNode>, void>;
|
|
1181
|
+
onWillApplySourceEdit(listener: (event: SourceEditEvent) => void): IDisposable;
|
|
1182
|
+
/** Returns a stable per-object identity without retaining the source text. */
|
|
1183
|
+
getSourceTextId(sourceText: StringValue): number;
|
|
592
1184
|
/**
|
|
593
1185
|
* Arm a {@link PendingParagraph} at the given gap, minting a fresh synthetic
|
|
594
1186
|
* AST node for it, and park the caret at the gap start. No source edit is
|
|
595
1187
|
* applied — the blank line exists only in the view until it is materialized.
|
|
596
1188
|
*/
|
|
597
|
-
armPendingParagraph(req:
|
|
598
|
-
anchorBlock: BlockAstNode;
|
|
599
|
-
replaceRange: OffsetRange;
|
|
600
|
-
atEof: boolean;
|
|
601
|
-
}): void;
|
|
1189
|
+
armPendingParagraph(req: Omit<PendingParagraph, 'syntheticAst' | 'cursorLine' | 'text'>): void;
|
|
602
1190
|
/** Discard the pending paragraph (if any) without touching the source. */
|
|
603
1191
|
cancelPendingParagraph(): void;
|
|
1192
|
+
/**
|
|
1193
|
+
* Replace the source with an authoritative value from the host, mapping the
|
|
1194
|
+
* selection through the changed span and atomically discarding transient
|
|
1195
|
+
* state anchored to the previous parse.
|
|
1196
|
+
*/
|
|
1197
|
+
replaceSourceText(text: StringValue): void;
|
|
1198
|
+
/** Replace the transient horizontal whitespace on the pending line. */
|
|
1199
|
+
setPendingParagraphText(text: string): void;
|
|
604
1200
|
/**
|
|
605
1201
|
* Turn the pending paragraph into real source: rewrite its gap so the typed
|
|
606
|
-
*
|
|
607
|
-
* lines, and place the caret after
|
|
1202
|
+
* text, including any transient indentation, is separated from its neighbours
|
|
1203
|
+
* by blank lines, and place the caret after it.
|
|
608
1204
|
*/
|
|
609
1205
|
materializePendingParagraph(text: string): void;
|
|
610
|
-
|
|
1206
|
+
/** Sets a rendered task checkbox state in either editing or read-only mode. */
|
|
1207
|
+
setTaskCheckboxChecked(item: ListItemAstNode, checked: boolean): void;
|
|
1208
|
+
applyEdit(edit: StringEdit, selection?: Selection_2): void;
|
|
611
1209
|
applyEditForSelection(edit: StringEdit): void;
|
|
1210
|
+
private _applySourceEdit;
|
|
1211
|
+
private _identifySourceEdit;
|
|
1212
|
+
private _emitWillApplySourceEdit;
|
|
612
1213
|
}
|
|
613
1214
|
|
|
1215
|
+
export declare type EditorOverlayPosition = 'top-chrome' | 'below-selection' | 'above-decorations';
|
|
1216
|
+
|
|
614
1217
|
/**
|
|
615
1218
|
* Pure-render view of an {@link EditorModel}.
|
|
616
1219
|
*
|
|
@@ -640,6 +1243,8 @@ export declare class EditorView extends Disposable {
|
|
|
640
1243
|
readonly element: HTMLElement;
|
|
641
1244
|
readonly editContext: EditContext;
|
|
642
1245
|
readonly measuredLayout: MeasuredLayoutModel;
|
|
1246
|
+
readonly coordinateSpace: EditorCoordinateSpace;
|
|
1247
|
+
readonly forcedMarkerVisibleBlocks: ISettableObservable<ReadonlySet<BlockAstNode>, void>;
|
|
643
1248
|
/**
|
|
644
1249
|
* Inner container that holds the rendered document and the cursor/selection
|
|
645
1250
|
* overlays. The outer {@link element} spans the full width; this container
|
|
@@ -647,9 +1252,18 @@ export declare class EditorView extends Disposable {
|
|
|
647
1252
|
* to their parent's box) stay aligned with the content.
|
|
648
1253
|
*/
|
|
649
1254
|
private readonly _contentContainer;
|
|
1255
|
+
private readonly _resizeObserver;
|
|
650
1256
|
private readonly _cursorView;
|
|
651
1257
|
private readonly _selectionView;
|
|
652
1258
|
private readonly _gutterMarkersView;
|
|
1259
|
+
private readonly _diffHighlightsView;
|
|
1260
|
+
private _readonlyToggleButton;
|
|
1261
|
+
private readonly _editContextSuspensions;
|
|
1262
|
+
private readonly _revealOcclusions;
|
|
1263
|
+
private _pendingTopReveal;
|
|
1264
|
+
private _caretRevealRaf;
|
|
1265
|
+
private _followedCaretBlock;
|
|
1266
|
+
private _followCaretAfterEdit;
|
|
653
1267
|
/**
|
|
654
1268
|
* The mounted block sequence, in source order. Rebuilt (not mutated) each
|
|
655
1269
|
* frame by {@link DocumentViewNode.create}; the view just swaps one
|
|
@@ -657,8 +1271,12 @@ export declare class EditorView extends Disposable {
|
|
|
657
1271
|
* (those go through the measured-layout model).
|
|
658
1272
|
*/
|
|
659
1273
|
private readonly _document;
|
|
1274
|
+
private readonly _embeddedCodeEditorFactoryVersion;
|
|
1275
|
+
private readonly _suspendEditContextForBlockControl;
|
|
660
1276
|
/** The current view-node tree (AST overlaid with rendered DOM), for debugging. */
|
|
661
1277
|
get documentViewNode(): IObservable<DocumentViewNode | undefined>;
|
|
1278
|
+
/** Re-resolves embedded code editors while preserving the surrounding editor view. */
|
|
1279
|
+
refreshEmbeddedCodeEditors(): void;
|
|
662
1280
|
/**
|
|
663
1281
|
* Last frame's view-data overlay, threaded back into
|
|
664
1282
|
* {@link buildDocumentViewData} so any subtree whose ast and selection flags
|
|
@@ -670,18 +1288,44 @@ export declare class EditorView extends Disposable {
|
|
|
670
1288
|
private readonly _viewData;
|
|
671
1289
|
get viewData(): IObservable<DocumentViewData | undefined>;
|
|
672
1290
|
/**
|
|
673
|
-
*
|
|
674
|
-
*
|
|
675
|
-
*
|
|
676
|
-
*
|
|
1291
|
+
* Whether the editor is genuinely focused: focus rests somewhere inside the
|
|
1292
|
+
* editor subtree *and* its window is focused. Mirrored onto the root as
|
|
1293
|
+
* `.md-focused`, which gates the painted caret — the blinking cursor is only
|
|
1294
|
+
* shown while this is `true`, so it never blinks in an unfocused editor or
|
|
1295
|
+
* after the window loses focus. Only the caret's visibility is affected; the
|
|
1296
|
+
* logical selection and caret geometry ({@link caretRect}) are unchanged.
|
|
677
1297
|
*/
|
|
678
|
-
private readonly
|
|
1298
|
+
private readonly _focused;
|
|
1299
|
+
get focused(): IObservable<boolean>;
|
|
679
1300
|
/**
|
|
680
1301
|
* The block cache projected for views (selection painting) that need to
|
|
681
1302
|
* react to mount/unmount. Derived from {@link _document}, so it stays in
|
|
682
1303
|
* lock-step without any manual bookkeeping.
|
|
683
1304
|
*/
|
|
684
1305
|
private readonly _selectionBlocksObs;
|
|
1306
|
+
/**
|
|
1307
|
+
* The caret rect (zero width) at the selection's active end, in
|
|
1308
|
+
* {@link overlayContainer}-local coordinates, or `undefined` when there is no
|
|
1309
|
+
* caret. This is the same geometry the editor paints its cursor from, so
|
|
1310
|
+
* contributions (e.g. comment mode) can anchor an overlay to the active end of
|
|
1311
|
+
* the selection — where the user's cursor is — without re-deriving geometry.
|
|
1312
|
+
*/
|
|
1313
|
+
private readonly _caretRect;
|
|
1314
|
+
get caretRect(): IObservable<Rect2D | undefined>;
|
|
1315
|
+
/**
|
|
1316
|
+
* The container that establishes the positioning context for the editor's
|
|
1317
|
+
* overlays (cursor, selection, gutter). Contributions mount their own
|
|
1318
|
+
* absolutely-positioned overlays here so they share the coordinate space of
|
|
1319
|
+
* {@link caretRect}.
|
|
1320
|
+
*/
|
|
1321
|
+
get overlayContainer(): HTMLElement;
|
|
1322
|
+
/**
|
|
1323
|
+
* Selection-style rectangles covering `range`, in {@link overlayContainer}-
|
|
1324
|
+
* local coordinates — the same geometry the live selection paints. Exposed so
|
|
1325
|
+
* contributions (e.g. persistent comments) can highlight arbitrary ranges and
|
|
1326
|
+
* anchor overlays to them. Recomputes when the measured layout changes.
|
|
1327
|
+
*/
|
|
1328
|
+
rangeRects(range: OffsetRange): IObservable<readonly SelectionRect[]>;
|
|
685
1329
|
constructor(_model: EditorModel, _options?: EditorViewOptions | undefined);
|
|
686
1330
|
/**
|
|
687
1331
|
* Mirrors the model's live Ctrl/Cmd state onto the editor root as
|
|
@@ -690,13 +1334,123 @@ export declare class EditorView extends Disposable {
|
|
|
690
1334
|
* a plain click, but an active link only opens with the modifier held.
|
|
691
1335
|
*/
|
|
692
1336
|
private _setupModifierTracking;
|
|
1337
|
+
/**
|
|
1338
|
+
* Tracks whether the editor is genuinely focused and mirrors it onto the
|
|
1339
|
+
* root as `.md-focused` so CSS can gate the painted caret. "Focused" means
|
|
1340
|
+
* focus rests somewhere inside the editor subtree *and* the window itself is
|
|
1341
|
+
* focused; either condition failing (focus moving elsewhere, or the window
|
|
1342
|
+
* losing focus) hides the blinking caret while leaving the logical selection
|
|
1343
|
+
* and caret geometry intact.
|
|
1344
|
+
*/
|
|
1345
|
+
private _setupFocusTracking;
|
|
1346
|
+
private _setupCaretScrollPadding;
|
|
1347
|
+
/**
|
|
1348
|
+
* Renders the edit/read-only mode toggle. It flips the model's
|
|
1349
|
+
* {@link EditorModel.readonlyMode}: when locked (read-only) every block stays
|
|
1350
|
+
* in its clean rendered form (no markdown markers revealed) and edits are
|
|
1351
|
+
* ignored, while text selection still works. The control lives in a
|
|
1352
|
+
* zero-height *sticky* host inside the centered content container, so the
|
|
1353
|
+
* lock follows the content's right edge and remains pinned as the document
|
|
1354
|
+
* scrolls. The current mode is also mirrored onto the root as `.md-readonly`
|
|
1355
|
+
* for any CSS hooks.
|
|
1356
|
+
*/
|
|
1357
|
+
private _setupReadonlyToggle;
|
|
1358
|
+
/** Draws attention to the mode toggle after text input is attempted while locked. */
|
|
1359
|
+
showReadonlyEditingAttempt(): void;
|
|
693
1360
|
focus(): void;
|
|
1361
|
+
mountOverlay(element: HTMLElement | SVGSVGElement, position: EditorOverlayPosition): IDisposable;
|
|
1362
|
+
/** Registers floating editor chrome that should count as covering a range during reveal. */
|
|
1363
|
+
registerRevealOcclusion(element: Element): IDisposable;
|
|
1364
|
+
/**
|
|
1365
|
+
* Temporarily detaches the root {@link EditContext} while focus is inside
|
|
1366
|
+
* nested editor chrome. Chromium otherwise reclaims focus from non-text
|
|
1367
|
+
* controls inside the EditContext host, breaking keyboard access to controls
|
|
1368
|
+
* such as the find actions and read-only toggle.
|
|
1369
|
+
*/
|
|
1370
|
+
suspendEditContextWhileFocused(element: HTMLElement): IDisposable;
|
|
1371
|
+
revealRangeInCenterIfOutsideViewport(range: OffsetRange, behavior?: ScrollBehavior): IDisposable;
|
|
1372
|
+
/**
|
|
1373
|
+
* Aligns an explicitly navigated range with the top of its nearest vertical
|
|
1374
|
+
* scroll viewport, even when the range is already partially or fully visible.
|
|
1375
|
+
* The alignment leaves {@link TOP_REVEAL_CONTEXT_INSET}px of navigation
|
|
1376
|
+
* context above the range, grown so the range also clears any chrome
|
|
1377
|
+
* registered through {@link registerRevealOcclusion} that covers the top of
|
|
1378
|
+
* that viewport. Outer vertical scrollers and the window keep nearest-edge
|
|
1379
|
+
* behavior so they do not jump, and horizontal scrolling stays nearest-edge.
|
|
1380
|
+
*
|
|
1381
|
+
* Explicit navigation also stops edit-driven caret following, so a later
|
|
1382
|
+
* block resize does not scroll back to where the caret was left behind.
|
|
1383
|
+
* Sticky chrome is remeasured once scrolling completes. User input, a newer
|
|
1384
|
+
* reveal, or disposal cancels that deferred correction.
|
|
1385
|
+
*/
|
|
1386
|
+
revealRangeAtTop(range: OffsetRange, behavior?: ScrollBehavior): IDisposable;
|
|
1387
|
+
private _scheduleRangeReveal;
|
|
1388
|
+
private _scheduleTopRangeReveal;
|
|
1389
|
+
/**
|
|
1390
|
+
* Keeps the caret visible after an editor-driven text edit. The reveal is
|
|
1391
|
+
* deferred until the rebuilt document has been laid out and uses nearest-edge
|
|
1392
|
+
* scrolling so ordinary typing only moves the containing viewport as far as
|
|
1393
|
+
* needed. While this mode is active, a later resize of the same active block
|
|
1394
|
+
* also re-reveals the caret (for asynchronous code, math, or diagram layout).
|
|
1395
|
+
*/
|
|
1396
|
+
revealCaretAfterEdit(): void;
|
|
1397
|
+
/** Keeps a keyboard-moved caret visible without enabling edit-resize following. */
|
|
1398
|
+
revealCaretAfterKeyboardNavigation(): void;
|
|
1399
|
+
/** Stops edit-driven caret following before pointer-based selection begins. */
|
|
1400
|
+
stopFollowingCaret(): void;
|
|
1401
|
+
/**
|
|
1402
|
+
* Samples the ambient focus state that decides whether taking focus on open
|
|
1403
|
+
* would steal it from an explicit user target: whether the window is focused
|
|
1404
|
+
* and whether focus is still unclaimed (no active element, or the `<body>`
|
|
1405
|
+
* fallback).
|
|
1406
|
+
*/
|
|
1407
|
+
private _sampleAutoFocusEnvironment;
|
|
1408
|
+
/**
|
|
1409
|
+
* One-shot guarded focus attempt: focuses the editor only if doing so will
|
|
1410
|
+
* not steal focus from an explicit user target — the window must already be
|
|
1411
|
+
* focused and no other element may have claimed focus yet. Returns whether
|
|
1412
|
+
* focus was taken. A no-op for a background window or when the user has
|
|
1413
|
+
* already focused something else. {@link autoFocusOnOpen} builds the
|
|
1414
|
+
* open-time behavior on top of this primitive.
|
|
1415
|
+
*/
|
|
1416
|
+
tryAutoFocus(): boolean;
|
|
1417
|
+
/**
|
|
1418
|
+
* Focuses the editor when it opens without ever stealing focus from an
|
|
1419
|
+
* explicit user target. Tries once immediately; if the window is not focused
|
|
1420
|
+
* yet — a common open-time race where the editor is mounted before the host
|
|
1421
|
+
* routes focus to its window — the guarded attempt is deferred to the next
|
|
1422
|
+
* time the window gains focus and re-evaluated then. The deferral is
|
|
1423
|
+
* one-shot, so a later, unrelated window refocus never grabs focus, and the
|
|
1424
|
+
* re-check still respects any target the user has claimed in the meantime.
|
|
1425
|
+
*/
|
|
1426
|
+
autoFocusOnOpen(): void;
|
|
1427
|
+
/**
|
|
1428
|
+
* Own point→offset resolution. When `true` (the default),
|
|
1429
|
+
* {@link resolveOffsetFromPoint} ignores the platform DOM hit-test
|
|
1430
|
+
* (`caretPositionFromPoint`) and snaps the point to the nearest offset purely
|
|
1431
|
+
* from the rendered {@link VisualLineMap} geometry — picking the nearest
|
|
1432
|
+
* visual line by `y`, then the nearest offset on it by `x`. Because a table
|
|
1433
|
+
* row's cells share one horizontal line band, this makes the whole width of a
|
|
1434
|
+
* row resolve into that row (rather than only the cell boxes), with no visible
|
|
1435
|
+
* layout change. It also lets a drag keep extending toward off-viewport points
|
|
1436
|
+
* (e.g. the pointer leaving the window), which the platform hit-test cannot
|
|
1437
|
+
* resolve. Set to `false` to fall back to the platform DOM hit-test.
|
|
1438
|
+
*/
|
|
1439
|
+
readonly geometricHitTest: ISettableObservable<boolean, void>;
|
|
694
1440
|
/**
|
|
695
1441
|
* Client coordinates → absolute source offset (any block). Used during
|
|
696
1442
|
* drag to keep extending the selection even when the pointer leaves the
|
|
697
|
-
* original block.
|
|
1443
|
+
* original block. Honours {@link geometricHitTest}.
|
|
698
1444
|
*/
|
|
699
1445
|
resolveOffsetFromPoint(point: Point2D): SourceOffset | undefined;
|
|
1446
|
+
private _resolveControlFreeVideoOffset;
|
|
1447
|
+
/**
|
|
1448
|
+
* Resolve table-cell hits that have no measurable text run. Empty cells map
|
|
1449
|
+
* from their own box instead of snapping to a neighboring cell; element-only
|
|
1450
|
+
* content (for example an inactive image) maps through the hit element's view
|
|
1451
|
+
* node. Text-bearing cells keep the normal pixel-precise line-map/DOM path.
|
|
1452
|
+
*/
|
|
1453
|
+
private _resolveTableCellOffset;
|
|
700
1454
|
/**
|
|
701
1455
|
* Whether a client point falls on the rendered document content, as
|
|
702
1456
|
* opposed to the surrounding editor padding (the green area). Uses DOM
|
|
@@ -706,6 +1460,14 @@ export declare class EditorView extends Disposable {
|
|
|
706
1460
|
* have `pointer-events: none`, so the hit-test sees through them.
|
|
707
1461
|
*/
|
|
708
1462
|
isPointInContent(point: Point2D): boolean;
|
|
1463
|
+
/**
|
|
1464
|
+
* Whether `range` intersects the rendered source text — the region whose
|
|
1465
|
+
* selection this editor paints itself from `model.selection`. This also
|
|
1466
|
+
* catches select-all ranges whose endpoints surround the rendered content.
|
|
1467
|
+
* Overlays anchored beside the text (comment widgets and the like) are *not*
|
|
1468
|
+
* part of it and keep their own native selection behaviour.
|
|
1469
|
+
*/
|
|
1470
|
+
intersectsRenderedContent(range: Range): boolean;
|
|
709
1471
|
private readonly _renderAutorun;
|
|
710
1472
|
/** Current mounted blocks, or empty before the first render. */
|
|
711
1473
|
private get _blocks();
|
|
@@ -715,6 +1477,50 @@ export declare class EditorView extends Disposable {
|
|
|
715
1477
|
* is not read here, so there is no feedback loop into the render autorun.
|
|
716
1478
|
*/
|
|
717
1479
|
private _publishMeasurements;
|
|
1480
|
+
/**
|
|
1481
|
+
* Paint the diff highlights via the CSS Custom Highlight API: green over the
|
|
1482
|
+
* inserted/changed modified ranges (mapped on the document's own DOM), and
|
|
1483
|
+
* red over each {@link DiffDecorationViewNode}'s deleted ranges (mapped on
|
|
1484
|
+
* the decoration's own subtree). No DOM is mutated, so reconciliation and
|
|
1485
|
+
* editing are unaffected.
|
|
1486
|
+
*/
|
|
1487
|
+
private _paintDiff;
|
|
1488
|
+
private _clearDiff;
|
|
1489
|
+
private _syncEditContextAttachment;
|
|
1490
|
+
private _revealRange;
|
|
1491
|
+
private _revealTarget;
|
|
1492
|
+
private _scheduleCaretReveal;
|
|
1493
|
+
private _revealCaretNearest;
|
|
1494
|
+
private _revealCaretAfterActiveBlockResize;
|
|
1495
|
+
private _caretBlockAt;
|
|
1496
|
+
private _measurementAt;
|
|
1497
|
+
private _stopFollowingCaret;
|
|
1498
|
+
private _isRevealOccluded;
|
|
1499
|
+
/** Client rects of registered occlusions that are currently rendered and visible. */
|
|
1500
|
+
private _activeRevealOcclusions;
|
|
1501
|
+
/**
|
|
1502
|
+
* How far registered chrome covers the top of `viewport`, measured down from
|
|
1503
|
+
* `viewport.top`, across the columns `target` occupies. Clearing one occluder
|
|
1504
|
+
* can slide the target behind the next one, so the tested band is re-evaluated
|
|
1505
|
+
* until it settles; stacked chrome therefore reports the lowest connected
|
|
1506
|
+
* bottom edge. Returns 0 when nothing covers the top.
|
|
1507
|
+
*/
|
|
1508
|
+
private _occludedTopHeight;
|
|
1509
|
+
/**
|
|
1510
|
+
* Vertical inset used to top-align `target` inside `viewport`. Defaults to
|
|
1511
|
+
* {@link TOP_REVEAL_CONTEXT_INSET}, and grows past registered chrome covering
|
|
1512
|
+
* the viewport top so the same breathing room is kept below that chrome.
|
|
1513
|
+
*/
|
|
1514
|
+
private _topRevealInset;
|
|
1515
|
+
/**
|
|
1516
|
+
* `viewport` reduced to the area an explicitly navigated target may occupy:
|
|
1517
|
+
* registered top chrome is excluded, along with the breathing room below it.
|
|
1518
|
+
* Nearest-edge movement parks the target just inside the rect it is given, so
|
|
1519
|
+
* the inset has to be part of that rect; otherwise an outer scroller, or the
|
|
1520
|
+
* window, would leave the target grazing the chrome's bottom edge after the
|
|
1521
|
+
* nearest vertical viewport had already aligned it.
|
|
1522
|
+
*/
|
|
1523
|
+
private _unoccludedViewport;
|
|
718
1524
|
}
|
|
719
1525
|
|
|
720
1526
|
export declare interface EditorViewOptions extends BlockViewOptions {
|
|
@@ -725,6 +1531,12 @@ export declare interface EditorViewOptions extends BlockViewOptions {
|
|
|
725
1531
|
* only) unless a theme class is supplied.
|
|
726
1532
|
*/
|
|
727
1533
|
readonly classNames?: readonly string[];
|
|
1534
|
+
/**
|
|
1535
|
+
* Whether to render the sticky edit/read-only toggle at the top-right edge
|
|
1536
|
+
* of the content. Defaults to `true`; set to `false` to omit it (e.g. in
|
|
1537
|
+
* fixtures that focus on selection rendering).
|
|
1538
|
+
*/
|
|
1539
|
+
readonly showReadonlyToggle?: boolean;
|
|
728
1540
|
/**
|
|
729
1541
|
* Controls "limited width mode". The observable yields the maximum content
|
|
730
1542
|
* width in pixels, or `undefined` to let the content fill the available
|
|
@@ -735,14 +1547,22 @@ export declare interface EditorViewOptions extends BlockViewOptions {
|
|
|
735
1547
|
* root ({@link element}) always spans the full available width.
|
|
736
1548
|
*/
|
|
737
1549
|
readonly limitedWidth?: IObservable<number | undefined>;
|
|
1550
|
+
/**
|
|
1551
|
+
* Diff mode only: render every read-only original decoration in active
|
|
1552
|
+
* (source) form, so even whole-block removals expose their markdown markers
|
|
1553
|
+
* as real text. Used by the diff-coverage fixture to verify that every
|
|
1554
|
+
* changed original character is rendered somewhere; off in normal use, where
|
|
1555
|
+
* whole removals show a clean solid band.
|
|
1556
|
+
*/
|
|
1557
|
+
readonly diffDecorationsActive?: boolean;
|
|
738
1558
|
}
|
|
739
1559
|
|
|
740
1560
|
export declare class EmphasisAstNode extends AstNode {
|
|
741
1561
|
readonly openMarker: MarkerAstNode;
|
|
742
|
-
readonly content: readonly
|
|
1562
|
+
readonly content: readonly InlineContentAstNode[];
|
|
743
1563
|
readonly closeMarker: MarkerAstNode;
|
|
744
1564
|
readonly kind = "emphasis";
|
|
745
|
-
constructor(openMarker: MarkerAstNode, content: readonly
|
|
1565
|
+
constructor(openMarker: MarkerAstNode, content: readonly InlineContentAstNode[], closeMarker: MarkerAstNode);
|
|
746
1566
|
get children(): readonly AstNode[];
|
|
747
1567
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
748
1568
|
}
|
|
@@ -754,6 +1574,111 @@ declare class EmphasisViewData {
|
|
|
754
1574
|
constructor(ast: EmphasisAstNode, content: readonly AnyViewData[]);
|
|
755
1575
|
}
|
|
756
1576
|
|
|
1577
|
+
export declare function escapeFindRegex(value: string): string;
|
|
1578
|
+
|
|
1579
|
+
export declare const FIND_MATCH_LIMIT = 19999;
|
|
1580
|
+
|
|
1581
|
+
export declare function findBlockAtOffset(doc: DocumentAstNode, offset: SourceOffset): BlockAstNode | undefined;
|
|
1582
|
+
|
|
1583
|
+
export declare class FindController extends Disposable {
|
|
1584
|
+
private readonly _editorModel;
|
|
1585
|
+
private readonly _view;
|
|
1586
|
+
private readonly _options;
|
|
1587
|
+
readonly model: FindModel;
|
|
1588
|
+
readonly widget: FindWidget;
|
|
1589
|
+
private readonly _selectionForScope;
|
|
1590
|
+
private _forcedMatch;
|
|
1591
|
+
private _selectedMatch;
|
|
1592
|
+
private _observedSourceTextId;
|
|
1593
|
+
private readonly _sourceEditTracker;
|
|
1594
|
+
private _revealRequest;
|
|
1595
|
+
constructor(_editorModel: EditorModel, _view: EditorView, _options: FindControllerOptions);
|
|
1596
|
+
private _setForcedMarkerVisibleBlocks;
|
|
1597
|
+
openAndFocus(): void;
|
|
1598
|
+
close(): void;
|
|
1599
|
+
private _handleKeyDown;
|
|
1600
|
+
private _cancelRevealRequest;
|
|
1601
|
+
private _findByKeyboard;
|
|
1602
|
+
private _querySeed;
|
|
1603
|
+
private _prepareSeed;
|
|
1604
|
+
private _selectedSingleLineText;
|
|
1605
|
+
private _toggleFindInSelection;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
export declare interface FindControllerOptions {
|
|
1609
|
+
readonly keyboardPlatform: KeyboardPlatform;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
export declare type FindDirection = 'next' | 'previous';
|
|
1613
|
+
|
|
1614
|
+
export declare class FindHighlightsView extends Disposable {
|
|
1615
|
+
private readonly _view;
|
|
1616
|
+
private readonly _matchesLayer;
|
|
1617
|
+
private readonly _currentLayer;
|
|
1618
|
+
private readonly _highlightRegistration;
|
|
1619
|
+
private readonly _resizeObserver;
|
|
1620
|
+
private readonly _resizeObservedElements;
|
|
1621
|
+
private _snapshot;
|
|
1622
|
+
private _paintRaf;
|
|
1623
|
+
constructor(_view: EditorView, findModel: FindModel);
|
|
1624
|
+
private _schedulePaint;
|
|
1625
|
+
private _paint;
|
|
1626
|
+
private _observeResizeAncestors;
|
|
1627
|
+
private _paintRanges;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
export declare interface FindMatchesResult {
|
|
1631
|
+
readonly matches: readonly OffsetRange[];
|
|
1632
|
+
readonly isCapped: boolean;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
export declare class FindModel extends Disposable {
|
|
1636
|
+
private readonly _editorModel;
|
|
1637
|
+
readonly isRevealed: ISettableObservable<boolean, void>;
|
|
1638
|
+
readonly searchString: ISettableObservable<string, void>;
|
|
1639
|
+
readonly isRegex: ISettableObservable<boolean, void>;
|
|
1640
|
+
readonly matchCase: ISettableObservable<boolean, void>;
|
|
1641
|
+
readonly wholeWord: ISettableObservable<boolean, void>;
|
|
1642
|
+
readonly searchScope: ISettableObservable<OffsetRange | undefined, void>;
|
|
1643
|
+
readonly currentMatch: ISettableObservable<OffsetRange | undefined, void>;
|
|
1644
|
+
readonly loop: ISettableObservable<boolean, void>;
|
|
1645
|
+
readonly searchResult: IObservableWithChange< {
|
|
1646
|
+
kind: "invalid";
|
|
1647
|
+
error: Error;
|
|
1648
|
+
pattern?: undefined;
|
|
1649
|
+
matches?: undefined;
|
|
1650
|
+
isCapped?: undefined;
|
|
1651
|
+
} | {
|
|
1652
|
+
kind: "valid";
|
|
1653
|
+
pattern: FindPattern;
|
|
1654
|
+
matches: readonly OffsetRange[];
|
|
1655
|
+
isCapped: boolean;
|
|
1656
|
+
error?: undefined;
|
|
1657
|
+
}, void>;
|
|
1658
|
+
readonly matchesCount: IObservableWithChange<number, void>;
|
|
1659
|
+
readonly isCapped: IObservableWithChange<boolean, void>;
|
|
1660
|
+
readonly currentMatchPosition: IObservableWithChange<number, void>;
|
|
1661
|
+
private _searchOrigin;
|
|
1662
|
+
private readonly _sourceEditTracker;
|
|
1663
|
+
private _pendingInitialDirection;
|
|
1664
|
+
constructor(_editorModel: EditorModel);
|
|
1665
|
+
reveal(options: {
|
|
1666
|
+
readonly origin: number;
|
|
1667
|
+
readonly searchString?: string;
|
|
1668
|
+
readonly direction?: FindDirection;
|
|
1669
|
+
}): void;
|
|
1670
|
+
hide(): void;
|
|
1671
|
+
setSearchOrigin(offset: number): void;
|
|
1672
|
+
setSearchScope(scope: OffsetRange | undefined): void;
|
|
1673
|
+
moveToNextMatch(): OffsetRange | undefined;
|
|
1674
|
+
moveToPreviousMatch(): OffsetRange | undefined;
|
|
1675
|
+
private _move;
|
|
1676
|
+
private _selectFromOrigin;
|
|
1677
|
+
private _mapStateThroughEdit;
|
|
1678
|
+
private _inputSnapshot;
|
|
1679
|
+
private _readInputSnapshot;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
757
1682
|
/**
|
|
758
1683
|
* Source offset (relative to `root`) of the node with `target`'s id, or
|
|
759
1684
|
* `undefined` when it is not in the tree. Ids are stable across edits, so this
|
|
@@ -761,14 +1686,117 @@ declare class EmphasisViewData {
|
|
|
761
1686
|
*/
|
|
762
1687
|
export declare function findNodeOffsetById(root: AstNode, target: AstNode): number | undefined;
|
|
763
1688
|
|
|
764
|
-
export declare
|
|
1689
|
+
export declare class FindPattern {
|
|
1690
|
+
private readonly _source;
|
|
1691
|
+
private readonly _flags;
|
|
1692
|
+
private readonly _wholeWord;
|
|
1693
|
+
private readonly _wordSeparators;
|
|
1694
|
+
readonly isEmpty: boolean;
|
|
1695
|
+
private constructor();
|
|
1696
|
+
static create(query: FindQuery): FindQueryResult;
|
|
1697
|
+
findMatches(text: string, scope?: OffsetRange, limit?: number): FindMatchesResult;
|
|
1698
|
+
findNextMatch(text: string, after: number, scope?: OffsetRange, loop?: boolean, skip?: OffsetRange): OffsetRange | undefined;
|
|
1699
|
+
findPreviousMatch(text: string, before: number, scope?: OffsetRange, loop?: boolean, skip?: OffsetRange): OffsetRange | undefined;
|
|
1700
|
+
private _forEachMatch;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
export declare interface FindQuery {
|
|
1704
|
+
readonly searchString: string;
|
|
1705
|
+
readonly isRegex: boolean;
|
|
1706
|
+
readonly matchCase: boolean;
|
|
1707
|
+
readonly wholeWord: boolean;
|
|
1708
|
+
readonly wordSeparators: string;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
export declare type FindQueryResult = {
|
|
1712
|
+
readonly kind: 'valid';
|
|
1713
|
+
readonly pattern: FindPattern;
|
|
1714
|
+
} | {
|
|
1715
|
+
readonly kind: 'invalid';
|
|
1716
|
+
readonly error: Error;
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1719
|
+
export declare type FindSearchResult = {
|
|
1720
|
+
readonly kind: 'valid';
|
|
1721
|
+
readonly pattern: FindPattern;
|
|
1722
|
+
readonly matches: readonly OffsetRange[];
|
|
1723
|
+
readonly isCapped: boolean;
|
|
1724
|
+
} | {
|
|
1725
|
+
readonly kind: 'invalid';
|
|
1726
|
+
readonly error: Error;
|
|
1727
|
+
};
|
|
1728
|
+
|
|
1729
|
+
export declare class FindWidget extends Disposable {
|
|
1730
|
+
private readonly _view;
|
|
1731
|
+
private readonly _options;
|
|
1732
|
+
readonly element: HTMLElement;
|
|
1733
|
+
readonly panelElement: HTMLElement;
|
|
1734
|
+
readonly focused: ISettableObservable<boolean, void>;
|
|
1735
|
+
private readonly _inputShell;
|
|
1736
|
+
private readonly _input;
|
|
1737
|
+
private readonly _matchesCount;
|
|
1738
|
+
private readonly _previousButton;
|
|
1739
|
+
private readonly _nextButton;
|
|
1740
|
+
private readonly _selectionButton;
|
|
1741
|
+
private readonly _caseButton;
|
|
1742
|
+
private readonly _wholeWordButton;
|
|
1743
|
+
private readonly _regexButton;
|
|
1744
|
+
private readonly _error;
|
|
1745
|
+
constructor(_view: EditorView, _options: FindWidgetOptions);
|
|
1746
|
+
focusAndSelect(): void;
|
|
1747
|
+
private _registerButton;
|
|
1748
|
+
private _render;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
export declare interface FindWidgetOptions {
|
|
1752
|
+
readonly findModel: FindModel;
|
|
1753
|
+
readonly canFindInSelection: IObservable<boolean>;
|
|
1754
|
+
readonly onNext: () => void;
|
|
1755
|
+
readonly onPrevious: () => void;
|
|
1756
|
+
readonly onToggleFindInSelection: () => void;
|
|
1757
|
+
readonly onClose: () => void;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
export declare function findWordAt(text: string, offset: number, config?: WordNavigationConfig): {
|
|
765
1761
|
start: number;
|
|
766
1762
|
end: number;
|
|
767
1763
|
};
|
|
768
1764
|
|
|
769
|
-
export declare function findWordBoundaryLeft(text: string, offset: number): number;
|
|
1765
|
+
export declare function findWordBoundaryLeft(text: string, offset: number, config?: WordNavigationConfig): number;
|
|
1766
|
+
|
|
1767
|
+
export declare function findWordBoundaryRight(text: string, offset: number, config?: WordNavigationConfig): number;
|
|
1768
|
+
|
|
1769
|
+
export declare function findWordDeleteBoundaryLeft(text: string, offset: number, config?: WordNavigationConfig): number;
|
|
1770
|
+
|
|
1771
|
+
export declare function findWordDeleteBoundaryRight(text: string, offset: number, config?: WordNavigationConfig): number;
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* A leading YAML front matter block. The YAML value is intentionally opaque:
|
|
1775
|
+
* only the two fences and the exact source between them are modeled.
|
|
1776
|
+
*/
|
|
1777
|
+
export declare class FrontMatterAstNode extends BlockAstNodeBase {
|
|
1778
|
+
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
1779
|
+
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
1780
|
+
readonly kind = "frontMatter";
|
|
1781
|
+
constructor(content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
|
|
1782
|
+
get children(): readonly AstNode[];
|
|
1783
|
+
get openFence(): MarkerAstNode | undefined;
|
|
1784
|
+
get closeFence(): MarkerAstNode | undefined;
|
|
1785
|
+
get value(): MarkerAstNode | undefined;
|
|
1786
|
+
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
1787
|
+
withLeadingTrivia(trivia: GlueAstNode | undefined): FrontMatterAstNode;
|
|
1788
|
+
}
|
|
770
1789
|
|
|
771
|
-
|
|
1790
|
+
declare class FrontMatterViewData {
|
|
1791
|
+
readonly ast: FrontMatterAstNode;
|
|
1792
|
+
/** Active: render both fences; inactive: render only the opaque YAML value. */
|
|
1793
|
+
readonly showMarkup: boolean;
|
|
1794
|
+
readonly content: readonly AnyViewData[];
|
|
1795
|
+
readonly kind = "frontMatter";
|
|
1796
|
+
constructor(ast: FrontMatterAstNode,
|
|
1797
|
+
/** Active: render both fences; inactive: render only the opaque YAML value. */
|
|
1798
|
+
showMarkup: boolean, content: readonly AnyViewData[]);
|
|
1799
|
+
}
|
|
772
1800
|
|
|
773
1801
|
export declare function getAnnotatedSource(node: AstNode, source: string, offset?: number): string;
|
|
774
1802
|
|
|
@@ -828,10 +1856,10 @@ export declare type GutterMarkerType = 'added' | 'modified' | 'deleted';
|
|
|
828
1856
|
export declare class HeadingAstNode extends BlockAstNodeBase {
|
|
829
1857
|
readonly level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
830
1858
|
readonly marker: MarkerAstNode;
|
|
831
|
-
readonly content: readonly
|
|
1859
|
+
readonly content: readonly InlineContentAstNode[];
|
|
832
1860
|
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
833
1861
|
readonly kind = "heading";
|
|
834
|
-
constructor(level: 1 | 2 | 3 | 4 | 5 | 6, marker: MarkerAstNode, content: readonly
|
|
1862
|
+
constructor(level: 1 | 2 | 3 | 4 | 5 | 6, marker: MarkerAstNode, content: readonly InlineContentAstNode[], leadingTrivia?: GlueAstNode | undefined);
|
|
835
1863
|
get children(): readonly AstNode[];
|
|
836
1864
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
837
1865
|
withLeadingTrivia(trivia: GlueAstNode | undefined): HeadingAstNode;
|
|
@@ -845,6 +1873,19 @@ declare class HeadingViewData {
|
|
|
845
1873
|
constructor(ast: HeadingAstNode, content: readonly AnyViewData[]);
|
|
846
1874
|
}
|
|
847
1875
|
|
|
1876
|
+
export declare function hiddenCursorRanges(doc: DocumentAstNode, markerVisibleBlocks: ReadonlySet<BlockAstNode>, selectionRange: OffsetRange): readonly OffsetRange[];
|
|
1877
|
+
|
|
1878
|
+
export declare type HistoryKeyboardAction = 'undo' | 'redo';
|
|
1879
|
+
|
|
1880
|
+
/** A block HTML comment, discriminated by whether its closing delimiter is present. */
|
|
1881
|
+
declare type HtmlCommentSource = OpenHtmlCommentSource | CompleteHtmlCommentSource;
|
|
1882
|
+
|
|
1883
|
+
declare interface HtmlCommentSourceBase {
|
|
1884
|
+
readonly leadingWhitespace: string;
|
|
1885
|
+
readonly opening: '<!--';
|
|
1886
|
+
readonly body: string;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
848
1889
|
/**
|
|
849
1890
|
* The editor operations a clipboard strategy drives. The strategy never
|
|
850
1891
|
* touches the model or the DOM directly — it asks through this seam, so the
|
|
@@ -890,6 +1931,87 @@ export declare interface IDefaultMonarchGrammars {
|
|
|
890
1931
|
python: unknown;
|
|
891
1932
|
rust: unknown;
|
|
892
1933
|
shell: unknown;
|
|
1934
|
+
yaml: unknown;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* A live editor embedded in place of a fenced code block's *rendered* form.
|
|
1939
|
+
*
|
|
1940
|
+
* This is the internal seam between the block view and a concrete embedded
|
|
1941
|
+
* editor (e.g. an `<iframe>` speaking the web-editor protocol). The block view
|
|
1942
|
+
* only speaks string edits: it pushes the block's content down via
|
|
1943
|
+
* {@link setContent} and receives the editor's own changes back through
|
|
1944
|
+
* {@link onEdit} (set by the block view on each (re)construction, so it always
|
|
1945
|
+
* routes to the current AST node). The concrete implementation owns its DOM,
|
|
1946
|
+
* transport, and lifecycle.
|
|
1947
|
+
*
|
|
1948
|
+
* A single instance is adopted across re-renders (like the highlighter session)
|
|
1949
|
+
* so the underlying editor keeps its state across edits — see
|
|
1950
|
+
* {@link CodeBlockViewNode}.
|
|
1951
|
+
*/
|
|
1952
|
+
declare interface IEmbeddedCodeEditor {
|
|
1953
|
+
/** The element mounted as the block's rendered form. */
|
|
1954
|
+
readonly element: HTMLElement;
|
|
1955
|
+
/**
|
|
1956
|
+
* Document → editor. The block's content changed (from any source). Must be
|
|
1957
|
+
* idempotent: pushing the content the editor already holds is a no-op, which
|
|
1958
|
+
* is how edits the editor itself originated are prevented from echoing back.
|
|
1959
|
+
*/
|
|
1960
|
+
setContent(content: string): void;
|
|
1961
|
+
/** Update whether the embedded editor may change its content. */
|
|
1962
|
+
setReadOnly?(readOnly: boolean): void;
|
|
1963
|
+
/**
|
|
1964
|
+
* Optional synchronous height (px) to reserve for `content` *before* the
|
|
1965
|
+
* editor has laid out. Return `undefined` to let the editor size itself
|
|
1966
|
+
* (the implementation may report its real height later). Lets a registration
|
|
1967
|
+
* avoid a layout jump when it can cheaply estimate the size from content.
|
|
1968
|
+
*/
|
|
1969
|
+
estimateHeight?(content: string): number | undefined;
|
|
1970
|
+
/**
|
|
1971
|
+
* Editor → document. Set by the block view on every (re)construction to
|
|
1972
|
+
* route the editor's own edits, expressed in the block's *content*
|
|
1973
|
+
* coordinates, to the current AST node.
|
|
1974
|
+
*/
|
|
1975
|
+
onEdit?: (edit: StringEdit) => void;
|
|
1976
|
+
dispose(): void;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
/** Creates an {@link IEmbeddedCodeEditor} for a fenced block, or opts out. */
|
|
1980
|
+
declare interface IEmbeddedCodeEditorFactory {
|
|
1981
|
+
/**
|
|
1982
|
+
* Return an editor for a fenced block, or `undefined` to fall
|
|
1983
|
+
* back to the default (highlighting / {@link BlockViewOptions.renderCustomCodeBlock}).
|
|
1984
|
+
*/
|
|
1985
|
+
create(language: string, infoString: string, initialContent: string): IEmbeddedCodeEditor | undefined;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
/**
|
|
1989
|
+
* Routes undo and redo to whatever owns the document's history: the editor
|
|
1990
|
+
* itself on a standalone page, or the enclosing document in a host like
|
|
1991
|
+
* VS Code.
|
|
1992
|
+
*/
|
|
1993
|
+
export declare interface IHistoryStrategy {
|
|
1994
|
+
undo(): void;
|
|
1995
|
+
redo(): void;
|
|
1996
|
+
/**
|
|
1997
|
+
* Invoked around each source mutation so the strategy can record it.
|
|
1998
|
+
* Implemented only by strategies that build their own history; a host that
|
|
1999
|
+
* forwards edits to a VS Code `TextDocument` lets it record them instead.
|
|
2000
|
+
*/
|
|
2001
|
+
record?(operation: () => void, edit?: StringEdit): void;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
export declare interface ILinkPresentation extends IDisposable {
|
|
2005
|
+
/** Current presentation, updated without rebuilding the editor. */
|
|
2006
|
+
readonly presentation: IObservable<LinkPresentation | undefined>;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
export declare interface ILinkPresentationProvider {
|
|
2010
|
+
/**
|
|
2011
|
+
* Returns `undefined` for unsupported links. The caller disposes the returned
|
|
2012
|
+
* reference when the rendered link disappears.
|
|
2013
|
+
*/
|
|
2014
|
+
createLinkPresentation(url: string): ILinkPresentation | undefined;
|
|
893
2015
|
}
|
|
894
2016
|
|
|
895
2017
|
export declare class ImageAstNode extends AstNode {
|
|
@@ -926,6 +2048,14 @@ export declare interface IMonarchApi {
|
|
|
926
2048
|
MonarchTokenizer: new (languageService: unknown, standaloneThemeService: unknown, languageId: string, lexer: unknown, configurationService: unknown) => MonarchTokenizer;
|
|
927
2049
|
}
|
|
928
2050
|
|
|
2051
|
+
/** Controls tab-stop insertion and non-list line indentation. */
|
|
2052
|
+
export declare interface IndentationConfig {
|
|
2053
|
+
/** Number of visual columns between tab stops. */
|
|
2054
|
+
readonly tabSize: number;
|
|
2055
|
+
/** Whether indentation uses spaces instead of tab characters. */
|
|
2056
|
+
readonly insertSpaces: boolean;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
929
2059
|
export declare type InlineAstNode = TextAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode;
|
|
930
2060
|
|
|
931
2061
|
export declare class InlineCodeAstNode extends AstNode {
|
|
@@ -943,6 +2073,8 @@ declare class InlineCodeViewData {
|
|
|
943
2073
|
constructor(ast: InlineCodeAstNode, content: readonly AnyViewData[]);
|
|
944
2074
|
}
|
|
945
2075
|
|
|
2076
|
+
declare type InlineContentAstNode = InlineAstNode | MarkerAstNode | GlueAstNode;
|
|
2077
|
+
|
|
946
2078
|
export declare class InlineMathAstNode extends AstNode {
|
|
947
2079
|
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
948
2080
|
readonly kind = "inlineMath";
|
|
@@ -980,17 +2112,29 @@ export declare const insertParagraph: EditCommand;
|
|
|
980
2112
|
* - paragraph / heading / thematic break — the "rich text" thing: at the
|
|
981
2113
|
* block's end arm a transient empty paragraph (see {@link SmartEnterResult});
|
|
982
2114
|
* elsewhere split into two paragraphs (`\n\n`).
|
|
983
|
-
* - code
|
|
984
|
-
* staying inside the
|
|
2115
|
+
* - fenced code / front matter — insert a newline that preserves the current
|
|
2116
|
+
* line's indentation, staying inside the fences.
|
|
2117
|
+
* - video — leave the completed HTML block at its end; otherwise insert a
|
|
2118
|
+
* normal source line break.
|
|
985
2119
|
* - block quote — continue the quote (`\n> `); an empty quote line exits it.
|
|
986
2120
|
* - list — continue the list with the next marker (incrementing ordered
|
|
987
|
-
* numbers, re-emitting task checkboxes); an empty item
|
|
2121
|
+
* numbers, re-emitting task checkboxes); an empty item outdents one level
|
|
2122
|
+
* before exiting the list.
|
|
2123
|
+
* - complete HTML comment — at the comment's end, leave it by arming a
|
|
2124
|
+
* transient paragraph; inside it (or while the comment is open), insert a
|
|
2125
|
+
* normal source line break.
|
|
988
2126
|
* A non-collapsed selection, or any other block, falls back to a plain soft line
|
|
989
2127
|
* break, preserving today's behaviour.
|
|
990
2128
|
*/
|
|
991
2129
|
export declare const insertSmartEnter: (ctx: CursorCommandContext) => SmartEnterResult;
|
|
992
2130
|
|
|
993
|
-
|
|
2131
|
+
/**
|
|
2132
|
+
* VS Code-style Tab: insert to the next tab stop for a caret or partial
|
|
2133
|
+
* single-line selection, and indent every selected line for a line selection.
|
|
2134
|
+
*/
|
|
2135
|
+
export declare function insertTab(config?: IndentationConfig): EditCommand;
|
|
2136
|
+
|
|
2137
|
+
export declare function insertText(text: string, generatedIndentation?: OffsetRange): EditCommand;
|
|
994
2138
|
|
|
995
2139
|
/**
|
|
996
2140
|
* An immutable view of one document's tokens at a point in time. It may be a
|
|
@@ -1031,6 +2175,31 @@ export declare interface ISyntaxHighlighterDocument extends IDisposable {
|
|
|
1031
2175
|
readonly snapshot: IObservableWithChange<ISyntaxHighlightedSnapshot, LengthEdit>;
|
|
1032
2176
|
}
|
|
1033
2177
|
|
|
2178
|
+
export declare const joinLines: EditCommand;
|
|
2179
|
+
|
|
2180
|
+
export declare interface KeyboardBinding {
|
|
2181
|
+
readonly key: string;
|
|
2182
|
+
readonly modifiers?: KeyboardModifiers;
|
|
2183
|
+
readonly platforms?: readonly KeyboardPlatform[];
|
|
2184
|
+
readonly action: EditorKeyboardAction;
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
export declare interface KeyboardModifiers {
|
|
2188
|
+
readonly shift?: boolean;
|
|
2189
|
+
readonly alt?: boolean;
|
|
2190
|
+
readonly ctrl?: boolean;
|
|
2191
|
+
readonly meta?: boolean;
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
export declare type KeyboardPlatform = 'macos' | 'windows' | 'linux';
|
|
2195
|
+
|
|
2196
|
+
export declare interface KeyboardProfile {
|
|
2197
|
+
/**
|
|
2198
|
+
* Bindings in priority order. The first exact key/modifier/platform match wins.
|
|
2199
|
+
*/
|
|
2200
|
+
readonly bindings: readonly KeyboardBinding[];
|
|
2201
|
+
}
|
|
2202
|
+
|
|
1034
2203
|
declare abstract class LeafAstNode extends AstNode {
|
|
1035
2204
|
abstract readonly content: string;
|
|
1036
2205
|
get children(): readonly AstNode[];
|
|
@@ -1079,19 +2248,55 @@ export declare class LengthReplacement {
|
|
|
1079
2248
|
|
|
1080
2249
|
export declare class LinkAstNode extends AstNode {
|
|
1081
2250
|
readonly url: string;
|
|
1082
|
-
readonly content: readonly
|
|
2251
|
+
readonly content: readonly InlineContentAstNode[];
|
|
1083
2252
|
readonly kind = "link";
|
|
1084
|
-
constructor(url: string, content: readonly
|
|
2253
|
+
constructor(url: string, content: readonly InlineContentAstNode[]);
|
|
1085
2254
|
get children(): readonly AstNode[];
|
|
1086
2255
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
1087
2256
|
protected _localEquals(o: this): boolean;
|
|
1088
2257
|
}
|
|
1089
2258
|
|
|
2259
|
+
/**
|
|
2260
|
+
* Declarative rendering data for one link. `kind` selects the package-owned
|
|
2261
|
+
* visual treatment; providers never supply DOM or CSS.
|
|
2262
|
+
*/
|
|
2263
|
+
export declare interface LinkPresentation {
|
|
2264
|
+
readonly kind: LinkPresentationKind;
|
|
2265
|
+
readonly title?: string;
|
|
2266
|
+
readonly detail?: string;
|
|
2267
|
+
readonly reference?: string;
|
|
2268
|
+
/** Primary resource state, such as pull-request lifecycle or session state. */
|
|
2269
|
+
readonly status?: LinkPresentationStatus;
|
|
2270
|
+
/** Secondary state, such as pull-request CI status. */
|
|
2271
|
+
readonly secondaryStatus?: LinkPresentationStatus;
|
|
2272
|
+
readonly changes?: LinkPresentationChanges;
|
|
2273
|
+
readonly tooltip?: string;
|
|
2274
|
+
readonly ariaLabel?: string;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
declare interface LinkPresentationChanges {
|
|
2278
|
+
readonly insertions: number;
|
|
2279
|
+
readonly deletions: number;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
export declare type LinkPresentationKind = 'resource' | 'issue' | 'pullRequest' | 'commit' | 'file' | 'folder' | 'session' | 'repository' | 'branch';
|
|
2283
|
+
|
|
2284
|
+
export declare interface LinkPresentationStatus {
|
|
2285
|
+
readonly kind: LinkPresentationStatusKind;
|
|
2286
|
+
readonly label: string;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
export declare type LinkPresentationStatusKind = 'neutral' | 'pending' | 'success' | 'warning' | 'error' | 'open' | 'closed' | 'merged' | 'draft' | 'notPlanned';
|
|
2290
|
+
|
|
1090
2291
|
declare class LinkViewData {
|
|
1091
2292
|
readonly ast: LinkAstNode;
|
|
2293
|
+
/** Active: render the Markdown source; inactive: allow a rich presentation. */
|
|
2294
|
+
readonly showMarkup: boolean;
|
|
1092
2295
|
readonly content: readonly AnyViewData[];
|
|
1093
2296
|
readonly kind = "link";
|
|
1094
|
-
constructor(ast: LinkAstNode,
|
|
2297
|
+
constructor(ast: LinkAstNode,
|
|
2298
|
+
/** Active: render the Markdown source; inactive: allow a rich presentation. */
|
|
2299
|
+
showMarkup: boolean, content: readonly AnyViewData[]);
|
|
1095
2300
|
}
|
|
1096
2301
|
|
|
1097
2302
|
export declare class ListAstNode extends BlockAstNodeBase {
|
|
@@ -1128,12 +2333,26 @@ declare class ListItemViewData {
|
|
|
1128
2333
|
readonly content: readonly AnyViewData[];
|
|
1129
2334
|
/** 1-based list nesting depth, used to size the indentation gutter. */
|
|
1130
2335
|
readonly level: number;
|
|
2336
|
+
/**
|
|
2337
|
+
* Whether this is an inactive task item whose first paragraph begins
|
|
2338
|
+
* with the `:running:` marker (see {@link TextViewData.hiddenPrefixLength}).
|
|
2339
|
+
* Always `false` while the item is active — an active/editing task
|
|
2340
|
+
* reveals the literal marker instead of the progress affordance.
|
|
2341
|
+
*/
|
|
2342
|
+
readonly isRunning: boolean;
|
|
1131
2343
|
readonly kind = "listItem";
|
|
1132
2344
|
constructor(ast: ListItemAstNode,
|
|
1133
2345
|
/** Whether the selection reaches this item (reveals its markers). */
|
|
1134
2346
|
isActive: boolean, content: readonly AnyViewData[],
|
|
1135
2347
|
/** 1-based list nesting depth, used to size the indentation gutter. */
|
|
1136
|
-
level: number
|
|
2348
|
+
level: number,
|
|
2349
|
+
/**
|
|
2350
|
+
* Whether this is an inactive task item whose first paragraph begins
|
|
2351
|
+
* with the `:running:` marker (see {@link TextViewData.hiddenPrefixLength}).
|
|
2352
|
+
* Always `false` while the item is active — an active/editing task
|
|
2353
|
+
* reveals the literal marker instead of the progress affordance.
|
|
2354
|
+
*/
|
|
2355
|
+
isRunning?: boolean);
|
|
1137
2356
|
}
|
|
1138
2357
|
|
|
1139
2358
|
declare class ListViewData {
|
|
@@ -1143,6 +2362,32 @@ declare class ListViewData {
|
|
|
1143
2362
|
constructor(ast: ListAstNode, content: readonly AnyViewData[]);
|
|
1144
2363
|
}
|
|
1145
2364
|
|
|
2365
|
+
/**
|
|
2366
|
+
* Compact in-memory history for editors that hold the only copy of the
|
|
2367
|
+
* document, such as a standalone browser page. Where the surrounding host
|
|
2368
|
+
* already records history — a VS Code `TextDocument` — forward to that
|
|
2369
|
+
* instead.
|
|
2370
|
+
*/
|
|
2371
|
+
export declare class LocalHistoryStrategy implements IHistoryStrategy {
|
|
2372
|
+
private readonly _model;
|
|
2373
|
+
private readonly _past;
|
|
2374
|
+
private readonly _future;
|
|
2375
|
+
/**
|
|
2376
|
+
* The source text as of the last change this strategy recorded or applied.
|
|
2377
|
+
* Any other value means the document was replaced behind its back, so the
|
|
2378
|
+
* stored edits no longer line up and must be discarded rather than applied.
|
|
2379
|
+
*/
|
|
2380
|
+
private _lastKnownText;
|
|
2381
|
+
constructor(_model: EditorModel);
|
|
2382
|
+
record(operation: () => void, edit?: StringEdit): void;
|
|
2383
|
+
undo(): void;
|
|
2384
|
+
redo(): void;
|
|
2385
|
+
/** The entry on top of `stack`, or `undefined` when it cannot be applied. */
|
|
2386
|
+
private _peekApplicable;
|
|
2387
|
+
private _apply;
|
|
2388
|
+
private _clear;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
1146
2391
|
/**
|
|
1147
2392
|
* Parses markdown into a {@link DocumentAstNode}.
|
|
1148
2393
|
*
|
|
@@ -1249,8 +2494,8 @@ export declare class MeasuredLayoutDebugRendering {
|
|
|
1249
2494
|
* Exposes two DOM nodes the caller can place independently:
|
|
1250
2495
|
*
|
|
1251
2496
|
* - {@link overlayElement} — absolutely positioned; the caller mounts it
|
|
1252
|
-
* inside the editor
|
|
1253
|
-
*
|
|
2497
|
+
* inside the editor overlay container so dashed line-bands and run-boxes
|
|
2498
|
+
* share the measured editor-local coordinates.
|
|
1254
2499
|
* - {@link infoElement} — block-flow; the caller mounts it as a sibling
|
|
1255
2500
|
* *below* the editor. Contains the per-block summary table that used
|
|
1256
2501
|
* to live on the overlay.
|
|
@@ -1261,7 +2506,6 @@ export declare class MeasuredLayoutDebugRendering {
|
|
|
1261
2506
|
* the derived subscribed.
|
|
1262
2507
|
*/
|
|
1263
2508
|
export declare class MeasuredLayoutDebugView extends Disposable {
|
|
1264
|
-
private readonly _overlayParent;
|
|
1265
2509
|
readonly overlayElement: HTMLElement;
|
|
1266
2510
|
readonly infoElement: HTMLElement;
|
|
1267
2511
|
readonly rendering: IObservable<MeasuredLayoutDebugRendering>;
|
|
@@ -1274,6 +2518,7 @@ export declare class MeasuredLayoutDebugView extends Disposable {
|
|
|
1274
2518
|
|
|
1275
2519
|
export declare interface MeasuredLayoutDebugViewOptions {
|
|
1276
2520
|
readonly model: MeasuredLayoutModel;
|
|
2521
|
+
readonly coordinateSpace: EditorCoordinateSpace;
|
|
1277
2522
|
/**
|
|
1278
2523
|
* DEBUG ONLY. Maps an absolute source offset to a fill color for that
|
|
1279
2524
|
* character's glyph rect. The fixture passes the same function to the
|
|
@@ -1306,14 +2551,16 @@ export declare interface MeasuredLayoutDebugViewOptions {
|
|
|
1306
2551
|
* through this model and never touches view fields directly.
|
|
1307
2552
|
*/
|
|
1308
2553
|
export declare class MeasuredLayoutModel {
|
|
1309
|
-
|
|
2554
|
+
private readonly _measurements;
|
|
2555
|
+
readonly measurements: IObservable<readonly BlockMeasurement[]>;
|
|
2556
|
+
private readonly _virtualLines;
|
|
1310
2557
|
/**
|
|
1311
|
-
* Concatenated visual line map across all mounted blocks.
|
|
1312
|
-
*
|
|
1313
|
-
*
|
|
1314
|
-
* concatenation is well-formed without re-sorting.
|
|
2558
|
+
* Concatenated visual line map across all mounted blocks. Every per-block
|
|
2559
|
+
* map uses the same editor-local coordinate space, so concatenation is
|
|
2560
|
+
* well-formed without translation or re-sorting.
|
|
1315
2561
|
*/
|
|
1316
2562
|
readonly visualLineMap: IObservableWithChange<VisualLineMap, void>;
|
|
2563
|
+
setMeasurements(measurements: readonly BlockMeasurement[], virtualLines: readonly VirtualLineMeasurement[]): void;
|
|
1317
2564
|
}
|
|
1318
2565
|
|
|
1319
2566
|
/**
|
|
@@ -1342,6 +2589,10 @@ export declare class MonacoSyntaxHighlighter implements ISyntaxHighlighter {
|
|
|
1342
2589
|
private _tokenizerFor;
|
|
1343
2590
|
}
|
|
1344
2591
|
|
|
2592
|
+
export declare const moveLinesDown: EditCommand;
|
|
2593
|
+
|
|
2594
|
+
export declare const moveLinesUp: EditCommand;
|
|
2595
|
+
|
|
1345
2596
|
/**
|
|
1346
2597
|
* Default strategy: handle the browser's native `copy`/`cut`/`paste` events,
|
|
1347
2598
|
* reading and writing the synchronous {@link ClipboardEvent.clipboardData}.
|
|
@@ -1353,14 +2604,25 @@ export declare class NativeClipboardStrategy implements IClipboardStrategy {
|
|
|
1353
2604
|
connect(context: IClipboardContext): IDisposable;
|
|
1354
2605
|
}
|
|
1355
2606
|
|
|
2607
|
+
declare interface NestedItem {
|
|
2608
|
+
readonly kind: 'nested';
|
|
2609
|
+
readonly original: AstNode;
|
|
2610
|
+
readonly originalStart: number;
|
|
2611
|
+
readonly modified: AstNode;
|
|
2612
|
+
readonly modifiedStart: number;
|
|
2613
|
+
readonly children: readonly DiffItem[];
|
|
2614
|
+
}
|
|
2615
|
+
|
|
1356
2616
|
/**
|
|
1357
|
-
* Move the cursor one position left or right, skipping over hidden
|
|
2617
|
+
* Move the cursor one position left or right, skipping over hidden source
|
|
1358
2618
|
* ranges in inactive blocks (and inactive items of an active list).
|
|
1359
2619
|
*/
|
|
1360
|
-
export declare function nextCursorPosition(doc: DocumentAstNode,
|
|
2620
|
+
export declare function nextCursorPosition(doc: DocumentAstNode, markerVisibleBlocks: ReadonlySet<BlockAstNode>, cursor: number, direction: 'left' | 'right', selectionRange?: OffsetRange): number;
|
|
1361
2621
|
|
|
1362
2622
|
declare const NO_ACTIVE_BLOCKS: unique symbol;
|
|
1363
2623
|
|
|
2624
|
+
export declare function normalizeCursorPosition(doc: DocumentAstNode, markerVisibleBlocks: ReadonlySet<BlockAstNode>, cursor: number, target: number, direction: 'left' | 'right', includeHiddenRangeBoundary?: boolean, selectionRange?: OffsetRange): number;
|
|
2625
|
+
|
|
1364
2626
|
export declare class OffsetRange {
|
|
1365
2627
|
readonly start: number;
|
|
1366
2628
|
readonly endExclusive: number;
|
|
@@ -1388,11 +2650,19 @@ export declare class OffsetRange {
|
|
|
1388
2650
|
toString(): string;
|
|
1389
2651
|
}
|
|
1390
2652
|
|
|
2653
|
+
/** The lossless source slices of a block HTML comment whose closer has not been typed. */
|
|
2654
|
+
declare interface OpenHtmlCommentSource extends HtmlCommentSourceBase {
|
|
2655
|
+
readonly kind: 'open';
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
/** Outdent the current line, or every line touched by the selection. */
|
|
2659
|
+
export declare function outdent(config?: IndentationConfig): EditCommand;
|
|
2660
|
+
|
|
1391
2661
|
export declare class ParagraphAstNode extends BlockAstNodeBase {
|
|
1392
|
-
readonly content: readonly
|
|
2662
|
+
readonly content: readonly InlineContentAstNode[];
|
|
1393
2663
|
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
1394
2664
|
readonly kind = "paragraph";
|
|
1395
|
-
constructor(content: readonly
|
|
2665
|
+
constructor(content: readonly InlineContentAstNode[], leadingTrivia?: GlueAstNode | undefined);
|
|
1396
2666
|
get children(): readonly AstNode[];
|
|
1397
2667
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
1398
2668
|
withLeadingTrivia(trivia: GlueAstNode | undefined): ParagraphAstNode;
|
|
@@ -1406,23 +2676,32 @@ declare class ParagraphViewData {
|
|
|
1406
2676
|
}
|
|
1407
2677
|
|
|
1408
2678
|
/**
|
|
1409
|
-
* A *transient* editing state:
|
|
1410
|
-
*
|
|
1411
|
-
*
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1414
|
-
* user
|
|
2679
|
+
* A *transient* editing state: an empty paragraph adjacent to a real block.
|
|
2680
|
+
* Markdown has no empty-paragraph node, so this never lives in
|
|
2681
|
+
* {@link EditorModel['sourceText']} or the parsed {@link EditorModel.document}
|
|
2682
|
+
* — it is pure edit intent that the view renders as a synthetic blank line and
|
|
2683
|
+
* that the controller either *materializes* (the user types) or *cancels* (the
|
|
2684
|
+
* user navigates away / backspaces).
|
|
1415
2685
|
*/
|
|
1416
2686
|
declare interface PendingParagraph {
|
|
1417
|
-
/** The
|
|
2687
|
+
/** The block the blank line is rendered directly after. */
|
|
1418
2688
|
readonly anchorBlock: BlockAstNode;
|
|
1419
2689
|
/**
|
|
1420
2690
|
* Source region rewritten when the pending paragraph is materialized — the
|
|
1421
2691
|
* gap between {@link anchorBlock}'s text and whatever follows it.
|
|
1422
2692
|
*/
|
|
1423
2693
|
readonly replaceRange: OffsetRange;
|
|
2694
|
+
/** Whether materialized text needs a blank-line separator before it. */
|
|
2695
|
+
readonly separateFromPreviousBlock: boolean;
|
|
1424
2696
|
/** Whether {@link replaceRange} ends at the end of the document. */
|
|
1425
2697
|
readonly atEof: boolean;
|
|
2698
|
+
/**
|
|
2699
|
+
* Horizontal whitespace typed on the source-less line. It remains transient
|
|
2700
|
+
* until other input materializes the paragraph. Contains only spaces and tabs.
|
|
2701
|
+
*/
|
|
2702
|
+
readonly text: string;
|
|
2703
|
+
/** The source-less visual line occupied by the pending caret. */
|
|
2704
|
+
readonly cursorLine: VirtualCursorLine;
|
|
1426
2705
|
/**
|
|
1427
2706
|
* A throwaway AST node that exists only to give the synthetic view child a
|
|
1428
2707
|
* stable identity across render frames (the view pairs nodes by `ast.id`).
|
|
@@ -1431,21 +2710,51 @@ declare interface PendingParagraph {
|
|
|
1431
2710
|
readonly syntheticAst: ParagraphAstNode;
|
|
1432
2711
|
}
|
|
1433
2712
|
|
|
2713
|
+
declare interface PendingParagraphResult {
|
|
2714
|
+
readonly kind: 'pending';
|
|
2715
|
+
readonly anchorBlock: BlockAstNode;
|
|
2716
|
+
readonly replaceRange: OffsetRange;
|
|
2717
|
+
/** Whether materialized text needs a blank-line separator before it. */
|
|
2718
|
+
readonly separateFromPreviousBlock: boolean;
|
|
2719
|
+
readonly atEof: boolean;
|
|
2720
|
+
}
|
|
2721
|
+
|
|
1434
2722
|
/**
|
|
1435
2723
|
* View-data for the transient empty paragraph (see `PendingParagraph` in the
|
|
1436
|
-
* model). It carries
|
|
1437
|
-
* rendered
|
|
1438
|
-
*
|
|
1439
|
-
*
|
|
2724
|
+
* model). It carries the throwaway {@link ParagraphAstNode} that gives the
|
|
2725
|
+
* rendered line a stable identity across frames, its anchor block, source-less
|
|
2726
|
+
* cursor line, and transient horizontal whitespace. It has no source content or
|
|
2727
|
+
* selection range.
|
|
1440
2728
|
*/
|
|
1441
2729
|
declare class PendingParagraphViewData {
|
|
1442
2730
|
readonly ast: ParagraphAstNode;
|
|
2731
|
+
readonly anchorBlock: BlockAstNode;
|
|
2732
|
+
readonly cursorLine: VirtualCursorLine;
|
|
2733
|
+
readonly text: string;
|
|
1443
2734
|
readonly kind = "pendingParagraph";
|
|
1444
|
-
constructor(ast: ParagraphAstNode);
|
|
2735
|
+
constructor(ast: ParagraphAstNode, anchorBlock: BlockAstNode, cursorLine: VirtualCursorLine, text: string);
|
|
1445
2736
|
}
|
|
1446
2737
|
|
|
1447
2738
|
/**
|
|
1448
|
-
*
|
|
2739
|
+
* The mounted transient empty paragraph: a `<p class="md-pending-paragraph">`
|
|
2740
|
+
* holding either a `<br>` or decorated transient horizontal whitespace. It is a
|
|
2741
|
+
* leaf view node with no inline source content; the document view publishes its
|
|
2742
|
+
* element geometry as a virtual visual line.
|
|
2743
|
+
*/
|
|
2744
|
+
declare class PendingParagraphViewNode extends ViewNode {
|
|
2745
|
+
readonly element: HTMLElement;
|
|
2746
|
+
readonly anchorBlock: BlockAstNode;
|
|
2747
|
+
readonly cursorLine: VirtualCursorLine;
|
|
2748
|
+
private _text;
|
|
2749
|
+
constructor(view: PendingParagraphViewData);
|
|
2750
|
+
update(text: string): void;
|
|
2751
|
+
getCaretClientRect(): DOMRect;
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
/**
|
|
2755
|
+
* Immutable point in a caller-defined 2D CSS-pixel coordinate space.
|
|
2756
|
+
* Coordinate-owning APIs must document whether values are viewport-client or
|
|
2757
|
+
* editor-local; values from different spaces must not be mixed.
|
|
1449
2758
|
*/
|
|
1450
2759
|
export declare class Point2D {
|
|
1451
2760
|
readonly x: number;
|
|
@@ -1456,8 +2765,8 @@ export declare class Point2D {
|
|
|
1456
2765
|
}
|
|
1457
2766
|
|
|
1458
2767
|
/**
|
|
1459
|
-
* Immutable axis-aligned rectangle in
|
|
1460
|
-
*
|
|
2768
|
+
* Immutable axis-aligned rectangle in a caller-defined 2D CSS-pixel coordinate
|
|
2769
|
+
* space. `x`/`y` is the top-left corner, growing right/down.
|
|
1461
2770
|
*
|
|
1462
2771
|
* Half-open in both dimensions: `right` and `bottom` are excluded.
|
|
1463
2772
|
*/
|
|
@@ -1483,6 +2792,48 @@ export declare class Rect2D {
|
|
|
1483
2792
|
translate(dx: number, dy: number): Rect2D;
|
|
1484
2793
|
}
|
|
1485
2794
|
|
|
2795
|
+
declare interface RemovedItem {
|
|
2796
|
+
readonly kind: 'removed';
|
|
2797
|
+
readonly node: AstNode;
|
|
2798
|
+
readonly originalStart: number;
|
|
2799
|
+
readonly deletedLocal: readonly AnnotatedRange[];
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
declare interface ReplacedItem {
|
|
2803
|
+
readonly kind: 'replaced';
|
|
2804
|
+
readonly original: AstNode;
|
|
2805
|
+
readonly originalStart: number;
|
|
2806
|
+
readonly modified: AstNode;
|
|
2807
|
+
readonly modifiedStart: number;
|
|
2808
|
+
readonly insertedLocal: readonly AnnotatedRange[];
|
|
2809
|
+
readonly deletedLocal: readonly AnnotatedRange[];
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
export declare class RichLink {
|
|
2813
|
+
static create(options: RichLinkOptions): RichLink;
|
|
2814
|
+
static mount(element: HTMLElement, authoredLabel: HTMLSpanElement): RichLink;
|
|
2815
|
+
static clear(element: HTMLElement): void;
|
|
2816
|
+
readonly element: HTMLElement;
|
|
2817
|
+
readonly authoredLabel: HTMLSpanElement;
|
|
2818
|
+
private readonly _icon;
|
|
2819
|
+
private readonly _title;
|
|
2820
|
+
private readonly _detail;
|
|
2821
|
+
private readonly _reference;
|
|
2822
|
+
private readonly _changes;
|
|
2823
|
+
private readonly _status;
|
|
2824
|
+
private readonly _secondaryStatus;
|
|
2825
|
+
private constructor();
|
|
2826
|
+
update(presentation: LinkPresentation | undefined): void;
|
|
2827
|
+
private _renderUnavailable;
|
|
2828
|
+
private _setDefaultOrder;
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
export declare interface RichLinkOptions {
|
|
2832
|
+
readonly href: string;
|
|
2833
|
+
readonly authoredLabel: string;
|
|
2834
|
+
readonly presentation?: LinkPresentation;
|
|
2835
|
+
}
|
|
2836
|
+
|
|
1486
2837
|
export declare const selectAll: SelectionCommand;
|
|
1487
2838
|
|
|
1488
2839
|
export declare function selectBlock(ctx: CursorCommandContext, blockRange: OffsetRange): Selection_2;
|
|
@@ -1508,8 +2859,13 @@ export { Selection_2 as Selection }
|
|
|
1508
2859
|
export declare interface SelectionBlock {
|
|
1509
2860
|
readonly block: BlockAstNode;
|
|
1510
2861
|
readonly absoluteStart: number;
|
|
1511
|
-
|
|
1512
|
-
readonly
|
|
2862
|
+
/** Block border box in editor-local coordinates. */
|
|
2863
|
+
readonly rect: Rect2D;
|
|
2864
|
+
/** Visible horizontal padding-box bounds for a scrolling block. */
|
|
2865
|
+
readonly viewportClip: {
|
|
2866
|
+
readonly left: number;
|
|
2867
|
+
readonly right: number;
|
|
2868
|
+
} | undefined;
|
|
1513
2869
|
}
|
|
1514
2870
|
|
|
1515
2871
|
export declare type SelectionCommand = (ctx: CursorCommandContext, offset: SourceOffset) => Selection_2;
|
|
@@ -1521,6 +2877,9 @@ export declare interface SelectionRect {
|
|
|
1521
2877
|
readonly height: number;
|
|
1522
2878
|
}
|
|
1523
2879
|
|
|
2880
|
+
/** The interaction that produced the current editor selection. */
|
|
2881
|
+
export declare type SelectionSource = 'user' | 'find';
|
|
2882
|
+
|
|
1524
2883
|
/**
|
|
1525
2884
|
* Owns the SVG overlay that paints the selection.
|
|
1526
2885
|
*
|
|
@@ -1541,11 +2900,10 @@ export declare interface SelectionRect {
|
|
|
1541
2900
|
* envelope shape used by IDE selection rendering.
|
|
1542
2901
|
*/
|
|
1543
2902
|
export declare class SelectionView extends Disposable {
|
|
1544
|
-
private readonly _parent;
|
|
1545
2903
|
readonly element: SVGSVGElement;
|
|
1546
2904
|
readonly rendering: IObservable<SelectionViewRendering>;
|
|
1547
2905
|
private readonly _path;
|
|
1548
|
-
constructor(
|
|
2906
|
+
constructor(options: SelectionViewOptions);
|
|
1549
2907
|
}
|
|
1550
2908
|
|
|
1551
2909
|
export declare interface SelectionViewOptions {
|
|
@@ -1573,12 +2931,9 @@ export declare type SmartEnterResult = {
|
|
|
1573
2931
|
readonly kind: 'edit';
|
|
1574
2932
|
readonly edit: StringEdit;
|
|
1575
2933
|
readonly selection: Selection_2;
|
|
1576
|
-
|
|
1577
|
-
readonly
|
|
1578
|
-
|
|
1579
|
-
readonly replaceRange: OffsetRange;
|
|
1580
|
-
readonly atEof: boolean;
|
|
1581
|
-
};
|
|
2934
|
+
/** Post-edit range of indentation copied onto a new fenced-code line. */
|
|
2935
|
+
readonly generatedIndentation?: OffsetRange;
|
|
2936
|
+
} | PendingParagraphResult;
|
|
1582
2937
|
|
|
1583
2938
|
/**
|
|
1584
2939
|
* A run of {@link Token}s together with the exact {@link OffsetRange} they
|
|
@@ -1593,14 +2948,22 @@ export declare interface SnapshotTokens {
|
|
|
1593
2948
|
readonly tokens: readonly Token[];
|
|
1594
2949
|
}
|
|
1595
2950
|
|
|
2951
|
+
/** Metadata delivered synchronously immediately before a model-owned source edit is applied. */
|
|
2952
|
+
export declare interface SourceEditEvent {
|
|
2953
|
+
readonly baseSourceTextId: number;
|
|
2954
|
+
readonly resultSourceTextId: number;
|
|
2955
|
+
readonly edit: StringEdit;
|
|
2956
|
+
readonly transaction: ITransaction;
|
|
2957
|
+
}
|
|
2958
|
+
|
|
1596
2959
|
export declare type SourceOffset = number;
|
|
1597
2960
|
|
|
1598
2961
|
export declare class StrikethroughAstNode extends AstNode {
|
|
1599
2962
|
readonly openMarker: MarkerAstNode;
|
|
1600
|
-
readonly content: readonly
|
|
2963
|
+
readonly content: readonly InlineContentAstNode[];
|
|
1601
2964
|
readonly closeMarker: MarkerAstNode;
|
|
1602
2965
|
readonly kind = "strikethrough";
|
|
1603
|
-
constructor(openMarker: MarkerAstNode, content: readonly
|
|
2966
|
+
constructor(openMarker: MarkerAstNode, content: readonly InlineContentAstNode[], closeMarker: MarkerAstNode);
|
|
1604
2967
|
get children(): readonly AstNode[];
|
|
1605
2968
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
1606
2969
|
}
|
|
@@ -1637,6 +3000,11 @@ export declare class StringReplacement {
|
|
|
1637
3000
|
constructor(replaceRange: OffsetRange, newText: string);
|
|
1638
3001
|
get isEmpty(): boolean;
|
|
1639
3002
|
equals(other: StringReplacement): boolean;
|
|
3003
|
+
/**
|
|
3004
|
+
* Narrows this replacement to the span that actually changes, by trimming
|
|
3005
|
+
* the prefix and suffix it shares with the text it replaces in `source`.
|
|
3006
|
+
*/
|
|
3007
|
+
removeCommonSuffixPrefix(source: string): StringReplacement;
|
|
1640
3008
|
toString(): string;
|
|
1641
3009
|
}
|
|
1642
3010
|
|
|
@@ -1650,10 +3018,10 @@ export declare class StringValue {
|
|
|
1650
3018
|
|
|
1651
3019
|
export declare class StrongAstNode extends AstNode {
|
|
1652
3020
|
readonly openMarker: MarkerAstNode;
|
|
1653
|
-
readonly content: readonly
|
|
3021
|
+
readonly content: readonly InlineContentAstNode[];
|
|
1654
3022
|
readonly closeMarker: MarkerAstNode;
|
|
1655
3023
|
readonly kind = "strong";
|
|
1656
|
-
constructor(openMarker: MarkerAstNode, content: readonly
|
|
3024
|
+
constructor(openMarker: MarkerAstNode, content: readonly InlineContentAstNode[], closeMarker: MarkerAstNode);
|
|
1657
3025
|
get children(): readonly AstNode[];
|
|
1658
3026
|
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
1659
3027
|
}
|
|
@@ -1665,6 +3033,8 @@ declare class StrongViewData {
|
|
|
1665
3033
|
constructor(ast: StrongAstNode, content: readonly AnyViewData[]);
|
|
1666
3034
|
}
|
|
1667
3035
|
|
|
3036
|
+
export declare type TabKeyboardAction = 'insert' | 'outdent';
|
|
3037
|
+
|
|
1668
3038
|
export declare class TableAstNode extends BlockAstNodeBase {
|
|
1669
3039
|
readonly content: readonly (TableRowAstNode | GlueAstNode)[];
|
|
1670
3040
|
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
@@ -1747,6 +3117,13 @@ declare class TextViewData {
|
|
|
1747
3117
|
readonly showWhitespace: boolean;
|
|
1748
3118
|
readonly leftWordBoundary: boolean;
|
|
1749
3119
|
readonly rightWordBoundary: boolean;
|
|
3120
|
+
/**
|
|
3121
|
+
* Number of leading source characters to keep out of the rendered
|
|
3122
|
+
* text (but not out of the source): the `:running:` marker plus its
|
|
3123
|
+
* mandatory leading separator, once
|
|
3124
|
+
* {@link isRunnerMarkerText} has matched this node. Zero otherwise.
|
|
3125
|
+
*/
|
|
3126
|
+
readonly hiddenPrefixLength: number;
|
|
1750
3127
|
readonly kind = "text";
|
|
1751
3128
|
/**
|
|
1752
3129
|
* Whether non-obvious whitespace in this text is revealed (block is active).
|
|
@@ -1755,7 +3132,14 @@ declare class TextViewData {
|
|
|
1755
3132
|
* emphasis); a single space touching such a sibling is obvious and stays
|
|
1756
3133
|
* undecorated, just like a space between two words within this leaf.
|
|
1757
3134
|
*/
|
|
1758
|
-
constructor(ast: TextAstNode, showWhitespace: boolean, leftWordBoundary?: boolean, rightWordBoundary?: boolean
|
|
3135
|
+
constructor(ast: TextAstNode, showWhitespace: boolean, leftWordBoundary?: boolean, rightWordBoundary?: boolean,
|
|
3136
|
+
/**
|
|
3137
|
+
* Number of leading source characters to keep out of the rendered
|
|
3138
|
+
* text (but not out of the source): the `:running:` marker plus its
|
|
3139
|
+
* mandatory leading separator, once
|
|
3140
|
+
* {@link isRunnerMarkerText} has matched this node. Zero otherwise.
|
|
3141
|
+
*/
|
|
3142
|
+
hiddenPrefixLength?: number);
|
|
1759
3143
|
}
|
|
1760
3144
|
|
|
1761
3145
|
export declare class ThematicBreakAstNode extends BlockAstNodeBase {
|
|
@@ -1799,6 +3183,98 @@ export declare class Token {
|
|
|
1799
3183
|
className: string | undefined);
|
|
1800
3184
|
}
|
|
1801
3185
|
|
|
3186
|
+
declare interface UnchangedItem {
|
|
3187
|
+
readonly kind: 'unchanged';
|
|
3188
|
+
/** The modified-side node (identical in content to the original). */
|
|
3189
|
+
readonly node: AstNode;
|
|
3190
|
+
readonly modifiedStart: number;
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
/**
|
|
3194
|
+
* A block whose token type the parser does not understand (a setext heading or
|
|
3195
|
+
* any future/extension construct). Rather than dropping the
|
|
3196
|
+
* span — which would demote its text to invisible glue — the parser captures the
|
|
3197
|
+
* whole source range verbatim as a single {@link MarkerAstNode} of kind
|
|
3198
|
+
* `content` and records the originating micromark {@link tokenType}, so the view
|
|
3199
|
+
* can render it as raw, editable text with an "unhandled" affordance. Offsets
|
|
3200
|
+
* stay sound: `content` tiles the block's full source span exactly.
|
|
3201
|
+
*/
|
|
3202
|
+
declare class UnhandledBlockAstNode extends BlockAstNodeBase {
|
|
3203
|
+
readonly tokenType: string;
|
|
3204
|
+
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
3205
|
+
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
3206
|
+
readonly kind = "unhandledBlock";
|
|
3207
|
+
constructor(tokenType: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
|
|
3208
|
+
get children(): readonly AstNode[];
|
|
3209
|
+
get code(): MarkerAstNode | undefined;
|
|
3210
|
+
/**
|
|
3211
|
+
* Lossless slices when this raw HTML block starts one comment after optional
|
|
3212
|
+
* whitespace. An open comment consumes the remaining source as its body. A
|
|
3213
|
+
* complete comment permits only trailing whitespace after its closer.
|
|
3214
|
+
*/
|
|
3215
|
+
get htmlComment(): HtmlCommentSource | undefined;
|
|
3216
|
+
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
3217
|
+
withLeadingTrivia(trivia: GlueAstNode | undefined): UnhandledBlockAstNode;
|
|
3218
|
+
protected _localEquals(o: this): boolean;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
/**
|
|
3222
|
+
* View-data for an {@link UnhandledBlockAstNode}. The source remains verbatim
|
|
3223
|
+
* in both states. Complete HTML comments use {@link showMarkup} to switch
|
|
3224
|
+
* between their quiet reading treatment and editable source presentation;
|
|
3225
|
+
* other unhandled blocks ignore the flag and keep their warning treatment.
|
|
3226
|
+
*/
|
|
3227
|
+
declare class UnhandledBlockViewData {
|
|
3228
|
+
readonly ast: UnhandledBlockAstNode;
|
|
3229
|
+
readonly showMarkup: boolean;
|
|
3230
|
+
readonly content: readonly AnyViewData[];
|
|
3231
|
+
readonly kind = "unhandledBlock";
|
|
3232
|
+
constructor(ast: UnhandledBlockAstNode, showMarkup: boolean, content: readonly AnyViewData[]);
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
/**
|
|
3236
|
+
* A standalone HTML `<video>` whose source can be rendered without executing
|
|
3237
|
+
* arbitrary raw HTML. Its exact HTML remains in `content`, so activating the
|
|
3238
|
+
* block restores the original source for editing.
|
|
3239
|
+
*/
|
|
3240
|
+
export declare class VideoAstNode extends BlockAstNodeBase {
|
|
3241
|
+
readonly attributes: VideoAttributes;
|
|
3242
|
+
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
3243
|
+
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
3244
|
+
readonly kind = "video";
|
|
3245
|
+
constructor(attributes: VideoAttributes, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
|
|
3246
|
+
get children(): readonly AstNode[];
|
|
3247
|
+
get source(): MarkerAstNode | undefined;
|
|
3248
|
+
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
3249
|
+
withLeadingTrivia(trivia: GlueAstNode | undefined): VideoAstNode;
|
|
3250
|
+
protected _localEquals(o: this): boolean;
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
/** The supported semantic attributes of a standalone HTML `<video>` block. */
|
|
3254
|
+
export declare interface VideoAttributes {
|
|
3255
|
+
readonly src: string;
|
|
3256
|
+
readonly title?: string;
|
|
3257
|
+
readonly autoplay: boolean;
|
|
3258
|
+
readonly controls: boolean;
|
|
3259
|
+
readonly loop: boolean;
|
|
3260
|
+
readonly muted: boolean;
|
|
3261
|
+
}
|
|
3262
|
+
|
|
3263
|
+
declare class VideoViewData {
|
|
3264
|
+
readonly ast: VideoAstNode;
|
|
3265
|
+
/** Active: reveal the exact HTML source; inactive: render the native video. */
|
|
3266
|
+
readonly showMarkup: boolean;
|
|
3267
|
+
readonly content: readonly AnyViewData[];
|
|
3268
|
+
/** Nested diff state; top-level video diff state lives on the document child. */
|
|
3269
|
+
readonly diffKind?: "added" | "modified" | undefined;
|
|
3270
|
+
readonly kind = "video";
|
|
3271
|
+
constructor(ast: VideoAstNode,
|
|
3272
|
+
/** Active: reveal the exact HTML source; inactive: render the native video. */
|
|
3273
|
+
showMarkup: boolean, content: readonly AnyViewData[],
|
|
3274
|
+
/** Nested diff state; top-level video diff state lives on the document child. */
|
|
3275
|
+
diffKind?: "added" | "modified" | undefined);
|
|
3276
|
+
}
|
|
3277
|
+
|
|
1802
3278
|
/**
|
|
1803
3279
|
* Immutable view of an AST node. Pairs `ast` with its rendered `dom` and a
|
|
1804
3280
|
* mirror of `ast.children` as ViewNode children. Source offsets are NEVER
|
|
@@ -1863,10 +3339,12 @@ export declare class ViewNode extends Disposable {
|
|
|
1863
3339
|
/**
|
|
1864
3340
|
* Map a DOM hit that lands on THIS node's own representation into a source
|
|
1865
3341
|
* range in this node's local space `[0, ast.length)`. Polymorphic: a text
|
|
1866
|
-
* leaf maps the caret offset 1:1
|
|
1867
|
-
* an image, a hidden marker)
|
|
1868
|
-
*
|
|
1869
|
-
*
|
|
3342
|
+
* leaf maps the caret offset 1:1. For an element hit — an element-only node
|
|
3343
|
+
* (KaTeX math, `<hr>`, an image, a hidden marker) or a wrapper/container
|
|
3344
|
+
* element — the platform reports a child-index offset, not a text caret, so
|
|
3345
|
+
* there is no internal mapping to honour: it snaps to the node's nearer
|
|
3346
|
+
* edge, `offset 0` (the "before" side) → start, any `offset >= 1` (the
|
|
3347
|
+
* "after" side) → end. Subclasses may override for finer control.
|
|
1870
3348
|
*/
|
|
1871
3349
|
getLocalSourceRange(pos: DomPosition): OffsetRange;
|
|
1872
3350
|
/**
|
|
@@ -1888,6 +3366,24 @@ export declare class ViewNode extends Disposable {
|
|
|
1888
3366
|
forEachTextLeaf(nodeOffset: number, visitor: (leaf: ViewNode, leafOffset: number) => void): void;
|
|
1889
3367
|
}
|
|
1890
3368
|
|
|
3369
|
+
/**
|
|
3370
|
+
* A visual cursor line that has no representation in the source text.
|
|
3371
|
+
*
|
|
3372
|
+
* The two source offsets are the positions immediately before and after the
|
|
3373
|
+
* virtual line. The object itself is the stable identity of the line.
|
|
3374
|
+
*/
|
|
3375
|
+
export declare class VirtualCursorLine {
|
|
3376
|
+
readonly sourceOffsetBefore: SourceOffset;
|
|
3377
|
+
readonly sourceOffsetAfter: SourceOffset;
|
|
3378
|
+
constructor(sourceOffsetBefore: SourceOffset, sourceOffsetAfter: SourceOffset);
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
/** A measured source-less line inserted directly after a source block. */
|
|
3382
|
+
declare interface VirtualLineMeasurement {
|
|
3383
|
+
readonly afterBlock: BlockAstNode;
|
|
3384
|
+
readonly line: VisualLine;
|
|
3385
|
+
}
|
|
3386
|
+
|
|
1891
3387
|
export declare type VisualCursorCommand = (ctx: VisualCursorCommandContext) => CursorMoveResult;
|
|
1892
3388
|
|
|
1893
3389
|
export declare interface VisualCursorCommandContext extends CursorCommandContext {
|
|
@@ -1905,12 +3401,15 @@ export declare function visualizeAst(root: AstNode, source: string): AstVisualiz
|
|
|
1905
3401
|
export declare class VisualLine {
|
|
1906
3402
|
readonly rect: Rect2D;
|
|
1907
3403
|
readonly runs: readonly VisualRun[];
|
|
1908
|
-
|
|
3404
|
+
readonly virtualCursorLine?: VirtualCursorLine | undefined;
|
|
3405
|
+
static virtual(cursorLine: VirtualCursorLine, rect: Rect2D): VisualLine;
|
|
3406
|
+
constructor(rect: Rect2D, runs: readonly VisualRun[], virtualCursorLine?: VirtualCursorLine | undefined);
|
|
1909
3407
|
containsOffset(offset: SourceOffset): boolean;
|
|
1910
3408
|
/**
|
|
1911
3409
|
* How `offset` relates to this line's runs:
|
|
1912
3410
|
* - `'covers'`: a run starts at or strictly contains the offset
|
|
1913
|
-
* (`start <= offset < endExclusive`)
|
|
3411
|
+
* (`start <= offset < endExclusive`), or a zero-length visual-line
|
|
3412
|
+
* anchor sits at the offset — the caret belongs on this line.
|
|
1914
3413
|
* - `'end'`: the offset is only some run's trailing boundary
|
|
1915
3414
|
* (`offset === endExclusive`) with no run covering it — a line-break
|
|
1916
3415
|
* boundary the caret should leave for the next line.
|
|
@@ -1923,23 +3422,42 @@ export declare class VisualLine {
|
|
|
1923
3422
|
*/
|
|
1924
3423
|
sourceDistanceTo(offset: SourceOffset): number;
|
|
1925
3424
|
/**
|
|
1926
|
-
* x of the caret position before `offset` on this line.
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
3425
|
+
* x of the caret position before `offset` on this line.
|
|
3426
|
+
*
|
|
3427
|
+
* The runs tile the source but are stored in paint order, not sorted by
|
|
3428
|
+
* source offset (hidden-marker runs are appended last). So this scans all
|
|
3429
|
+
* runs rather than assuming any ordering:
|
|
3430
|
+
*
|
|
3431
|
+
* - A zero-source visual anchor owns its exact offset, so a marker-only line
|
|
3432
|
+
* wins over the preceding line's inclusive end boundary.
|
|
3433
|
+
* - Otherwise a run starting at `offset` owns that seam. This keeps an
|
|
3434
|
+
* out-of-flow prefix from placing the caret at its trailing edge when the
|
|
3435
|
+
* following body starts at a visually separate x.
|
|
3436
|
+
* - Otherwise, if some run *covers* `offset`, its own geometry places the
|
|
3437
|
+
* caret (exact glyph boundary for text runs). In the active,
|
|
3438
|
+
* markers-visible form every interior offset is covered, so this branch
|
|
3439
|
+
* keeps distinct offsets distinct.
|
|
3440
|
+
* - Otherwise `offset` sits in a gap — a hidden inline marker such as the
|
|
3441
|
+
* `**` of `**bold**`, or before/after the painted text. It snaps to the
|
|
3442
|
+
* seam between the source-nearest runs on either side: the right edge of
|
|
3443
|
+
* the closest run ending at/before `offset`, else the left edge of the
|
|
3444
|
+
* closest run starting at/after it. A hidden marker collapses to zero
|
|
3445
|
+
* width, so both edges coincide at the seam.
|
|
1930
3446
|
*/
|
|
1931
3447
|
xAtOffset(offset: SourceOffset): number;
|
|
1932
3448
|
/**
|
|
1933
3449
|
* Snap `x` to the nearest offset on this line. If `x` falls inside a
|
|
1934
|
-
* run, the offset
|
|
1935
|
-
*
|
|
3450
|
+
* run, the run resolves the offset (exact glyph boundary for text runs,
|
|
3451
|
+
* nearer edge for source-less runs); otherwise it snaps to the closer
|
|
3452
|
+
* edge of the nearest run.
|
|
1936
3453
|
*/
|
|
1937
3454
|
offsetAtX(x: number): SourceOffset;
|
|
1938
3455
|
}
|
|
1939
3456
|
|
|
1940
3457
|
/**
|
|
1941
3458
|
* Geometry of the rendered document, as a map from source offsets to 2D
|
|
1942
|
-
* positions and back.
|
|
3459
|
+
* positions and back. All geometry is expressed in the editor overlay's local
|
|
3460
|
+
* CSS-pixel coordinate space.
|
|
1943
3461
|
*
|
|
1944
3462
|
* Structure (top to bottom):
|
|
1945
3463
|
*
|
|
@@ -1974,7 +3492,9 @@ export declare class VisualLineMap {
|
|
|
1974
3492
|
static measure(blockViews: readonly {
|
|
1975
3493
|
readonly absoluteStart: number;
|
|
1976
3494
|
readonly viewNode: ViewNode;
|
|
1977
|
-
}[]): VisualLineMap;
|
|
3495
|
+
}[], coordinateSpace: EditorCoordinateSpace, transform?: EditorCoordinateTransform): VisualLineMap;
|
|
3496
|
+
/** Lines backed by source ranges, excluding source-less cursor lines. */
|
|
3497
|
+
readonly sourceLines: readonly VisualLine[];
|
|
1978
3498
|
constructor(lines: readonly VisualLine[]);
|
|
1979
3499
|
get lineCount(): number;
|
|
1980
3500
|
get isEmpty(): boolean;
|
|
@@ -1999,6 +3519,12 @@ export declare class VisualLineMap {
|
|
|
1999
3519
|
* {@link lineIndexOfOffset}. Returns `0` when the map is empty.
|
|
2000
3520
|
*/
|
|
2001
3521
|
xAtOffset(offset: SourceOffset): number;
|
|
3522
|
+
/**
|
|
3523
|
+
* Line occupied by a source or virtual cursor position. A virtual position
|
|
3524
|
+
* returns `undefined` until its corresponding DOM line has been measured.
|
|
3525
|
+
*/
|
|
3526
|
+
lineIndexOfPosition(position: CursorPosition): number | undefined;
|
|
3527
|
+
xAtPosition(position: CursorPosition): number;
|
|
2002
3528
|
/**
|
|
2003
3529
|
* Line whose vertical band contains `y`, clamped to the first/last
|
|
2004
3530
|
* line when `y` is outside the document.
|
|
@@ -2012,6 +3538,9 @@ export declare class VisualLineMap {
|
|
|
2012
3538
|
offsetAtPoint(point: Point2D): SourceOffset;
|
|
2013
3539
|
/** Snap `x` to the nearest offset on a specific line. */
|
|
2014
3540
|
offsetInLineAtX(lineIndex: number, x: number): SourceOffset;
|
|
3541
|
+
positionInLineAtX(lineIndex: number, x: number): CursorPosition;
|
|
3542
|
+
lineStartOffset(lineIndex: number): SourceOffset | undefined;
|
|
3543
|
+
lineEndOffset(lineIndex: number): SourceOffset | undefined;
|
|
2015
3544
|
}
|
|
2016
3545
|
|
|
2017
3546
|
/**
|
|
@@ -2020,14 +3549,22 @@ export declare class VisualLineMap {
|
|
|
2020
3549
|
* When constructed with a {@link VisualRunSource}, `xAtOffset` returns the
|
|
2021
3550
|
* pixel-exact x of the caret before character `offset` by measuring the
|
|
2022
3551
|
* prefix `[textNodeStart, textNodeStart + (offset - sourceStart))` with a
|
|
2023
|
-
* DOM `Range`.
|
|
2024
|
-
*
|
|
3552
|
+
* DOM `Range`.
|
|
3553
|
+
*
|
|
3554
|
+
* A source-less run has no per-offset geometry: it either represents an
|
|
3555
|
+
* element-only block (KaTeX math, a mermaid/custom diagram, an image, an
|
|
3556
|
+
* inactive `<hr>`) whose box does not correspond to source offsets, or a
|
|
3557
|
+
* hand-built run in a test. Either way it maps between offsets and x by
|
|
3558
|
+
* snapping to the nearer edge of {@link rect} rather than fabricating
|
|
3559
|
+
* interior positions.
|
|
2025
3560
|
*/
|
|
2026
3561
|
export declare class VisualRun {
|
|
2027
3562
|
readonly sourceRange: OffsetRange;
|
|
2028
3563
|
readonly rect: Rect2D;
|
|
2029
3564
|
readonly source?: VisualRunSource | undefined;
|
|
2030
|
-
|
|
3565
|
+
readonly isVisualLineAnchor: boolean;
|
|
3566
|
+
static visualLineAnchor(sourceOffset: SourceOffset, rect: Rect2D): VisualRun;
|
|
3567
|
+
constructor(sourceRange: OffsetRange, rect: Rect2D, source?: VisualRunSource | undefined, isVisualLineAnchor?: boolean);
|
|
2031
3568
|
get sourceStart(): SourceOffset;
|
|
2032
3569
|
get sourceEndExclusive(): SourceOffset;
|
|
2033
3570
|
get sourceLength(): number;
|
|
@@ -2039,19 +3576,32 @@ export declare class VisualRun {
|
|
|
2039
3576
|
|
|
2040
3577
|
/**
|
|
2041
3578
|
* The DOM source of a {@link VisualRun}. When set, `xAtOffset` and
|
|
2042
|
-
* `offsetAtX` measure exact glyph positions via `Range.getBoundingClientRect
|
|
2043
|
-
*
|
|
2044
|
-
*
|
|
2045
|
-
*
|
|
2046
|
-
* wrong character.
|
|
3579
|
+
* `offsetAtX` measure exact glyph positions via `Range.getBoundingClientRect`.
|
|
3580
|
+
* This matters for proportional fonts where character widths differ a lot
|
|
3581
|
+
* (e.g. `m` vs `i`): a caret placed by anything coarser than real glyph
|
|
3582
|
+
* measurement lands several pixels inside the wrong character.
|
|
2047
3583
|
*
|
|
2048
|
-
*
|
|
2049
|
-
*
|
|
3584
|
+
* A run without a source has no per-offset geometry, so it maps between
|
|
3585
|
+
* offsets and x by snapping to the nearer run edge. Real text runs always
|
|
3586
|
+
* carry a source; source-less runs are element-only blocks (see
|
|
3587
|
+
* {@link _appendElementBlockRun}) and hand-built runs in tests.
|
|
2050
3588
|
*/
|
|
2051
3589
|
declare interface VisualRunSource {
|
|
2052
3590
|
readonly textNode: Text;
|
|
2053
3591
|
/** Offset within `textNode.data` corresponding to `sourceRange.start`. */
|
|
2054
3592
|
readonly textNodeStart: number;
|
|
3593
|
+
readonly coordinateSpace: EditorCoordinateSpace;
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3596
|
+
export declare const vscodeHostKeyboardProfile: KeyboardProfile;
|
|
3597
|
+
|
|
3598
|
+
export declare const vscodeKeyboardProfile: KeyboardProfile;
|
|
3599
|
+
|
|
3600
|
+
export declare const vscodeLocalKeyboardProfile: KeyboardProfile;
|
|
3601
|
+
|
|
3602
|
+
export declare interface WordNavigationConfig {
|
|
3603
|
+
readonly wordSeparators: string;
|
|
3604
|
+
readonly wordSegmenterLocales: readonly string[];
|
|
2055
3605
|
}
|
|
2056
3606
|
|
|
2057
3607
|
export { }
|