@vscode/markdown-editor 0.0.2-12 → 0.0.2-121

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.
Files changed (77) hide show
  1. package/README.md +571 -0
  2. package/dist/commands.d.ts +67 -0
  3. package/dist/commands.js +185 -0
  4. package/dist/commands.js.map +1 -0
  5. package/dist/config-BGeaJqWk.js +286 -0
  6. package/dist/config-BGeaJqWk.js.map +1 -0
  7. package/dist/config.d.ts +10 -0
  8. package/dist/config.js +6 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/index.d.ts +1964 -155
  11. package/dist/index.js +8134 -2188
  12. package/dist/index.js.map +1 -1
  13. package/dist/markdown-editor.css +1 -0
  14. package/dist/stringEdit-CVDbCUBY.js +215 -0
  15. package/dist/stringEdit-CVDbCUBY.js.map +1 -0
  16. package/dist/web-editors.d.ts +301 -0
  17. package/dist/web-editors.js +7368 -0
  18. package/dist/web-editors.js.map +1 -0
  19. package/package.json +66 -17
  20. package/src/contrib/comments/commentInput.css +89 -0
  21. package/src/contrib/comments/commentWidget.css +60 -0
  22. package/src/contrib/find/find.css +347 -0
  23. package/src/contrib/rename/rename.css +73 -0
  24. package/src/contrib/suggest/suggest.css +109 -0
  25. package/src/view/editor.css +1608 -66
  26. package/src/view/themes/default.css +21 -4
  27. package/src/view/themes/github.css +25 -13
  28. package/src/view/themes/vscode-default.css +407 -0
  29. package/src/view/themes/{vscode.css → vscode-github.css} +134 -62
  30. package/dist/_observables/assert.d.ts +0 -2
  31. package/dist/_observables/deps.d.ts +0 -28
  32. package/dist/_observables/disposables.d.ts +0 -19
  33. package/dist/_observables/equals.d.ts +0 -32
  34. package/dist/_observables/index.d.ts +0 -2
  35. package/dist/_observables/observableInternal/base.d.ts +0 -172
  36. package/dist/_observables/observableInternal/changeTracker.d.ts +0 -44
  37. package/dist/_observables/observableInternal/commonFacade/cancellation.d.ts +0 -24
  38. package/dist/_observables/observableInternal/commonFacade/deps.d.ts +0 -24
  39. package/dist/_observables/observableInternal/debugLocation.d.ts +0 -21
  40. package/dist/_observables/observableInternal/debugName.d.ts +0 -33
  41. package/dist/_observables/observableInternal/experimental/deferUnobserve.d.ts +0 -16
  42. package/dist/_observables/observableInternal/experimental/reducer.d.ts +0 -37
  43. package/dist/_observables/observableInternal/experimental/utils.d.ts +0 -15
  44. package/dist/_observables/observableInternal/index.d.ts +0 -25
  45. package/dist/_observables/observableInternal/logging/consoleObservableLogger.d.ts +0 -40
  46. package/dist/_observables/observableInternal/logging/debugGetDependencyGraph.d.ts +0 -4
  47. package/dist/_observables/observableInternal/logging/debugger/debuggerRpc.d.ts +0 -4
  48. package/dist/_observables/observableInternal/logging/debugger/devToolsLogger.d.ts +0 -43
  49. package/dist/_observables/observableInternal/logging/debugger/rpc.d.ts +0 -41
  50. package/dist/_observables/observableInternal/logging/debugger/utils.d.ts +0 -13
  51. package/dist/_observables/observableInternal/logging/logging.d.ts +0 -30
  52. package/dist/_observables/observableInternal/map.d.ts +0 -18
  53. package/dist/_observables/observableInternal/observables/baseObservable.d.ts +0 -58
  54. package/dist/_observables/observableInternal/observables/constObservable.d.ts +0 -5
  55. package/dist/_observables/observableInternal/observables/derived.d.ts +0 -46
  56. package/dist/_observables/observableInternal/observables/derivedImpl.d.ts +0 -83
  57. package/dist/_observables/observableInternal/observables/lazyObservableValue.d.ts +0 -27
  58. package/dist/_observables/observableInternal/observables/observableFromEvent.d.ts +0 -37
  59. package/dist/_observables/observableInternal/observables/observableSignal.d.ts +0 -11
  60. package/dist/_observables/observableInternal/observables/observableSignalFromEvent.d.ts +0 -5
  61. package/dist/_observables/observableInternal/observables/observableValue.d.ts +0 -37
  62. package/dist/_observables/observableInternal/observables/observableValueOpts.d.ts +0 -8
  63. package/dist/_observables/observableInternal/reactions/autorun.d.ts +0 -56
  64. package/dist/_observables/observableInternal/reactions/autorunImpl.d.ts +0 -53
  65. package/dist/_observables/observableInternal/set.d.ts +0 -17
  66. package/dist/_observables/observableInternal/transaction.d.ts +0 -27
  67. package/dist/_observables/observableInternal/utils/promise.d.ts +0 -75
  68. package/dist/_observables/observableInternal/utils/runOnChange.d.ts +0 -7
  69. package/dist/_observables/observableInternal/utils/utils.d.ts +0 -43
  70. package/dist/_observables/observableInternal/utils/utilsCancellation.d.ts +0 -10
  71. package/dist/_observables/observableInternal/utils/valueWithChangeEvent.d.ts +0 -10
  72. package/dist/_observables/utils.d.ts +0 -15
  73. package/dist/observables.d.ts +0 -4
  74. package/dist/observables.js +0 -439
  75. package/dist/observables.js.map +0 -1
  76. package/dist/runOnChange-C00UIwqQ.js +0 -1538
  77. package/dist/runOnChange-C00UIwqQ.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,15 +1,33 @@
1
- import { Disposable } from './_observables/index';
2
- import { IDisposable } from './_observables/index';
3
- import { IObservable } from './_observables/index';
4
- import { IObservableWithChange } from './_observables/index';
5
- import { ISettableObservable } from './_observables/index';
6
- import { ITransaction } from './_observables/index';
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 { IReader } from '@vscode/observables';
6
+ import { ISettableObservable } from '@vscode/observables';
7
+ import { ITransaction } from '@vscode/observables';
7
8
  import { MonarchTokenizer } from 'monaco-editor/esm/vs/editor/standalone/common/monarch/monarchLexer.js';
8
9
 
10
+ declare interface AddedItem {
11
+ readonly kind: 'added';
12
+ readonly node: AstNode;
13
+ readonly modifiedStart: number;
14
+ readonly insertedLocal: readonly AnnotatedRange[];
15
+ }
16
+
17
+ /**
18
+ * A word/character-level highlight inside a single block, in that block's
19
+ * *local* coordinate space (`0` = block start). `inserted` ranges live on a
20
+ * modified/added block, `deleted` ranges on an original/removed block.
21
+ */
22
+ declare interface AnnotatedRange {
23
+ readonly range: OffsetRange;
24
+ readonly kind: 'inserted' | 'deleted';
25
+ }
26
+
9
27
  /** 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;
28
+ export declare type AnyAstNode = TextAstNode | MarkerAstNode | GlueAstNode | ThematicBreakAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode | HeadingAstNode | ParagraphAstNode | EmptyBlockAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | VideoAstNode | BlockQuoteAstNode | ListAstNode | ListItemAstNode | TableAstNode | TableRowAstNode | TableCellAstNode | DocumentAstNode | UnhandledBlockAstNode;
11
29
 
12
- declare type AnyViewData = DocumentViewData | BlockViewData | InlineViewData | ListItemViewData | TableRowViewData | TableCellViewData | MarkerViewData | GlueViewData;
30
+ declare type AnyViewData = DocumentViewData | BlockViewData | InlineViewData | ListItemViewData | TableRowViewData | TableCellViewData | MarkerViewData | GlueViewData | DiffHunkViewData | DiffDecorationViewData;
13
31
 
14
32
  export declare abstract class AstNode {
15
33
  abstract readonly kind: string;
@@ -55,23 +73,31 @@ declare interface AstVisualizationNode {
55
73
  }
56
74
 
57
75
  /**
58
- * Strategy for hosts that never deliver native clipboard events to the editor
59
- * — most importantly VS Code webviews, whose preload calls `preventDefault()`
60
- * on the Ctrl/Cmd+C/X/V keydowns, so no `copy`/`cut`/`paste` event is ever
61
- * dispatched. Here the keystrokes are the only signal, so this strategy
62
- * listens for them directly and drives the async {@link Clipboard} API
63
- * (`navigator.clipboard`), which webviews are granted.
76
+ * Strategy for hosts that intercept native clipboard shortcuts, notably
77
+ * VS Code webviews. Their preload prevents the default Ctrl/Cmd+C/X/V handling
78
+ * and forwards the keydowns to the host. This strategy handles the keystrokes
79
+ * directly using the async {@link Clipboard} API (`navigator.clipboard`),
80
+ * which webviews are granted.
64
81
  *
65
82
  * Cut deletes synchronously once the text is captured; the clipboard write is
66
83
  * fire-and-forget. Paste must wait for the async read before inserting.
84
+ * Handled keydowns must not reach the host, which may replay native clipboard
85
+ * commands even when the browser's default has been prevented.
86
+ *
87
+ * Hosts can supply a paste callback to read images or other clipboard formats.
88
+ * It receives the original context and whether Shift requested plain text.
89
+ * The callback owns asynchronous errors and stale-selection checks. It does
90
+ * not override copy/cut or clipboard handling in nested native inputs.
67
91
  */
68
92
  export declare class AsyncClipboardStrategy implements IClipboardStrategy {
69
93
  private readonly _clipboard;
70
- constructor(_clipboard?: Clipboard);
94
+ private readonly _paste?;
95
+ constructor(_clipboard?: Clipboard, _paste?: ((context: IClipboardContext, plainText: boolean) => Promise<void>) | undefined);
96
+ writeText(text: string): Promise<void>;
71
97
  connect(context: IClipboardContext): IDisposable;
72
98
  }
73
99
 
74
- export declare type BlockAstNode = HeadingAstNode | ParagraphAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode;
100
+ export declare type BlockAstNode = HeadingAstNode | ParagraphAstNode | EmptyBlockAstNode | FrontMatterAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | VideoAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode | UnhandledBlockAstNode;
75
101
 
76
102
  /**
77
103
  * A block-level node. Every block may carry a {@link leadingTrivia} glue — the
@@ -92,7 +118,7 @@ declare abstract class BlockAstNodeBase extends AstNode {
92
118
  /**
93
119
  * One block's place in the rendered document.
94
120
  *
95
- * `height` is in CSS pixels. It is either a real DOM measurement
121
+ * Geometry is in editor-local CSS pixels. `height` is either a real DOM measurement
96
122
  * (`isMeasured: true`) or an estimate produced when the block is not
97
123
  * currently mounted (`isMeasured: false`). Estimates exist so virtual
98
124
  * rendering can size the scroll container without mounting every block.
@@ -107,6 +133,13 @@ export declare interface BlockMeasurement {
107
133
  readonly block: BlockAstNode;
108
134
  readonly absoluteStart: number;
109
135
  readonly height: number;
136
+ /** Local border box when mounted and measured. */
137
+ readonly rect: Rect2D | undefined;
138
+ /** Local horizontal padding-box clip when this block scrolls horizontally. */
139
+ readonly viewportClip: {
140
+ readonly left: number;
141
+ readonly right: number;
142
+ } | undefined;
110
143
  readonly isMeasured: boolean;
111
144
  readonly visualLineMap: VisualLineMap | undefined;
112
145
  readonly viewNode: ViewNode | undefined;
@@ -126,11 +159,22 @@ export declare class BlockQuoteAstNode extends BlockAstNodeBase {
126
159
  declare class BlockQuoteViewData {
127
160
  readonly ast: BlockQuoteAstNode;
128
161
  readonly content: readonly AnyViewData[];
162
+ /** False while a pending paragraph replaces the final marker-only line. */
163
+ readonly showFinalMarkerOnlyLine: boolean;
129
164
  readonly kind = "blockQuote";
130
- constructor(ast: BlockQuoteAstNode, content: readonly AnyViewData[]);
165
+ constructor(ast: BlockQuoteAstNode, content: readonly AnyViewData[],
166
+ /** False while a pending paragraph replaces the final marker-only line. */
167
+ showFinalMarkerOnlyLine: boolean);
131
168
  }
132
169
 
133
- declare type BlockViewData = HeadingViewData | ParagraphViewData | CodeBlockViewData | MathBlockViewData | ThematicBreakViewData | BlockQuoteViewData | ListViewData | TableViewData;
170
+ /**
171
+ * All blocks whose source range intersects `[start, endExclusive]`. A
172
+ * collapsed range (start === endExclusive) matches the block containing
173
+ * that offset (with the same boundary rule as {@link findBlockAtOffset}).
174
+ */
175
+ export declare function blocksIntersecting(doc: DocumentAstNode, start: SourceOffset, endExclusive: SourceOffset): BlockAstNode[];
176
+
177
+ declare type BlockViewData = HeadingViewData | ParagraphViewData | EmptyBlockViewData | FrontMatterViewData | CodeBlockViewData | MathBlockViewData | ThematicBreakViewData | VideoViewData | BlockQuoteViewData | ListViewData | TableViewData | UnhandledBlockViewData;
134
178
 
135
179
  /**
136
180
  * Base view node for everything the editor renders, generic over the
@@ -151,6 +195,17 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
151
195
  constructor(data: T, dom: globalThis.Node, children: readonly ViewNode[]);
152
196
  get block(): BlockAstNode;
153
197
  get element(): HTMLElement;
198
+ /**
199
+ * The horizontal scroll viewport for selection/caret clipping
200
+ * ({@link blockViewportClip}). For most blocks the scroller *is*
201
+ * {@link element} — a code / math / unhandled block's `element` is the very
202
+ * `overflow-x: auto` box that scrolls. A table is the exception: its
203
+ * `element` stays the inner `<table>` (so the active/markers classes and
204
+ * `.md-table` theme styling are unaffected), but the box that actually
205
+ * scrolls is the wrapping `.md-table-wrapper`, so {@link TableViewNode}
206
+ * overrides this to return that wrapper.
207
+ */
208
+ get scrollElement(): HTMLElement;
154
209
  /**
155
210
  * Whether this already-built node can stand in for `data` unchanged. The
156
211
  * builder preserves view-data identity for any subtree whose ast and
@@ -158,7 +213,7 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
158
213
  * single identity check captures "nothing in my subtree changed" — and its
159
214
  * whole subtree, and any session it owns, are kept as-is.
160
215
  */
161
- canReuse(data: AnyViewData): boolean;
216
+ canReuse(data: AnyViewData, _options: BlockViewOptions | undefined): boolean;
162
217
  /**
163
218
  * Called by the view after this block is mounted and measured, with the
164
219
  * block's rendered height in px. The default is a no-op; subclasses whose
@@ -169,14 +224,25 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
169
224
  }
170
225
 
171
226
  export declare interface BlockViewOptions {
227
+ /** Writes explicit copy actions through the host clipboard; defaults to the browser API. */
228
+ readonly writeClipboardText?: (text: string) => Promise<void>;
229
+ readonly preserveSourceWhitespace?: boolean;
172
230
  readonly renderCustomCodeBlock?: (language: string, content: string) => HTMLElement | undefined;
173
231
  readonly onToggleCheckbox?: (item: ListItemAstNode, newChecked: boolean) => void;
232
+ /** Temporarily yields the host editor's text input while a nested control owns focus. */
233
+ readonly suspendEditContextWhileFocused?: (element: HTMLElement) => IDisposable;
234
+ /**
235
+ * Supplies live, declarative metadata for recognized links. The editor owns
236
+ * the markup and styling; providers own lookup, caching, and updates.
237
+ */
238
+ readonly linkPresentationProvider?: ILinkPresentationProvider;
174
239
  /**
175
240
  * Opens a link's URL. Called when the user activates a link: a plain click
176
241
  * while the link's block is inactive (rendered), or a Ctrl/Cmd+click while it
177
- * is active (source shown). Defaults to `window.open(url, '_blank')`.
242
+ * is active (source shown). Return `false` to use the anchor's native
243
+ * navigation behavior.
178
244
  */
179
- readonly onOpenLink?: (url: string, event: MouseEvent) => void;
245
+ readonly onOpenLink?: (url: string, event: MouseEvent) => false | void;
180
246
  /**
181
247
  * Colours fenced code blocks. When set, a code block's content is rendered
182
248
  * as a sequence of token spans instead of one plain text node. This is the
@@ -196,16 +262,47 @@ export declare interface BlockViewOptions {
196
262
  * `katexEditableIdentifiers.ts`).
197
263
  */
198
264
  readonly renderMath?: (request: MathRenderRequest) => MathRendering | undefined;
265
+ /**
266
+ * Pluggable factory for an in-place, interactive editor that replaces the
267
+ * *rendered* (inactive) form of a fenced code block — see
268
+ * {@link IEmbeddedCodeEditor}. When it returns an editor for the block's
269
+ * language, that editor's element is mounted instead of the highlighted
270
+ * code, and content flows both ways as string edits. Returning `undefined`
271
+ * falls back to the default rendering. EXPERIMENTAL.
272
+ */
273
+ readonly embeddedCodeEditorFactory?: IEmbeddedCodeEditorFactory;
274
+ /** Current read-only state forwarded to embedded code editors. */
275
+ readonly embeddedCodeEditorReadOnly?: boolean;
276
+ /** Identity used to invalidate previously created embedded editors. */
277
+ readonly embeddedCodeEditorFactoryVersion?: unknown;
278
+ /**
279
+ * Called when an {@link IEmbeddedCodeEditor} edits its content. `contentEdit`
280
+ * is in the block's *content* coordinates; the host translates it to a
281
+ * document edit (via {@link CodeBlockAstNode.codeOffset} and the block's
282
+ * offset) and applies it to the model.
283
+ */
284
+ readonly onEmbeddedCodeEditorEdit?: (block: CodeBlockAstNode, contentEdit: StringEdit) => void;
199
285
  }
200
286
 
201
287
  export declare class CodeBlockAstNode extends BlockAstNodeBase {
288
+ /** First token of the fenced code block info string, used for syntax highlighting. */
202
289
  readonly language: string;
290
+ /** Complete fenced code block info string, including metadata after the language token. */
291
+ readonly infoString: string;
203
292
  readonly content: readonly (MarkerAstNode | GlueAstNode)[];
204
293
  readonly leadingTrivia?: GlueAstNode | undefined;
294
+ /** Logical code tokens, excluding Markdown container prefixes and structural indentation. */
295
+ readonly codeText?: string | undefined;
205
296
  readonly kind = "codeBlock";
206
297
  private _previous?;
207
298
  private _contentEdit?;
208
- constructor(language: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
299
+ constructor(
300
+ /** First token of the fenced code block info string, used for syntax highlighting. */
301
+ language: string,
302
+ /** Complete fenced code block info string, including metadata after the language token. */
303
+ infoString: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined,
304
+ /** Logical code tokens, excluding Markdown container prefixes and structural indentation. */
305
+ codeText?: string | undefined);
209
306
  get children(): readonly AstNode[];
210
307
  get openFence(): MarkerAstNode | undefined;
211
308
  get closeFence(): MarkerAstNode | undefined;
@@ -260,6 +357,8 @@ declare class CodeBlockViewData {
260
357
  * only, so a nested block currently builds a fresh session on each rebuild.
261
358
  */
262
359
  export declare class CodeBlockViewNode extends BlockViewNode<CodeBlockViewData> {
360
+ private readonly _contentElement;
361
+ private _copyAction;
263
362
  private _session;
264
363
  /**
265
364
  * Subscription that re-tokenises the rendered `<code>` in place whenever the
@@ -271,10 +370,226 @@ export declare class CodeBlockViewNode extends BlockViewNode<CodeBlockViewData>
271
370
  * its predecessor's subscription explicitly.
272
371
  */
273
372
  private _snapshotSub;
373
+ /**
374
+ * An in-place interactive editor (e.g. an iframe) mounted instead of the
375
+ * rendered code. Like {@link _session} it is adopted from `previous` across
376
+ * rebuilds so the underlying editor keeps its state, and must be disposed
377
+ * manually (a node reused as `previous` is never {@link dispose}d).
378
+ */
379
+ private _embeddedEditor;
380
+ private readonly _embeddedEditorFactoryVersion;
381
+ private readonly _embeddedEditorReadOnly;
382
+ canReuse(data: AnyViewData, options: BlockViewOptions | undefined): boolean;
274
383
  constructor(data: CodeBlockViewData, options: BlockViewOptions | undefined, previous: ViewNode | undefined);
384
+ get element(): HTMLElement;
385
+ dispose(): void;
386
+ }
387
+
388
+ /**
389
+ * Canonical editor command catalog. Standalone keyboard handling and host
390
+ * integrations derive their command registration and default keybindings from
391
+ * this list.
392
+ */
393
+ export declare const commands: readonly EditorCommandDefinition[];
394
+
395
+ /** A persistent comment anchored to a source range. */
396
+ declare interface Comment_2 {
397
+ readonly id: string;
398
+ /** Source range the comment refers to (its highlighted region). */
399
+ readonly range: OffsetRange;
400
+ /** The comment text. */
401
+ readonly body: string;
402
+ /** Display name of the author, if any. */
403
+ readonly author?: string;
404
+ /** Creation time (epoch ms), used to render a relative timestamp. */
405
+ readonly createdAt?: number;
406
+ }
407
+ export { Comment_2 as Comment }
408
+
409
+ /**
410
+ * The compact editing state for a markdown comment.
411
+ *
412
+ * The widget owns its DOM and draft state but not its position. The comment-mode
413
+ * controller mounts it next to the active selection.
414
+ */
415
+ export declare class CommentInputWidget extends Disposable {
416
+ private readonly _options?;
417
+ readonly element: HTMLElement;
418
+ private readonly _textarea;
419
+ private readonly _measure;
420
+ private readonly _submitButton;
421
+ private readonly _value;
422
+ /** Live, untrimmed textarea content. */
423
+ get value(): IObservable<string>;
424
+ /** The raw textarea, exposed so a host can move focus into it. */
425
+ get inputElement(): HTMLTextAreaElement;
426
+ constructor(_options?: CommentInputWidgetOptions | undefined);
427
+ focus(): void;
428
+ setText(text: string): void;
429
+ clear(): void;
430
+ private _submit;
431
+ private _autoSize;
432
+ }
433
+
434
+ export declare interface CommentInputWidgetOptions {
435
+ /** Placeholder shown while the textarea is empty. Defaults to "Add comment". */
436
+ readonly placeholder?: string;
437
+ /** Called after the textarea changes size. */
438
+ readonly onDidChangeSize?: () => void;
439
+ /**
440
+ * Called when the user submits a non-empty comment (Enter or the add button).
441
+ * The text is trimmed; never called with an empty string.
442
+ */
443
+ readonly onSubmit?: (text: string) => void;
444
+ /** Called when the user dismisses the input (Escape). */
445
+ readonly onCancel?: () => void;
446
+ }
447
+
448
+ /**
449
+ * Comment mode — a compact "add a comment" affordance layered on top of
450
+ * the editor *without modifying it*. It reads the editor's public observables
451
+ * ({@link EditorModel.readonlyMode}, {@link EditorModel.selection}) and the
452
+ * exposed {@link EditorView.caretRect} geometry, and mounts a
453
+ * {@link CommentInputWidget} into {@link EditorView.overlayContainer}.
454
+ *
455
+ * Behaviour:
456
+ * - Only active in read-only mode (the "review" view).
457
+ * - When a user-created selection is non-empty, the input box appears next to
458
+ * the caret (the selection's active end) but does NOT take focus, so keyboard
459
+ * selection keeps working. Programmatic selections such as find matches do
460
+ * not summon it. Press Tab to move focus into the box, then type.
461
+ * - The box appears on mouse-up, not mid-drag, so it doesn't flicker/jump
462
+ * while a selection is being dragged out (keyboard selection shows at once).
463
+ * - While the box has focus or holds a draft it is frozen in place (selection
464
+ * changes, drags and clicks no longer move it). It is dismissed by Escape,
465
+ * by submitting, or by blurring an empty box.
466
+ * - The editor's logical caret geometry remains available for anchoring in
467
+ * read-only mode even though the painted caret is hidden. While the box has
468
+ * focus, `.md-comment-active` also suppresses the painted caret in any mode.
469
+ */
470
+ export declare class CommentModeController extends Disposable {
471
+ private readonly _model;
472
+ private readonly _view;
473
+ private readonly _options?;
474
+ private static _isCommentableSelectionSource;
475
+ private readonly _widget;
476
+ private readonly _gap;
477
+ private _visible;
478
+ private _anchorX;
479
+ private _pinnedRange;
480
+ /**
481
+ * Keep a dismissed comment hidden across layout updates until the selection
482
+ * changes, whether the user submitted it or pressed Escape.
483
+ */
484
+ private _dismissedRange;
485
+ constructor(_model: EditorModel, _view: EditorView, _options?: CommentModeControllerOptions | undefined);
486
+ private _update;
487
+ private _show;
488
+ private _layoutHorizontally;
489
+ /** Force-hide and clear the box (used by Escape and submit). */
490
+ private _hide;
491
+ /**
492
+ * Hide unless the user is engaged with the box: it has focus or holds a
493
+ * non-empty draft. This preserves in-progress text and keeps a focused box
494
+ * open (it is dismissed explicitly via Escape/submit, or by blurring it).
495
+ */
496
+ private _autoHide;
497
+ private _widgetHasFocus;
498
+ /**
499
+ * The visible viewport (client coords) used for the flip-above decision: the
500
+ * nearest scrollable ancestor of the editor. `.md-editor` itself spans the
501
+ * full document height and never clips, so measuring against it would always
502
+ * report room below. Falls back to the window when nothing scrolls.
503
+ */
504
+ private _getViewportRect;
505
+ private _hideAndRefocus;
506
+ private _submit;
507
+ }
508
+
509
+ export declare interface CommentModeControllerOptions {
510
+ /** Called when the user submits a comment for the current selection. */
511
+ readonly onSubmit?: (submission: CommentSubmission) => void;
512
+ /** Gap (px) between the bottom of the selection and the top of the input box. */
513
+ readonly gap?: number;
514
+ }
515
+
516
+ /**
517
+ * Seedable store of {@link Comment}s for the comment-mode contribution. It has
518
+ * no opinion on rendering or persistence — a host seeds it via
519
+ * {@link set}/{@link add} and observes {@link comments}.
520
+ */
521
+ export declare class CommentsModel {
522
+ private readonly _comments;
523
+ /** Monotonic counter for ids of comments created via {@link create}. */
524
+ private _sequence;
525
+ /** The current comments, in insertion order. */
526
+ get comments(): IObservable<readonly Comment_2[]>;
527
+ /** Replace the whole comment set. */
528
+ set(comments: readonly Comment_2[]): void;
529
+ /**
530
+ * Create a comment from a user submission and append it, generating its `id`
531
+ * and `createdAt` here so id/time allocation stays the store's concern (the
532
+ * UI only supplies the range and text). Returns the created comment.
533
+ */
534
+ create(input: {
535
+ range: OffsetRange;
536
+ body: string;
537
+ author?: string;
538
+ }): Comment_2;
539
+ /** Append a comment. */
540
+ add(comment: Comment_2): void;
541
+ /** Remove a comment by id. */
542
+ remove(id: string): void;
543
+ }
544
+
545
+ /** A comment the user submitted, with the source range it was anchored to. */
546
+ export declare interface CommentSubmission {
547
+ readonly text: string;
548
+ readonly range: OffsetRange;
549
+ }
550
+
551
+ /** Displays posted comments beside their source ranges. */
552
+ export declare class CommentsView extends Disposable {
553
+ private readonly _model;
554
+ private readonly _view;
555
+ private readonly _layer;
556
+ private readonly _entries;
557
+ private _order;
558
+ private _pendingRevealCommentId;
559
+ constructor(_model: CommentsModel, _view: EditorView);
560
+ revealComment(id: string): void;
561
+ private _reconcile;
562
+ private _relayout;
563
+ private _revealPendingComment;
564
+ }
565
+
566
+ /** Compact posted state for a markdown comment. */
567
+ export declare class CommentWidget {
568
+ private readonly _domNode;
569
+ private readonly _disposables;
570
+ get element(): HTMLElement;
571
+ constructor(options: CommentWidgetOptions);
275
572
  dispose(): void;
276
573
  }
277
574
 
575
+ export declare interface CommentWidgetOptions {
576
+ /** The posted comment body. */
577
+ readonly body: string;
578
+ /** If provided, shows a delete action and invokes it when activated. */
579
+ readonly onDelete?: () => void;
580
+ }
581
+
582
+ /** The lossless source slices of a complete block HTML comment. */
583
+ declare interface CompleteHtmlCommentSource extends HtmlCommentSourceBase {
584
+ readonly kind: 'complete';
585
+ readonly closing: '-->';
586
+ readonly trailingWhitespace: string;
587
+ }
588
+
589
+ export declare const copyLinesDown: EditCommand;
590
+
591
+ export declare const copyLinesUp: EditCommand;
592
+
278
593
  /**
279
594
  * A {@link MonacoSyntaxHighlighter} preloaded with a handful of common Monarch
280
595
  * grammars (plus the usual short aliases). Unknown languages fall back to an
@@ -285,13 +600,17 @@ export declare class CodeBlockViewNode extends BlockViewNode<CodeBlockViewData>
285
600
  */
286
601
  export declare function createDefaultMonacoSyntaxHighlighter(monaco: IMonarchApi, grammars: IDefaultMonarchGrammars): MonacoSyntaxHighlighter;
287
602
 
288
- export declare type CursorCommand = (ctx: CursorCommandContext) => SourceOffset;
603
+ export declare type CursorCommand = (ctx: CursorCommandContext) => CursorPosition;
289
604
 
290
605
  export declare interface CursorCommandContext {
291
606
  readonly text: string;
292
607
  readonly selection: Selection_2;
293
608
  readonly document: DocumentAstNode;
294
609
  readonly activeBlock: BlockAstNode | undefined;
610
+ readonly markerVisibleBlocks: ReadonlySet<BlockAstNode>;
611
+ readonly markupSelectionRange?: OffsetRange;
612
+ readonly wordNavigationConfig: WordNavigationConfig;
613
+ readonly cursorPosition: CursorPosition;
295
614
  }
296
615
 
297
616
  export declare const cursorDocumentEnd: CursorCommand;
@@ -300,6 +619,8 @@ export declare const cursorDocumentStart: CursorCommand;
300
619
 
301
620
  export declare const cursorDown: VisualCursorCommand;
302
621
 
622
+ export declare type CursorKeyboardAction = 'left' | 'right' | 'up' | 'down' | 'wordLeft' | 'wordRight' | 'visualLineStart' | 'visualLineEnd' | 'logicalLineStart' | 'logicalLineEnd' | 'documentStart' | 'documentEnd';
623
+
303
624
  export declare const cursorLeft: CursorCommand;
304
625
 
305
626
  export declare const cursorLineEnd: CursorCommand;
@@ -309,12 +630,23 @@ export declare const cursorLineStart: CursorCommand;
309
630
  export declare const cursorMoveLeft: CursorCommand;
310
631
 
311
632
  export declare interface CursorMoveResult {
312
- readonly offset: SourceOffset;
633
+ readonly position: CursorPosition;
313
634
  readonly desiredColumn: number | undefined;
314
635
  }
315
636
 
316
637
  export declare const cursorMoveRight: CursorCommand;
317
638
 
639
+ /** The cursor's position in either source text or a source-less visual line. */
640
+ export declare type CursorPosition = SourceCursorPosition | {
641
+ readonly kind: 'virtual';
642
+ readonly line: VirtualCursorLine;
643
+ };
644
+
645
+ export declare namespace CursorPosition {
646
+ export function source(offset: SourceOffset, affinity?: SourceCursorPosition['affinity']): SourceCursorPosition;
647
+ export function virtual(line: VirtualCursorLine): CursorPosition;
648
+ }
649
+
318
650
  export declare const cursorRight: CursorCommand;
319
651
 
320
652
  export declare const cursorUp: VisualCursorCommand;
@@ -323,49 +655,131 @@ export declare const cursorUp: VisualCursorCommand;
323
655
  * Owns the blinking cursor DOM element.
324
656
  *
325
657
  * The rendering pipeline is a single `derived` whose compute callback
326
- * asks the {@link VisualLineMap} for the caret rect at the current
327
- * offset, writes it to {@link element}, and returns a
658
+ * asks the {@link VisualLineMap} for the caret rect at the current source or
659
+ * virtual position, writes it to {@link element}, and returns a
328
660
  * {@link CursorViewRendering} value as proof. An autorun keeps the
329
661
  * derived subscribed.
330
662
  */
331
663
  export declare class CursorView extends Disposable {
332
- private readonly _parent;
333
664
  readonly element: HTMLElement;
334
665
  readonly rendering: IObservable<CursorViewRendering>;
335
- constructor(_parent: HTMLElement, options: CursorViewOptions);
666
+ constructor(options: CursorViewOptions);
336
667
  }
337
668
 
338
669
  export declare interface CursorViewOptions {
339
- readonly offset: IObservable<SourceOffset | undefined>;
670
+ readonly position: IObservable<CursorPosition | undefined>;
340
671
  readonly visualLineMap: IObservable<VisualLineMap>;
341
672
  /**
342
- * When set, the caret is drawn over the transient empty paragraph instead
343
- * of at {@link offset} — its rect (in client coordinates) comes straight
344
- * from that synthetic element's geometry, since it has no visual-line-map
345
- * entry. Takes priority over the normal offset-based placement.
673
+ * The mounted blocks, used to hide the caret when it sits at an offset that
674
+ * has been scrolled out of its (horizontally scrolling) block's viewport —
675
+ * matching how the selection is clipped there.
346
676
  */
347
- readonly pendingCaretRect?: IObservable<Rect2D | undefined>;
677
+ readonly blocks?: IObservable<readonly SelectionBlock[]>;
348
678
  }
349
679
 
350
680
  export declare class CursorViewRendering {
351
- readonly offset: SourceOffset;
681
+ readonly position: CursorPosition;
352
682
  readonly visible: boolean;
353
683
  readonly rect: Rect2D;
354
- constructor(offset: SourceOffset, visible: boolean, rect: Rect2D);
684
+ constructor(position: CursorPosition, visible: boolean, rect: Rect2D);
355
685
  }
356
686
 
687
+ export declare const cursorVisualLineEnd: VisualCursorCommand;
688
+
689
+ export declare const cursorVisualLineStart: VisualCursorCommand;
690
+
357
691
  export declare const cursorWordLeft: CursorCommand;
358
692
 
359
693
  export declare const cursorWordRight: CursorCommand;
360
694
 
695
+ export declare const DEFAULT_INDENTATION_CONFIG: IndentationConfig;
696
+
697
+ export declare const DEFAULT_WORD_NAVIGATION_CONFIG: WordNavigationConfig;
698
+
699
+ export declare const DEFAULT_WORD_SEPARATORS = "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";
700
+
361
701
  export declare const deleteLeft: EditCommand;
362
702
 
703
+ export declare const deleteLineLeft: EditCommand;
704
+
705
+ export declare const deleteLineRight: EditCommand;
706
+
707
+ export declare const deleteLines: EditCommand;
708
+
363
709
  export declare const deleteRight: EditCommand;
364
710
 
365
711
  export declare const deleteWordLeft: EditCommand;
366
712
 
367
713
  export declare const deleteWordRight: EditCommand;
368
714
 
715
+ /**
716
+ * A read-only "removed" decoration: an original block rendered (red) above its
717
+ * place in the modified document, occupying vertical space like a view-zone but
718
+ * contributing **zero** source length, so the editor's source mapping stays the
719
+ * modified document and editing is unaffected. Used for `removed` and the
720
+ * original side of a `replaced` block in editor diff mode.
721
+ */
722
+ declare class DiffDecorationViewData {
723
+ readonly ast: AstNode;
724
+ readonly side: BlockViewData;
725
+ readonly deletedRanges: readonly DiffHighlightRange[];
726
+ /** True when the whole block was removed: solid red band, no word rects. */
727
+ readonly whole: boolean;
728
+ /** Absolute offset of this block in the *original* document. */
729
+ readonly originalStart: number;
730
+ readonly kind = "diffDecoration";
731
+ constructor(ast: AstNode, side: BlockViewData, deletedRanges: readonly DiffHighlightRange[],
732
+ /** True when the whole block was removed: solid red band, no word rects. */
733
+ whole: boolean,
734
+ /** Absolute offset of this block in the *original* document. */
735
+ originalStart: number);
736
+ }
737
+
738
+ /** A word/character highlight inside one diff side, in block-local coords. */
739
+ declare interface DiffHighlightRange {
740
+ readonly range: OffsetRange;
741
+ readonly kind: 'inserted' | 'deleted';
742
+ }
743
+
744
+ /**
745
+ * A changed block rendered as its original form stacked over its modified form
746
+ * (either side may be absent for a pure deletion/insertion). It is itself a
747
+ * document child the renderer mounts like a block; its {@link ast} is the
748
+ * surviving side's ast, used only for view-node identity/reuse.
749
+ */
750
+ declare class DiffHunkViewData {
751
+ readonly ast: AstNode;
752
+ readonly original: DiffSideViewData | undefined;
753
+ readonly modified: DiffSideViewData | undefined;
754
+ readonly kind = "diffHunk";
755
+ constructor(ast: AstNode, original: DiffSideViewData | undefined, modified: DiffSideViewData | undefined);
756
+ }
757
+
758
+ /**
759
+ * The recursive classification of a diff. Each item describes one aligned
760
+ * position in the merged document:
761
+ *
762
+ * - `unchanged` — render the (modified) node once, neutral.
763
+ * - `added` — exists only in the modified document (green).
764
+ * - `removed` — exists only in the original document (red).
765
+ * - `replaced` — a *leaf* block changed in place → render original over
766
+ * modified, with word-level {@link AnnotatedRange}s on each.
767
+ * - `nested` — a *container* changed → render it once and diff its
768
+ * {@link NestedItem.children} recursively.
769
+ *
770
+ * Offsets ({@link UnchangedItem.modifiedStart} etc.) are absolute in their
771
+ * respective documents, so a renderer/visualizer can slice the source text.
772
+ */
773
+ declare type DiffItem = UnchangedItem | AddedItem | RemovedItem | ReplacedItem | NestedItem;
774
+
775
+ /** One side (original or modified) of a {@link DiffHunkViewData}. */
776
+ declare interface DiffSideViewData {
777
+ readonly view: BlockViewData;
778
+ /** Render in active form (markers/whitespace visible). */
779
+ readonly active: boolean;
780
+ readonly ranges: readonly DiffHighlightRange[];
781
+ }
782
+
369
783
  export declare class DocumentAstNode extends AstNode {
370
784
  readonly content: readonly (BlockAstNode | GlueAstNode)[];
371
785
  readonly kind = "document";
@@ -390,14 +804,21 @@ declare interface DocumentBlockViewData {
390
804
  readonly view: BlockViewData;
391
805
  }
392
806
 
393
- /** A mounted document child: a block, a run of inter-block glue, or the
394
- * transient empty paragraph (see {@link PendingParagraphViewData}). */
807
+ /** A mounted document child: a block, a run of inter-block glue, the
808
+ * transient empty paragraph (see {@link PendingParagraphViewData}), or a
809
+ * {@link DiffHunkViewData diff hunk} (stacked original/modified blocks). */
395
810
  declare interface DocumentChildViewData {
396
811
  readonly absoluteStart: number;
397
812
  /** For a block: selection reaches it. For glue: always false (unowned, hidden). */
398
813
  readonly isActive: boolean;
399
- readonly view: BlockViewData | GlueViewData | PendingParagraphViewData;
400
- readonly kind: 'block' | 'glue' | 'pendingParagraph';
814
+ readonly view: BlockViewData | GlueViewData | PendingParagraphViewData | DiffHunkViewData | DiffDecorationViewData;
815
+ readonly kind: 'block' | 'glue' | 'pendingParagraph' | 'diffHunk' | 'diffDecoration';
816
+ /**
817
+ * Diff mode: how this (modified) block changed. `added` = a whole new block
818
+ * (strong green band, no inline rects); `modified` = a partial change (light
819
+ * band + inline rects on the changed words).
820
+ */
821
+ readonly diffKind?: 'added' | 'modified';
401
822
  }
402
823
 
403
824
  /**
@@ -454,7 +875,7 @@ declare class DocumentViewData {
454
875
  export declare class DocumentViewNode extends ViewNode {
455
876
  readonly blocks: readonly DocumentBlock[];
456
877
  /** The transient empty-paragraph element, when one is armed. */
457
- readonly pendingElement?: HTMLElement | undefined;
878
+ readonly pendingParagraph?: PendingParagraphViewNode | undefined;
458
879
  static create(viewData: DocumentViewData, options: BlockViewOptions | undefined, previous: DocumentViewNode | undefined): DocumentViewNode;
459
880
  private constructor();
460
881
  /** The stable content element this document mounts its children into. */
@@ -476,6 +897,26 @@ export declare type EditCommand = (ctx: CursorCommandContext) => {
476
897
  readonly selection: Selection_2;
477
898
  } | undefined;
478
899
 
900
+ export declare type EditKeyboardAction = 'deleteLeft' | 'deleteRight' | 'deleteWordLeft' | 'deleteWordRight' | 'deleteLineLeft' | 'deleteLineRight' | 'copyLinesUp' | 'copyLinesDown' | 'moveLinesUp' | 'moveLinesDown' | 'deleteLines' | 'joinLines';
901
+
902
+ export declare interface EditorCommandDefinition {
903
+ readonly id: `markdown.editor.${string}`;
904
+ readonly title: string;
905
+ readonly action: EditorKeyboardAction;
906
+ readonly keybindings: readonly EditorCommandKeybinding[];
907
+ /**
908
+ * Local commands must execute synchronously in the webview instead of being
909
+ * forwarded through the VS Code keybinding service.
910
+ */
911
+ readonly routing?: 'host' | 'local';
912
+ }
913
+
914
+ export declare interface EditorCommandKeybinding {
915
+ readonly key: string;
916
+ readonly modifiers?: KeyboardModifiers;
917
+ readonly platforms?: readonly KeyboardPlatform[];
918
+ }
919
+
479
920
  /**
480
921
  * Translates raw browser input (mouse, keyboard, EditContext) into model
481
922
  * mutations. Knows about DOM event types but never reads/writes the DOM
@@ -484,19 +925,46 @@ export declare type EditCommand = (ctx: CursorCommandContext) => {
484
925
  *
485
926
  * Owns the only non-derivable controller state:
486
927
  * - `_desiredColumn` — sticky column for up/down navigation
928
+ * - `_clickCount` / `_lastPointerDown` — multi-click detection for pointer
929
+ * input, since `pointerdown` events (unlike `mousedown`) don't populate
930
+ * `detail` with a click count.
487
931
  */
488
932
  export declare class EditorController extends Disposable {
489
933
  private readonly _model;
490
934
  private readonly _view;
935
+ readonly findController: FindController | undefined;
491
936
  private _desiredColumn;
937
+ private readonly _keyboardPlatform;
938
+ private readonly _keyboardProfile;
939
+ private readonly _forwardedKeyboardProfile;
940
+ private readonly _historyStrategy;
941
+ private readonly _indentation;
942
+ private readonly _tabFocusStatus;
943
+ private _tabMovesFocus;
944
+ /** Indentation copied by the most recent fenced-code Enter, while still untouched. */
945
+ private _generatedIndentation;
946
+ /** Running click count for the current multi-click sequence (1, 2, 3, …). */
947
+ private _clickCount;
948
+ /** Timestamp and position of the previous pointer-down, for multi-click detection. */
949
+ private _lastPointerDown;
492
950
  constructor(_model: EditorModel, _view: EditorView, options?: EditorControllerOptions);
493
951
  private readonly _handleTextUpdate;
494
- private readonly _handleMouseDown;
952
+ insertText(text: string, selectionOverride?: Selection_2): void;
953
+ private _insertText;
954
+ private _remainingGeneratedIndentation;
955
+ /** Handle typed, pasted, or command-generated text while a paragraph is pending. */
956
+ private _handlePendingInput;
957
+ private _deletePendingText;
958
+ private readonly _handlePointerDown;
495
959
  private _makeCursorContext;
496
960
  private _makeVisualCursorContext;
497
961
  private _executeCursorCommand;
498
962
  private _executeEditCommand;
963
+ private _runUndoableEdit;
499
964
  private _executeVisualCursorCommand;
965
+ private _cursorDown;
966
+ private _setUserSelection;
967
+ private _applyCursorPosition;
500
968
  /** Move the cursor down one visual line (Arrow Down). */
501
969
  cursorDown(extend?: boolean): void;
502
970
  /** Move the cursor up one visual line (Arrow Up). */
@@ -504,12 +972,34 @@ export declare class EditorController extends Disposable {
504
972
  private _selectedText;
505
973
  private readonly _updateModifierState;
506
974
  private readonly _clearModifierState;
975
+ /**
976
+ * Drop any native DOM selection over the rendered text.
977
+ *
978
+ * The editor paints selection from `model.selection`, so a browser
979
+ * selection there is always spurious: nothing reads it (copy/cut read the
980
+ * model, hit-testing uses the measured layout) and nothing clears it, so it
981
+ * lingers as a second highlight even after the caret moves away.
982
+ * {@link isCaretMotionKey} stops the common source synchronously; this is
983
+ * the backstop for the rest of the browser's editing commands, which are
984
+ * platform- and version-specific and cannot be enumerated (Shift+PageDown
985
+ * and macOS Shift+Ctrl+B both reach one today).
986
+ *
987
+ * Scoped twice so it only ever discards selections the editor owns: the
988
+ * range must touch the rendered text (overlays such as comment widgets sit
989
+ * beside it and stay selectable), and input focus must still be inside this
990
+ * editor (so a host find-in-page, which selects while its own input is
991
+ * focused, is left alone).
992
+ */
993
+ private readonly _discardNativeSelection;
507
994
  private readonly _handleKeyDown;
995
+ executeCommand(command: EditorCommandDefinition): void;
996
+ private _executeKeyboardAction;
508
997
  /**
509
998
  * Context-aware Enter: splits / line-breaks via {@link insertSmartEnter}, or
510
999
  * arms a transient empty paragraph when at the end of a paragraph.
511
1000
  */
512
1001
  private _smartEnter;
1002
+ private _registerTabFocusAccessibility;
513
1003
  }
514
1004
 
515
1005
  /** Options for an {@link EditorController}. */
@@ -520,10 +1010,81 @@ export declare interface EditorControllerOptions {
520
1010
  * strategy (e.g. `AsyncClipboardStrategy`) in hosts that swallow them.
521
1011
  */
522
1012
  readonly clipboardStrategy?: IClipboardStrategy;
1013
+ /**
1014
+ * Where undo and redo are executed: `LocalHistoryStrategy` for a
1015
+ * self-contained editor, or a strategy that forwards to the host's own
1016
+ * document history. Left unset, the chords are passed on to the host.
1017
+ */
1018
+ readonly historyStrategy?: IHistoryStrategy;
1019
+ readonly keyboardPlatform?: KeyboardPlatform;
1020
+ readonly keyboardProfile?: KeyboardProfile;
1021
+ /**
1022
+ * Bindings owned by the host. Matching events have their browser default
1023
+ * suppressed but continue propagating so the host keybinding service sees them.
1024
+ */
1025
+ readonly forwardedKeyboardProfile?: KeyboardProfile;
1026
+ /** Tab-stop settings used outside semantic list indentation. */
1027
+ readonly indentation?: IndentationConfig;
1028
+ readonly find?: false;
523
1029
  }
524
1030
 
1031
+ /**
1032
+ * The editor overlay's local CSS-pixel coordinate space.
1033
+ *
1034
+ * Browser geometry and pointer APIs expose viewport client coordinates. This
1035
+ * boundary converts them immediately into the coordinate system shared by the
1036
+ * editor content and its overlays. Range rectangles are axis-aligned, so the
1037
+ * current implementation deliberately supports positive axis-aligned scale and
1038
+ * translation only.
1039
+ */
1040
+ export declare class EditorCoordinateSpace {
1041
+ private readonly _getLocalToClientMatrix;
1042
+ static forSvgOverlay(overlay: SVGSVGElement): EditorCoordinateSpace;
1043
+ private constructor();
1044
+ capture(): EditorCoordinateTransform;
1045
+ }
1046
+
1047
+ /** A stable coordinate conversion captured for one measurement operation. */
1048
+ export declare class EditorCoordinateTransform {
1049
+ private readonly _localToClient;
1050
+ private readonly _clientToLocal;
1051
+ constructor(_localToClient: DOMMatrix);
1052
+ toLocalPoint(point: Pick<Point2D, 'x' | 'y'>): Point2D;
1053
+ toClientPoint(point: Pick<Point2D, 'x' | 'y'>): Point2D;
1054
+ toLocalRect(rect: Pick<DOMRectReadOnly, 'left' | 'top' | 'width' | 'height'>): Rect2D;
1055
+ toClientRect(rect: Pick<Rect2D, 'left' | 'top' | 'width' | 'height'>): Rect2D;
1056
+ private _convertRect;
1057
+ }
1058
+
1059
+ export declare type EditorKeyboardAction = {
1060
+ readonly kind: 'cursor';
1061
+ readonly command: CursorKeyboardAction;
1062
+ readonly extend: boolean;
1063
+ } | {
1064
+ readonly kind: 'edit';
1065
+ readonly command: EditKeyboardAction;
1066
+ } | {
1067
+ readonly kind: 'history';
1068
+ readonly command: HistoryKeyboardAction;
1069
+ } | {
1070
+ readonly kind: 'tab';
1071
+ readonly command: TabKeyboardAction;
1072
+ } | {
1073
+ readonly kind: 'toggleTabFocus';
1074
+ } | {
1075
+ readonly kind: 'toggleReadonly';
1076
+ } | {
1077
+ readonly kind: 'selectAll';
1078
+ } | {
1079
+ readonly kind: 'enter';
1080
+ readonly command: 'smartEnter' | 'insertParagraph' | 'insertHardLineBreak';
1081
+ };
1082
+
525
1083
  export declare class EditorModel {
526
1084
  private readonly _parser;
1085
+ private readonly _sourceEditListeners;
1086
+ private readonly _sourceTextIds;
1087
+ private _lastSourceTextId;
527
1088
  /**
528
1089
  * The most recent edit applied to {@link sourceText}, used by
529
1090
  * {@link document} to let the parser link incrementally edited code
@@ -532,11 +1093,18 @@ export declare class EditorModel {
532
1093
  */
533
1094
  private _pendingEdit;
534
1095
  readonly sourceText: ISettableObservable<StringValue, void>;
1096
+ readonly wordNavigationConfig: ISettableObservable<WordNavigationConfig, void>;
1097
+ /** Disables text editing, independently of parsing, layout and markup visibility. */
1098
+ readonly readonlyMode: ISettableObservable<boolean, void>;
1099
+ readonly presentation: ISettableObservable<EditorPresentation, void>;
1100
+ readonly renderMarkupText: ISettableObservable<RenderMarkupText, void>;
1101
+ readonly presentationPolicy: IObservableWithChange<PresentationPolicy, void>;
535
1102
  /**
536
1103
  * The current selection, or `undefined` when the editor has no caret
537
1104
  * (e.g. an inactive/unfocused rendering).
538
1105
  */
539
1106
  readonly selection: ISettableObservable<Selection_2 | undefined, void>;
1107
+ readonly selectionSource: ISettableObservable<SelectionSource, void>;
540
1108
  /**
541
1109
  * Whether a Ctrl/Cmd modifier is currently held. Set by the controller from
542
1110
  * live keyboard state; the view reads it to show the link-open affordance
@@ -544,6 +1112,14 @@ export declare class EditorModel {
544
1112
  * whose block is active.
545
1113
  */
546
1114
  readonly ctrlOrMetaDown: ISettableObservable<boolean, void>;
1115
+ /**
1116
+ * Whether a pointer-driven selection drag is currently in progress. Set by
1117
+ * the controller between the pointer-down that starts the drag and the
1118
+ * pointer-up/cancel that ends it. Contributions read it to defer UI that
1119
+ * would otherwise flicker mid-drag (e.g. the comment input box appears only
1120
+ * once the drag ends).
1121
+ */
1122
+ readonly isSelecting: ISettableObservable<boolean, void>;
547
1123
  /**
548
1124
  * Gutter markers (source-control style change indicators) painted in the
549
1125
  * left gutter. Each entry maps a source {@link OffsetRange} to a change kind
@@ -563,16 +1139,19 @@ export declare class EditorModel {
563
1139
  * The transient empty-paragraph editing state, or `undefined` when none is
564
1140
  * armed. See {@link PendingParagraph}. This is *not* document data — it is
565
1141
  * cleared by any source edit and lives only between the Enter that armed it
566
- * and the next keystroke.
1142
+ * and the next content-producing edit.
567
1143
  */
568
1144
  readonly pendingParagraph: ISettableObservable<PendingParagraph | undefined, void>;
1145
+ /** Switches between editing and locked mode and clears transient edit intent. */
1146
+ toggleReadonlyMode(): void;
569
1147
  readonly cursorOffset: IObservableWithChange<number | undefined, void>;
1148
+ readonly cursorPosition: IObservableWithChange<CursorPosition | undefined, void>;
570
1149
  /**
571
1150
  * The parsed document. Threads the previous document into the parser so
572
1151
  * unchanged blocks keep their object identity across reparses (see
573
1152
  * {@link MarkdownParser.parse}). Writing `previous` inside the compute is
574
- * a safe optimization: `derived` only recomputes when `sourceText`
575
- * changes, and the result is structurally identical to a full reparse.
1153
+ * safe: unchanged source reuses it directly, while changed source produces
1154
+ * a result structurally identical to a full reparse.
576
1155
  */
577
1156
  readonly document: IObservableWithChange<DocumentAstNode, void>;
578
1157
  /**
@@ -589,26 +1168,75 @@ export declare class EditorModel {
589
1168
  * collapsed this is a one-element set holding {@link activeBlock}.
590
1169
  */
591
1170
  readonly activeBlocks: IObservableWithChange<Set<BlockAstNode>, void>;
1171
+ /**
1172
+ * The baseline document to diff against. When set, the editor renders in
1173
+ * diff mode: the modified document ({@link document}) stays editable, while
1174
+ * the baseline's removed/changed blocks are shown as read-only decorations.
1175
+ * `undefined` (the default) renders normally.
1176
+ */
1177
+ readonly baseline: ISettableObservable<StringValue | undefined, void>;
1178
+ private readonly _baselineDocument;
1179
+ /**
1180
+ * The diff of {@link baseline} → {@link document}, or `undefined` when no
1181
+ * baseline is set. The view renders the {@link DiffItem}s as stacked
1182
+ * decorations; `insertedRanges` (modified-side change spans) drive the green
1183
+ * word-level highlight.
1184
+ */
1185
+ readonly diff: IObservableWithChange< {
1186
+ items: DiffItem[];
1187
+ insertedRanges: OffsetRange[];
1188
+ changedBlocks: Set<BlockAstNode>;
1189
+ } | undefined, void>;
1190
+ readonly markerVisibleBlocks: IObservableWithChange<Set<BlockAstNode>, void>;
1191
+ getMarkupSelectionRange(selectionRange: OffsetRange | undefined, reader?: IReader): OffsetRange | undefined;
1192
+ onWillApplySourceEdit(listener: (event: SourceEditEvent) => void): IDisposable;
1193
+ /** Returns a stable per-object identity without retaining the source text. */
1194
+ getSourceTextId(sourceText: StringValue): number;
592
1195
  /**
593
1196
  * Arm a {@link PendingParagraph} at the given gap, minting a fresh synthetic
594
1197
  * AST node for it, and park the caret at the gap start. No source edit is
595
1198
  * applied — the blank line exists only in the view until it is materialized.
596
1199
  */
597
- armPendingParagraph(req: {
598
- anchorBlock: BlockAstNode;
599
- replaceRange: OffsetRange;
600
- atEof: boolean;
601
- }): void;
1200
+ armPendingParagraph(req: Omit<PendingParagraph, 'syntheticAst' | 'cursorLine' | 'text'>): void;
602
1201
  /** Discard the pending paragraph (if any) without touching the source. */
603
1202
  cancelPendingParagraph(): void;
1203
+ /**
1204
+ * Replace the source with an authoritative value from the host, mapping the
1205
+ * selection through the changed span and atomically discarding transient
1206
+ * state anchored to the previous parse.
1207
+ */
1208
+ replaceSourceText(text: StringValue): void;
1209
+ /** Replace the transient horizontal whitespace on the pending line. */
1210
+ setPendingParagraphText(text: string): void;
604
1211
  /**
605
1212
  * Turn the pending paragraph into real source: rewrite its gap so the typed
606
- * `text` becomes its own paragraph, separated from its neighbours by blank
607
- * lines, and place the caret after the inserted text.
1213
+ * text, including any transient indentation, is separated from its neighbours
1214
+ * by blank lines, and place the caret after it.
608
1215
  */
609
1216
  materializePendingParagraph(text: string): void;
610
- applyEdit(edit: StringEdit): void;
1217
+ /** Sets a rendered task checkbox state in either editing or read-only mode. */
1218
+ setTaskCheckboxChecked(item: ListItemAstNode, checked: boolean): void;
1219
+ applyEdit(edit: StringEdit, selection?: Selection_2): void;
611
1220
  applyEditForSelection(edit: StringEdit): void;
1221
+ private _applySourceEdit;
1222
+ private _identifySourceEdit;
1223
+ private _emitWillApplySourceEdit;
1224
+ }
1225
+
1226
+ export declare type EditorOverlayPosition = 'top-chrome' | 'below-selection' | 'above-decorations';
1227
+
1228
+ export declare type EditorPresentation = 'reading' | 'editing';
1229
+
1230
+ /** Text updates and browser attachment are separate so hosts can supply a local transport. */
1231
+ declare interface EditorTextInput {
1232
+ readonly context: EditorTextInputContext;
1233
+ readonly nativeContext: IObservable<EditContext | null>;
1234
+ }
1235
+
1236
+ declare interface EditorTextInputContext extends EventTarget {
1237
+ readonly text: string;
1238
+ updateText(start: number, end: number, text: string): void;
1239
+ updateSelection(start: number, end: number): void;
612
1240
  }
613
1241
 
614
1242
  /**
@@ -638,8 +1266,13 @@ export declare class EditorView extends Disposable {
638
1266
  private readonly _model;
639
1267
  private readonly _options?;
640
1268
  readonly element: HTMLElement;
641
- readonly editContext: EditContext;
1269
+ readonly editContext: EditorTextInputContext;
1270
+ private readonly _nativeEditContext;
642
1271
  readonly measuredLayout: MeasuredLayoutModel;
1272
+ readonly coordinateSpace: EditorCoordinateSpace;
1273
+ readonly forcedMarkerVisibleBlocks: ISettableObservable<ReadonlySet<BlockAstNode>, void>;
1274
+ readonly showReadonlyToggle: ISettableObservable<boolean, void>;
1275
+ readonly highlightActiveBlock: ISettableObservable<boolean, void>;
643
1276
  /**
644
1277
  * Inner container that holds the rendered document and the cursor/selection
645
1278
  * overlays. The outer {@link element} spans the full width; this container
@@ -647,9 +1280,18 @@ export declare class EditorView extends Disposable {
647
1280
  * to their parent's box) stay aligned with the content.
648
1281
  */
649
1282
  private readonly _contentContainer;
1283
+ private readonly _resizeObserver;
650
1284
  private readonly _cursorView;
651
1285
  private readonly _selectionView;
652
1286
  private readonly _gutterMarkersView;
1287
+ private readonly _diffHighlightsView;
1288
+ private _readonlyToggleButton;
1289
+ private readonly _editContextSuspensions;
1290
+ private readonly _revealOcclusions;
1291
+ private _pendingTopReveal;
1292
+ private _caretRevealRaf;
1293
+ private _followedCaretBlock;
1294
+ private _followCaretAfterEdit;
653
1295
  /**
654
1296
  * The mounted block sequence, in source order. Rebuilt (not mutated) each
655
1297
  * frame by {@link DocumentViewNode.create}; the view just swaps one
@@ -657,8 +1299,17 @@ export declare class EditorView extends Disposable {
657
1299
  * (those go through the measured-layout model).
658
1300
  */
659
1301
  private readonly _document;
1302
+ private readonly _embeddedCodeEditorFactoryVersion;
1303
+ private readonly _suspendEditContextForBlockControl;
1304
+ private _clipboardWriter;
1305
+ private readonly _writeClipboardText;
1306
+ /** Connects explicit copy actions to the controller's host clipboard strategy. */
1307
+ setClipboardWriter(writeText: (text: string) => Promise<void>): IDisposable;
1308
+ private _renderedSourceEditing;
660
1309
  /** The current view-node tree (AST overlaid with rendered DOM), for debugging. */
661
1310
  get documentViewNode(): IObservable<DocumentViewNode | undefined>;
1311
+ /** Re-resolves embedded code editors while preserving the surrounding editor view. */
1312
+ refreshEmbeddedCodeEditors(): void;
662
1313
  /**
663
1314
  * Last frame's view-data overlay, threaded back into
664
1315
  * {@link buildDocumentViewData} so any subtree whose ast and selection flags
@@ -670,19 +1321,46 @@ export declare class EditorView extends Disposable {
670
1321
  private readonly _viewData;
671
1322
  get viewData(): IObservable<DocumentViewData | undefined>;
672
1323
  /**
673
- * Caret rect (client coords) for the transient empty paragraph, or
674
- * `undefined` when none is armed. Set each frame from the synthetic
675
- * paragraph element's geometry and fed to the {@link CursorView}, which has
676
- * no visual-line-map entry to place the caret from otherwise.
1324
+ * Whether the editor is genuinely focused: focus rests somewhere inside the
1325
+ * editor subtree *and* its window is focused. Mirrored onto the root as
1326
+ * `.md-focused`, which gates the painted caret — the blinking cursor is only
1327
+ * shown while this is `true`, so it never blinks in an unfocused editor or
1328
+ * after the window loses focus. Only the caret's visibility is affected; the
1329
+ * logical selection and caret geometry ({@link caretRect}) are unchanged.
677
1330
  */
678
- private readonly _pendingCaretRect;
1331
+ private readonly _focused;
1332
+ get focused(): IObservable<boolean>;
679
1333
  /**
680
1334
  * The block cache projected for views (selection painting) that need to
681
1335
  * react to mount/unmount. Derived from {@link _document}, so it stays in
682
1336
  * lock-step without any manual bookkeeping.
683
1337
  */
684
1338
  private readonly _selectionBlocksObs;
1339
+ /**
1340
+ * The caret rect (zero width) at the selection's active end, in
1341
+ * {@link overlayContainer}-local coordinates, or `undefined` when there is no
1342
+ * caret. This is the same geometry the editor paints its cursor from, so
1343
+ * contributions (e.g. comment mode) can anchor an overlay to the active end of
1344
+ * the selection — where the user's cursor is — without re-deriving geometry.
1345
+ */
1346
+ private readonly _caretRect;
1347
+ get caretRect(): IObservable<Rect2D | undefined>;
1348
+ /**
1349
+ * The container that establishes the positioning context for the editor's
1350
+ * overlays (cursor, selection, gutter). Contributions mount their own
1351
+ * absolutely-positioned overlays here so they share the coordinate space of
1352
+ * {@link caretRect}.
1353
+ */
1354
+ get overlayContainer(): HTMLElement;
1355
+ /**
1356
+ * Selection-style rectangles covering `range`, in {@link overlayContainer}-
1357
+ * local coordinates — the same geometry the live selection paints. Exposed so
1358
+ * contributions (e.g. persistent comments) can highlight arbitrary ranges and
1359
+ * anchor overlays to them. Recomputes when the measured layout changes.
1360
+ */
1361
+ rangeRects(range: OffsetRange): IObservable<readonly SelectionRect[]>;
685
1362
  constructor(_model: EditorModel, _options?: EditorViewOptions | undefined);
1363
+ private _setupEmptyDocumentSelection;
686
1364
  /**
687
1365
  * Mirrors the model's live Ctrl/Cmd state onto the editor root as
688
1366
  * `.md-mod-down` so CSS can show the link-open underline and pointer cursor
@@ -690,13 +1368,110 @@ export declare class EditorView extends Disposable {
690
1368
  * a plain click, but an active link only opens with the modifier held.
691
1369
  */
692
1370
  private _setupModifierTracking;
1371
+ /**
1372
+ * Tracks whether the editor is genuinely focused and mirrors it onto the
1373
+ * root as `.md-focused` so CSS can gate the painted caret. "Focused" means
1374
+ * focus rests somewhere inside the editor subtree *and* the window itself is
1375
+ * focused; either condition failing (focus moving elsewhere, or the window
1376
+ * losing focus) hides the blinking caret while leaving the logical selection
1377
+ * and caret geometry intact.
1378
+ */
1379
+ private _setupFocusTracking;
1380
+ private _setupCaretScrollPadding;
1381
+ /**
1382
+ * Renders the locked/rich/source editing mode toggle. When locked every block stays
1383
+ * in its clean rendered form (no markdown markers revealed) and edits are
1384
+ * ignored, while text selection still works. The control lives in a
1385
+ * zero-height sticky host, using the right margin when it fits and
1386
+ * overlapping content when narrow, without changing the document's geometry.
1387
+ * The current mode is also mirrored onto the root as `.md-readonly`
1388
+ * for any CSS hooks.
1389
+ */
1390
+ private _setupReadonlyToggle;
1391
+ /** Draws attention to the mode toggle after text input is attempted while locked. */
1392
+ showReadonlyEditingAttempt(): void;
693
1393
  focus(): void;
1394
+ mountOverlay(element: HTMLElement | SVGSVGElement, position: EditorOverlayPosition): IDisposable;
1395
+ /** Registers floating editor chrome that should count as covering a range during reveal. */
1396
+ registerRevealOcclusion(element: Element): IDisposable;
1397
+ /**
1398
+ * Temporarily detaches the root {@link EditContext} while focus is inside
1399
+ * nested editor chrome. Chromium otherwise reclaims focus from non-text
1400
+ * controls inside the EditContext host, breaking keyboard access to controls
1401
+ * such as the find actions and read-only toggle.
1402
+ */
1403
+ suspendEditContextWhileFocused(element: HTMLElement): IDisposable;
1404
+ revealRangeInCenterIfOutsideViewport(range: OffsetRange, behavior?: ScrollBehavior): IDisposable;
1405
+ /**
1406
+ * Aligns an explicitly navigated range with the top of its nearest vertical
1407
+ * scroll viewport, even when the range is already partially or fully visible.
1408
+ * The alignment leaves {@link TOP_REVEAL_CONTEXT_INSET}px of navigation
1409
+ * context above the range, grown so the range also clears any chrome
1410
+ * registered through {@link registerRevealOcclusion} that covers the top of
1411
+ * that viewport. Outer vertical scrollers and the window keep nearest-edge
1412
+ * behavior so they do not jump, and horizontal scrolling stays nearest-edge.
1413
+ *
1414
+ * Explicit navigation also stops edit-driven caret following, so a later
1415
+ * block resize does not scroll back to where the caret was left behind.
1416
+ * Sticky chrome is remeasured once scrolling completes. User input, a newer
1417
+ * reveal, or disposal cancels that deferred correction.
1418
+ */
1419
+ revealRangeAtTop(range: OffsetRange, behavior?: ScrollBehavior): IDisposable;
1420
+ private _scheduleRangeReveal;
1421
+ private _scheduleTopRangeReveal;
1422
+ /**
1423
+ * Keeps the caret visible after an editor-driven text edit. The reveal is
1424
+ * deferred until the rebuilt document has been laid out and uses nearest-edge
1425
+ * scrolling so ordinary typing only moves the containing viewport as far as
1426
+ * needed. While this mode is active, a later resize of the same active block
1427
+ * also re-reveals the caret (for asynchronous code, math, or diagram layout).
1428
+ */
1429
+ revealCaretAfterEdit(): void;
1430
+ /** Keeps a keyboard-moved caret visible without enabling edit-resize following. */
1431
+ revealCaretAfterKeyboardNavigation(): void;
1432
+ /** Stops edit-driven caret following before pointer-based selection begins. */
1433
+ stopFollowingCaret(): void;
1434
+ /**
1435
+ * Samples the ambient focus state that decides whether taking focus on open
1436
+ * would steal it from an explicit user target: whether the window is focused
1437
+ * and whether focus is still unclaimed (no active element, or the `<body>`
1438
+ * fallback).
1439
+ */
1440
+ private _sampleAutoFocusEnvironment;
1441
+ /**
1442
+ * One-shot guarded focus attempt: focuses the editor only if doing so will
1443
+ * not steal focus from an explicit user target — the window must already be
1444
+ * focused and no other element may have claimed focus yet. Returns whether
1445
+ * focus was taken. A no-op for a background window or when the user has
1446
+ * already focused something else. {@link autoFocusOnOpen} builds the
1447
+ * open-time behavior on top of this primitive.
1448
+ */
1449
+ tryAutoFocus(): boolean;
1450
+ /**
1451
+ * Focuses the editor when it opens without ever stealing focus from an
1452
+ * explicit user target. Tries once immediately; if the window is not focused
1453
+ * yet — a common open-time race where the editor is mounted before the host
1454
+ * routes focus to its window — the guarded attempt is deferred to the next
1455
+ * time the window gains focus and re-evaluated then. The deferral is
1456
+ * one-shot, so a later, unrelated window refocus never grabs focus, and the
1457
+ * re-check still respects any target the user has claimed in the meantime.
1458
+ */
1459
+ autoFocusOnOpen(): void;
694
1460
  /**
695
1461
  * Client coordinates → absolute source offset (any block). Used during
696
1462
  * drag to keep extending the selection even when the pointer leaves the
697
- * original block.
1463
+ * original block. Snaps to the nearest visual line and source offset.
698
1464
  */
699
1465
  resolveOffsetFromPoint(point: Point2D): SourceOffset | undefined;
1466
+ resolveCursorPositionFromPoint(point: Point2D): SourceCursorPosition | undefined;
1467
+ private _resolveControlFreeVideoOffset;
1468
+ /**
1469
+ * Resolve table-cell hits that have no measurable text run. Empty cells map
1470
+ * from their own box instead of snapping to a neighboring cell; element-only
1471
+ * content (for example an inactive image) maps through the hit element's view
1472
+ * node. Text-bearing cells keep the normal pixel-precise line-map path.
1473
+ */
1474
+ private _resolveTableCellOffset;
700
1475
  /**
701
1476
  * Whether a client point falls on the rendered document content, as
702
1477
  * opposed to the surrounding editor padding (the green area). Uses DOM
@@ -706,6 +1481,14 @@ export declare class EditorView extends Disposable {
706
1481
  * have `pointer-events: none`, so the hit-test sees through them.
707
1482
  */
708
1483
  isPointInContent(point: Point2D): boolean;
1484
+ /**
1485
+ * Whether `range` intersects the rendered source text — the region whose
1486
+ * selection this editor paints itself from `model.selection`. This also
1487
+ * catches select-all ranges whose endpoints surround the rendered content.
1488
+ * Overlays anchored beside the text (comment widgets and the like) are *not*
1489
+ * part of it and keep their own native selection behaviour.
1490
+ */
1491
+ intersectsRenderedContent(range: Range): boolean;
709
1492
  private readonly _renderAutorun;
710
1493
  /** Current mounted blocks, or empty before the first render. */
711
1494
  private get _blocks();
@@ -715,9 +1498,55 @@ export declare class EditorView extends Disposable {
715
1498
  * is not read here, so there is no feedback loop into the render autorun.
716
1499
  */
717
1500
  private _publishMeasurements;
1501
+ /**
1502
+ * Paint the diff highlights via the CSS Custom Highlight API: green over the
1503
+ * inserted/changed modified ranges (mapped on the document's own DOM), and
1504
+ * red over each {@link DiffDecorationViewNode}'s deleted ranges (mapped on
1505
+ * the decoration's own subtree). No DOM is mutated, so reconciliation and
1506
+ * editing are unaffected.
1507
+ */
1508
+ private _paintDiff;
1509
+ private _clearDiff;
1510
+ private _syncEditContextAttachment;
1511
+ private _revealRange;
1512
+ private _revealTarget;
1513
+ private _scheduleCaretReveal;
1514
+ private _revealCaretNearest;
1515
+ private _revealCaretAfterActiveBlockResize;
1516
+ private _caretBlockAt;
1517
+ private _measurementAt;
1518
+ private _stopFollowingCaret;
1519
+ private _isRevealOccluded;
1520
+ /** Client rects of registered occlusions that are currently rendered and visible. */
1521
+ private _activeRevealOcclusions;
1522
+ /**
1523
+ * How far registered chrome covers the top of `viewport`, measured down from
1524
+ * `viewport.top`, across the columns `target` occupies. Clearing one occluder
1525
+ * can slide the target behind the next one, so the tested band is re-evaluated
1526
+ * until it settles; stacked chrome therefore reports the lowest connected
1527
+ * bottom edge. Returns 0 when nothing covers the top.
1528
+ */
1529
+ private _occludedTopHeight;
1530
+ /**
1531
+ * Vertical inset used to top-align `target` inside `viewport`. Defaults to
1532
+ * {@link TOP_REVEAL_CONTEXT_INSET}, and grows past registered chrome covering
1533
+ * the viewport top so the same breathing room is kept below that chrome.
1534
+ */
1535
+ private _topRevealInset;
1536
+ /**
1537
+ * `viewport` reduced to the area an explicitly navigated target may occupy:
1538
+ * registered top chrome is excluded, along with the breathing room below it.
1539
+ * Nearest-edge movement parks the target just inside the rect it is given, so
1540
+ * the inset has to be part of that rect; otherwise an outer scroller, or the
1541
+ * window, would leave the target grazing the chrome's bottom edge after the
1542
+ * nearest vertical viewport had already aligned it.
1543
+ */
1544
+ private _unoccludedViewport;
718
1545
  }
719
1546
 
720
1547
  export declare interface EditorViewOptions extends BlockViewOptions {
1548
+ readonly presentation?: EditorPresentation;
1549
+ readonly textInput?: EditorTextInput;
721
1550
  /**
722
1551
  * Extra class names added to the editor root element, e.g. a theme class
723
1552
  * such as `'md-theme-default'` or `'github-markdown-theme'`. Theme styles
@@ -725,6 +1554,14 @@ export declare interface EditorViewOptions extends BlockViewOptions {
725
1554
  * only) unless a theme class is supplied.
726
1555
  */
727
1556
  readonly classNames?: readonly string[];
1557
+ /**
1558
+ * Whether to render the edit/read-only toggle at the top-right edge
1559
+ * of the content. Defaults to `true`; set to `false` to omit it (e.g. in
1560
+ * fixtures that focus on selection rendering).
1561
+ */
1562
+ readonly showReadonlyToggle?: boolean;
1563
+ /** Whether to paint the active block's background and glow. Defaults to `true`. */
1564
+ readonly highlightActiveBlock?: boolean;
728
1565
  /**
729
1566
  * Controls "limited width mode". The observable yields the maximum content
730
1567
  * width in pixels, or `undefined` to let the content fill the available
@@ -735,14 +1572,22 @@ export declare interface EditorViewOptions extends BlockViewOptions {
735
1572
  * root ({@link element}) always spans the full available width.
736
1573
  */
737
1574
  readonly limitedWidth?: IObservable<number | undefined>;
1575
+ /**
1576
+ * Diff mode only: render every read-only original decoration in active
1577
+ * (source) form, so even whole-block removals expose their markdown markers
1578
+ * as real text. Used by the diff-coverage fixture to verify that every
1579
+ * changed original character is rendered somewhere; off in normal use, where
1580
+ * whole removals show a clean solid band.
1581
+ */
1582
+ readonly diffDecorationsActive?: boolean;
738
1583
  }
739
1584
 
740
1585
  export declare class EmphasisAstNode extends AstNode {
741
1586
  readonly openMarker: MarkerAstNode;
742
- readonly content: readonly (InlineAstNode | GlueAstNode)[];
1587
+ readonly content: readonly InlineContentAstNode[];
743
1588
  readonly closeMarker: MarkerAstNode;
744
1589
  readonly kind = "emphasis";
745
- constructor(openMarker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], closeMarker: MarkerAstNode);
1590
+ constructor(openMarker: MarkerAstNode, content: readonly InlineContentAstNode[], closeMarker: MarkerAstNode);
746
1591
  get children(): readonly AstNode[];
747
1592
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
748
1593
  }
@@ -754,6 +1599,129 @@ declare class EmphasisViewData {
754
1599
  constructor(ast: EmphasisAstNode, content: readonly AnyViewData[]);
755
1600
  }
756
1601
 
1602
+ /** One blank source line, or the empty final line after a terminating newline. */
1603
+ export declare class EmptyBlockAstNode extends BlockAstNodeBase {
1604
+ readonly content: readonly GlueAstNode[];
1605
+ readonly leadingTrivia?: GlueAstNode | undefined;
1606
+ readonly kind = "emptyBlock";
1607
+ constructor(content: readonly GlueAstNode[], leadingTrivia?: GlueAstNode | undefined);
1608
+ get children(): readonly AstNode[];
1609
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
1610
+ withLeadingTrivia(trivia: GlueAstNode | undefined): EmptyBlockAstNode;
1611
+ }
1612
+
1613
+ declare class EmptyBlockViewData {
1614
+ readonly ast: EmptyBlockAstNode;
1615
+ readonly content: readonly AnyViewData[];
1616
+ readonly kind = "emptyBlock";
1617
+ constructor(ast: EmptyBlockAstNode, content: readonly AnyViewData[]);
1618
+ }
1619
+
1620
+ export declare function escapeFindRegex(value: string): string;
1621
+
1622
+ export declare const FIND_MATCH_LIMIT = 19999;
1623
+
1624
+ export declare function findBlockAtOffset(doc: DocumentAstNode, offset: SourceOffset): BlockAstNode | undefined;
1625
+
1626
+ export declare class FindController extends Disposable {
1627
+ private readonly _editorModel;
1628
+ private readonly _view;
1629
+ private readonly _options;
1630
+ readonly model: FindModel;
1631
+ readonly widget: FindWidget;
1632
+ private readonly _selectionForScope;
1633
+ private _forcedMatch;
1634
+ private _selectedMatch;
1635
+ private _observedSourceTextId;
1636
+ private readonly _sourceEditTracker;
1637
+ private _revealRequest;
1638
+ constructor(_editorModel: EditorModel, _view: EditorView, _options: FindControllerOptions);
1639
+ private _setForcedMarkerVisibleBlocks;
1640
+ openAndFocus(): void;
1641
+ close(): void;
1642
+ private _handleKeyDown;
1643
+ private _cancelRevealRequest;
1644
+ private _findByKeyboard;
1645
+ private _querySeed;
1646
+ private _prepareSeed;
1647
+ private _selectedSingleLineText;
1648
+ private _toggleFindInSelection;
1649
+ }
1650
+
1651
+ export declare interface FindControllerOptions {
1652
+ readonly keyboardPlatform: KeyboardPlatform;
1653
+ }
1654
+
1655
+ export declare type FindDirection = 'next' | 'previous';
1656
+
1657
+ export declare class FindHighlightsView extends Disposable {
1658
+ private readonly _view;
1659
+ private readonly _matchesLayer;
1660
+ private readonly _currentLayer;
1661
+ private readonly _highlightRegistration;
1662
+ private readonly _resizeObserver;
1663
+ private readonly _resizeObservedElements;
1664
+ private _snapshot;
1665
+ private _paintRaf;
1666
+ constructor(_view: EditorView, findModel: FindModel);
1667
+ private _schedulePaint;
1668
+ private _paint;
1669
+ private _observeResizeAncestors;
1670
+ private _paintRanges;
1671
+ }
1672
+
1673
+ export declare interface FindMatchesResult {
1674
+ readonly matches: readonly OffsetRange[];
1675
+ readonly isCapped: boolean;
1676
+ }
1677
+
1678
+ export declare class FindModel extends Disposable {
1679
+ private readonly _editorModel;
1680
+ readonly isRevealed: ISettableObservable<boolean, void>;
1681
+ readonly searchString: ISettableObservable<string, void>;
1682
+ readonly isRegex: ISettableObservable<boolean, void>;
1683
+ readonly matchCase: ISettableObservable<boolean, void>;
1684
+ readonly wholeWord: ISettableObservable<boolean, void>;
1685
+ readonly searchScope: ISettableObservable<OffsetRange | undefined, void>;
1686
+ readonly currentMatch: ISettableObservable<OffsetRange | undefined, void>;
1687
+ readonly loop: ISettableObservable<boolean, void>;
1688
+ readonly searchResult: IObservableWithChange< {
1689
+ kind: "invalid";
1690
+ error: Error;
1691
+ pattern?: undefined;
1692
+ matches?: undefined;
1693
+ isCapped?: undefined;
1694
+ } | {
1695
+ kind: "valid";
1696
+ pattern: FindPattern;
1697
+ matches: readonly OffsetRange[];
1698
+ isCapped: boolean;
1699
+ error?: undefined;
1700
+ }, void>;
1701
+ readonly matchesCount: IObservableWithChange<number, void>;
1702
+ readonly isCapped: IObservableWithChange<boolean, void>;
1703
+ readonly currentMatchPosition: IObservableWithChange<number, void>;
1704
+ private _searchOrigin;
1705
+ private readonly _sourceEditTracker;
1706
+ private _pendingInitialDirection;
1707
+ constructor(_editorModel: EditorModel);
1708
+ reveal(options: {
1709
+ readonly origin: number;
1710
+ readonly searchString?: string;
1711
+ readonly direction?: FindDirection;
1712
+ }): void;
1713
+ hide(): void;
1714
+ setSearchOrigin(offset: number): void;
1715
+ setSearchScope(scope: OffsetRange | undefined): void;
1716
+ moveToNextMatch(): OffsetRange | undefined;
1717
+ moveToPreviousMatch(): OffsetRange | undefined;
1718
+ private _move;
1719
+ private _selectFromOrigin;
1720
+ private _mapStateThroughEdit;
1721
+ private _inputSnapshot;
1722
+ private _readInputSnapshot;
1723
+ }
1724
+
757
1725
  /**
758
1726
  * Source offset (relative to `root`) of the node with `target`'s id, or
759
1727
  * `undefined` when it is not in the tree. Ids are stable across edits, so this
@@ -761,14 +1729,117 @@ declare class EmphasisViewData {
761
1729
  */
762
1730
  export declare function findNodeOffsetById(root: AstNode, target: AstNode): number | undefined;
763
1731
 
764
- export declare function findWordAt(text: string, offset: number): {
1732
+ export declare class FindPattern {
1733
+ private readonly _source;
1734
+ private readonly _flags;
1735
+ private readonly _wholeWord;
1736
+ private readonly _wordSeparators;
1737
+ readonly isEmpty: boolean;
1738
+ private constructor();
1739
+ static create(query: FindQuery): FindQueryResult;
1740
+ findMatches(text: string, scope?: OffsetRange, limit?: number): FindMatchesResult;
1741
+ findNextMatch(text: string, after: number, scope?: OffsetRange, loop?: boolean, skip?: OffsetRange): OffsetRange | undefined;
1742
+ findPreviousMatch(text: string, before: number, scope?: OffsetRange, loop?: boolean, skip?: OffsetRange): OffsetRange | undefined;
1743
+ private _forEachMatch;
1744
+ }
1745
+
1746
+ export declare interface FindQuery {
1747
+ readonly searchString: string;
1748
+ readonly isRegex: boolean;
1749
+ readonly matchCase: boolean;
1750
+ readonly wholeWord: boolean;
1751
+ readonly wordSeparators: string;
1752
+ }
1753
+
1754
+ export declare type FindQueryResult = {
1755
+ readonly kind: 'valid';
1756
+ readonly pattern: FindPattern;
1757
+ } | {
1758
+ readonly kind: 'invalid';
1759
+ readonly error: Error;
1760
+ };
1761
+
1762
+ export declare type FindSearchResult = {
1763
+ readonly kind: 'valid';
1764
+ readonly pattern: FindPattern;
1765
+ readonly matches: readonly OffsetRange[];
1766
+ readonly isCapped: boolean;
1767
+ } | {
1768
+ readonly kind: 'invalid';
1769
+ readonly error: Error;
1770
+ };
1771
+
1772
+ export declare class FindWidget extends Disposable {
1773
+ private readonly _view;
1774
+ private readonly _options;
1775
+ readonly element: HTMLElement;
1776
+ readonly panelElement: HTMLElement;
1777
+ readonly focused: ISettableObservable<boolean, void>;
1778
+ private readonly _inputShell;
1779
+ private readonly _input;
1780
+ private readonly _matchesCount;
1781
+ private readonly _previousButton;
1782
+ private readonly _nextButton;
1783
+ private readonly _selectionButton;
1784
+ private readonly _caseButton;
1785
+ private readonly _wholeWordButton;
1786
+ private readonly _regexButton;
1787
+ private readonly _error;
1788
+ constructor(_view: EditorView, _options: FindWidgetOptions);
1789
+ focusAndSelect(): void;
1790
+ private _registerButton;
1791
+ private _render;
1792
+ }
1793
+
1794
+ export declare interface FindWidgetOptions {
1795
+ readonly findModel: FindModel;
1796
+ readonly canFindInSelection: IObservable<boolean>;
1797
+ readonly onNext: () => void;
1798
+ readonly onPrevious: () => void;
1799
+ readonly onToggleFindInSelection: () => void;
1800
+ readonly onClose: () => void;
1801
+ }
1802
+
1803
+ export declare function findWordAt(text: string, offset: number, config?: WordNavigationConfig): {
765
1804
  start: number;
766
1805
  end: number;
767
1806
  };
768
1807
 
769
- export declare function findWordBoundaryLeft(text: string, offset: number): number;
1808
+ export declare function findWordBoundaryLeft(text: string, offset: number, config?: WordNavigationConfig): number;
1809
+
1810
+ export declare function findWordBoundaryRight(text: string, offset: number, config?: WordNavigationConfig): number;
1811
+
1812
+ export declare function findWordDeleteBoundaryLeft(text: string, offset: number, config?: WordNavigationConfig): number;
1813
+
1814
+ export declare function findWordDeleteBoundaryRight(text: string, offset: number, config?: WordNavigationConfig): number;
1815
+
1816
+ /**
1817
+ * A leading YAML front matter block. The YAML value is intentionally opaque:
1818
+ * only the two fences and the exact source between them are modeled.
1819
+ */
1820
+ export declare class FrontMatterAstNode extends BlockAstNodeBase {
1821
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
1822
+ readonly leadingTrivia?: GlueAstNode | undefined;
1823
+ readonly kind = "frontMatter";
1824
+ constructor(content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
1825
+ get children(): readonly AstNode[];
1826
+ get openFence(): MarkerAstNode | undefined;
1827
+ get closeFence(): MarkerAstNode | undefined;
1828
+ get value(): MarkerAstNode | undefined;
1829
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
1830
+ withLeadingTrivia(trivia: GlueAstNode | undefined): FrontMatterAstNode;
1831
+ }
770
1832
 
771
- export declare function findWordBoundaryRight(text: string, offset: number): number;
1833
+ declare class FrontMatterViewData {
1834
+ readonly ast: FrontMatterAstNode;
1835
+ /** Active: render both fences; inactive: render only the opaque YAML value. */
1836
+ readonly showMarkup: boolean;
1837
+ readonly content: readonly AnyViewData[];
1838
+ readonly kind = "frontMatter";
1839
+ constructor(ast: FrontMatterAstNode,
1840
+ /** Active: render both fences; inactive: render only the opaque YAML value. */
1841
+ showMarkup: boolean, content: readonly AnyViewData[]);
1842
+ }
772
1843
 
773
1844
  export declare function getAnnotatedSource(node: AstNode, source: string, offset?: number): string;
774
1845
 
@@ -791,6 +1862,8 @@ declare class GlueViewData {
791
1862
  * block children) the break is already visible, so no `↵` is drawn.
792
1863
  */
793
1864
  readonly decorateNewline: boolean;
1865
+ readonly showWhitespace: boolean;
1866
+ readonly listContinuation?: ListContinuation | undefined;
794
1867
  readonly kind = "glue";
795
1868
  constructor(ast: GlueAstNode, visible: boolean,
796
1869
  /**
@@ -799,7 +1872,7 @@ declare class GlueViewData {
799
1872
  * the line ending hiding there; between block-level siblings (list items,
800
1873
  * block children) the break is already visible, so no `↵` is drawn.
801
1874
  */
802
- decorateNewline: boolean);
1875
+ decorateNewline: boolean, showWhitespace?: boolean, listContinuation?: ListContinuation | undefined);
803
1876
  }
804
1877
 
805
1878
  /**
@@ -828,10 +1901,10 @@ export declare type GutterMarkerType = 'added' | 'modified' | 'deleted';
828
1901
  export declare class HeadingAstNode extends BlockAstNodeBase {
829
1902
  readonly level: 1 | 2 | 3 | 4 | 5 | 6;
830
1903
  readonly marker: MarkerAstNode;
831
- readonly content: readonly (InlineAstNode | GlueAstNode)[];
1904
+ readonly content: readonly InlineContentAstNode[];
832
1905
  readonly leadingTrivia?: GlueAstNode | undefined;
833
1906
  readonly kind = "heading";
834
- constructor(level: 1 | 2 | 3 | 4 | 5 | 6, marker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
1907
+ constructor(level: 1 | 2 | 3 | 4 | 5 | 6, marker: MarkerAstNode, content: readonly InlineContentAstNode[], leadingTrivia?: GlueAstNode | undefined);
835
1908
  get children(): readonly AstNode[];
836
1909
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
837
1910
  withLeadingTrivia(trivia: GlueAstNode | undefined): HeadingAstNode;
@@ -845,6 +1918,19 @@ declare class HeadingViewData {
845
1918
  constructor(ast: HeadingAstNode, content: readonly AnyViewData[]);
846
1919
  }
847
1920
 
1921
+ export declare function hiddenCursorRanges(doc: DocumentAstNode, markerVisibleBlocks: ReadonlySet<BlockAstNode>, selectionRange: OffsetRange): readonly OffsetRange[];
1922
+
1923
+ export declare type HistoryKeyboardAction = 'undo' | 'redo';
1924
+
1925
+ /** A block HTML comment, discriminated by whether its closing delimiter is present. */
1926
+ declare type HtmlCommentSource = OpenHtmlCommentSource | CompleteHtmlCommentSource;
1927
+
1928
+ declare interface HtmlCommentSourceBase {
1929
+ readonly leadingWhitespace: string;
1930
+ readonly opening: '<!--';
1931
+ readonly body: string;
1932
+ }
1933
+
848
1934
  /**
849
1935
  * The editor operations a clipboard strategy drives. The strategy never
850
1936
  * touches the model or the DOM directly — it asks through this seam, so the
@@ -857,8 +1943,8 @@ export declare interface IClipboardContext {
857
1943
  getSelectedText(): string | undefined;
858
1944
  /** Delete the current selection (the cut half of cut). */
859
1945
  deleteSelection(): void;
860
- /** Insert text at the caret, replacing any selection (the paste action). */
861
- insertText(text: string): void;
1946
+ /** Paste text, linking a suitable selection when the payload is a URL unless plain text was requested. */
1947
+ insertText(text: string, plainText?: boolean): void;
862
1948
  }
863
1949
 
864
1950
  /**
@@ -874,6 +1960,8 @@ export declare interface IClipboardContext {
874
1960
  * swallow the native clipboard events before they reach the editor.
875
1961
  */
876
1962
  export declare interface IClipboardStrategy {
1963
+ /** Copy an explicit payload without changing the editor selection. Falls back to the browser API when omitted. */
1964
+ writeText?(text: string): Promise<void>;
877
1965
  /**
878
1966
  * Wire up clipboard handling against `context`. The returned disposable
879
1967
  * tears down every listener the strategy installed.
@@ -890,6 +1978,87 @@ export declare interface IDefaultMonarchGrammars {
890
1978
  python: unknown;
891
1979
  rust: unknown;
892
1980
  shell: unknown;
1981
+ yaml: unknown;
1982
+ }
1983
+
1984
+ /**
1985
+ * A live editor embedded in place of a fenced code block's *rendered* form.
1986
+ *
1987
+ * This is the internal seam between the block view and a concrete embedded
1988
+ * editor (e.g. an `<iframe>` speaking the web-editor protocol). The block view
1989
+ * only speaks string edits: it pushes the block's content down via
1990
+ * {@link setContent} and receives the editor's own changes back through
1991
+ * {@link onEdit} (set by the block view on each (re)construction, so it always
1992
+ * routes to the current AST node). The concrete implementation owns its DOM,
1993
+ * transport, and lifecycle.
1994
+ *
1995
+ * A single instance is adopted across re-renders (like the highlighter session)
1996
+ * so the underlying editor keeps its state across edits — see
1997
+ * {@link CodeBlockViewNode}.
1998
+ */
1999
+ declare interface IEmbeddedCodeEditor {
2000
+ /** The element mounted as the block's rendered form. */
2001
+ readonly element: HTMLElement;
2002
+ /**
2003
+ * Document → editor. The block's content changed (from any source). Must be
2004
+ * idempotent: pushing the content the editor already holds is a no-op, which
2005
+ * is how edits the editor itself originated are prevented from echoing back.
2006
+ */
2007
+ setContent(content: string): void;
2008
+ /** Update whether the embedded editor may change its content. */
2009
+ setReadOnly?(readOnly: boolean): void;
2010
+ /**
2011
+ * Optional synchronous height (px) to reserve for `content` *before* the
2012
+ * editor has laid out. Return `undefined` to let the editor size itself
2013
+ * (the implementation may report its real height later). Lets a registration
2014
+ * avoid a layout jump when it can cheaply estimate the size from content.
2015
+ */
2016
+ estimateHeight?(content: string): number | undefined;
2017
+ /**
2018
+ * Editor → document. Set by the block view on every (re)construction to
2019
+ * route the editor's own edits, expressed in the block's *content*
2020
+ * coordinates, to the current AST node.
2021
+ */
2022
+ onEdit?: (edit: StringEdit) => void;
2023
+ dispose(): void;
2024
+ }
2025
+
2026
+ /** Creates an {@link IEmbeddedCodeEditor} for a fenced block, or opts out. */
2027
+ declare interface IEmbeddedCodeEditorFactory {
2028
+ /**
2029
+ * Return an editor for a fenced block, or `undefined` to fall
2030
+ * back to the default (highlighting / {@link BlockViewOptions.renderCustomCodeBlock}).
2031
+ */
2032
+ create(language: string, infoString: string, initialContent: string): IEmbeddedCodeEditor | undefined;
2033
+ }
2034
+
2035
+ /**
2036
+ * Routes undo and redo to whatever owns the document's history: the editor
2037
+ * itself on a standalone page, or the enclosing document in a host like
2038
+ * VS Code.
2039
+ */
2040
+ export declare interface IHistoryStrategy {
2041
+ undo(): void;
2042
+ redo(): void;
2043
+ /**
2044
+ * Invoked around each source mutation so the strategy can record it.
2045
+ * Implemented only by strategies that build their own history; a host that
2046
+ * forwards edits to a VS Code `TextDocument` lets it record them instead.
2047
+ */
2048
+ record?(operation: () => void, edit?: StringEdit): void;
2049
+ }
2050
+
2051
+ export declare interface ILinkPresentation extends IDisposable {
2052
+ /** Current presentation, updated without rebuilding the editor. */
2053
+ readonly presentation: IObservable<LinkPresentation | undefined>;
2054
+ }
2055
+
2056
+ export declare interface ILinkPresentationProvider {
2057
+ /**
2058
+ * Returns `undefined` for unsupported links. The caller disposes the returned
2059
+ * reference when the rendered link disappears.
2060
+ */
2061
+ createLinkPresentation(url: string): ILinkPresentation | undefined;
893
2062
  }
894
2063
 
895
2064
  export declare class ImageAstNode extends AstNode {
@@ -926,6 +2095,14 @@ export declare interface IMonarchApi {
926
2095
  MonarchTokenizer: new (languageService: unknown, standaloneThemeService: unknown, languageId: string, lexer: unknown, configurationService: unknown) => MonarchTokenizer;
927
2096
  }
928
2097
 
2098
+ /** Controls tab-stop insertion and non-list line indentation. */
2099
+ export declare interface IndentationConfig {
2100
+ /** Number of visual columns between tab stops. */
2101
+ readonly tabSize: number;
2102
+ /** Whether indentation uses spaces instead of tab characters. */
2103
+ readonly insertSpaces: boolean;
2104
+ }
2105
+
929
2106
  export declare type InlineAstNode = TextAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode;
930
2107
 
931
2108
  export declare class InlineCodeAstNode extends AstNode {
@@ -943,6 +2120,8 @@ declare class InlineCodeViewData {
943
2120
  constructor(ast: InlineCodeAstNode, content: readonly AnyViewData[]);
944
2121
  }
945
2122
 
2123
+ declare type InlineContentAstNode = InlineAstNode | MarkerAstNode | GlueAstNode;
2124
+
946
2125
  export declare class InlineMathAstNode extends AstNode {
947
2126
  readonly content: readonly (MarkerAstNode | GlueAstNode)[];
948
2127
  readonly kind = "inlineMath";
@@ -980,17 +2159,29 @@ export declare const insertParagraph: EditCommand;
980
2159
  * - paragraph / heading / thematic break — the "rich text" thing: at the
981
2160
  * block's end arm a transient empty paragraph (see {@link SmartEnterResult});
982
2161
  * elsewhere split into two paragraphs (`\n\n`).
983
- * - code block — insert a newline that preserves the current line's indentation,
984
- * staying inside the fence.
2162
+ * - fenced code / front matter — insert a newline that preserves the current
2163
+ * line's indentation, staying inside the fences.
2164
+ * - video — leave the completed HTML block at its end; otherwise insert a
2165
+ * normal source line break.
985
2166
  * - block quote — continue the quote (`\n> `); an empty quote line exits it.
986
2167
  * - list — continue the list with the next marker (incrementing ordered
987
- * numbers, re-emitting task checkboxes); an empty item exits the list.
2168
+ * numbers, re-emitting task checkboxes); an empty item outdents one level
2169
+ * before exiting the list.
2170
+ * - complete HTML comment — at the comment's end, leave it by arming a
2171
+ * transient paragraph; inside it (or while the comment is open), insert a
2172
+ * normal source line break.
988
2173
  * A non-collapsed selection, or any other block, falls back to a plain soft line
989
2174
  * break, preserving today's behaviour.
990
2175
  */
991
- export declare const insertSmartEnter: (ctx: CursorCommandContext) => SmartEnterResult;
2176
+ export declare const insertSmartEnter: (ctx: CursorCommandContext, useSourceLineBreaks?: boolean) => SmartEnterResult;
992
2177
 
993
- export declare function insertText(text: string): EditCommand;
2178
+ /**
2179
+ * VS Code-style Tab: insert to the next tab stop for a caret or partial
2180
+ * single-line selection, and indent every selected line for a line selection.
2181
+ */
2182
+ export declare function insertTab(config?: IndentationConfig): EditCommand;
2183
+
2184
+ export declare function insertText(text: string, generatedIndentation?: OffsetRange, completeFences?: boolean): EditCommand;
994
2185
 
995
2186
  /**
996
2187
  * An immutable view of one document's tokens at a point in time. It may be a
@@ -1031,6 +2222,31 @@ export declare interface ISyntaxHighlighterDocument extends IDisposable {
1031
2222
  readonly snapshot: IObservableWithChange<ISyntaxHighlightedSnapshot, LengthEdit>;
1032
2223
  }
1033
2224
 
2225
+ export declare const joinLines: EditCommand;
2226
+
2227
+ export declare interface KeyboardBinding {
2228
+ readonly key: string;
2229
+ readonly modifiers?: KeyboardModifiers;
2230
+ readonly platforms?: readonly KeyboardPlatform[];
2231
+ readonly action: EditorKeyboardAction;
2232
+ }
2233
+
2234
+ export declare interface KeyboardModifiers {
2235
+ readonly shift?: boolean;
2236
+ readonly alt?: boolean;
2237
+ readonly ctrl?: boolean;
2238
+ readonly meta?: boolean;
2239
+ }
2240
+
2241
+ export declare type KeyboardPlatform = 'macos' | 'windows' | 'linux';
2242
+
2243
+ export declare interface KeyboardProfile {
2244
+ /**
2245
+ * Bindings in priority order. The first exact key/modifier/platform match wins.
2246
+ */
2247
+ readonly bindings: readonly KeyboardBinding[];
2248
+ }
2249
+
1034
2250
  declare abstract class LeafAstNode extends AstNode {
1035
2251
  abstract readonly content: string;
1036
2252
  get children(): readonly AstNode[];
@@ -1079,27 +2295,63 @@ export declare class LengthReplacement {
1079
2295
 
1080
2296
  export declare class LinkAstNode extends AstNode {
1081
2297
  readonly url: string;
1082
- readonly content: readonly (MarkerAstNode | InlineAstNode | GlueAstNode)[];
2298
+ readonly content: readonly InlineContentAstNode[];
1083
2299
  readonly kind = "link";
1084
- constructor(url: string, content: readonly (MarkerAstNode | InlineAstNode | GlueAstNode)[]);
2300
+ constructor(url: string, content: readonly InlineContentAstNode[]);
1085
2301
  get children(): readonly AstNode[];
1086
2302
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
1087
2303
  protected _localEquals(o: this): boolean;
1088
2304
  }
1089
2305
 
2306
+ /**
2307
+ * Declarative rendering data for one link. `kind` selects the package-owned
2308
+ * visual treatment; providers never supply DOM or CSS.
2309
+ */
2310
+ export declare interface LinkPresentation {
2311
+ readonly kind: LinkPresentationKind;
2312
+ readonly title?: string;
2313
+ readonly detail?: string;
2314
+ readonly reference?: string;
2315
+ /** Primary resource state, such as pull-request lifecycle or session state. */
2316
+ readonly status?: LinkPresentationStatus;
2317
+ /** Secondary state, such as pull-request CI status. */
2318
+ readonly secondaryStatus?: LinkPresentationStatus;
2319
+ readonly changes?: LinkPresentationChanges;
2320
+ readonly tooltip?: string;
2321
+ readonly ariaLabel?: string;
2322
+ }
2323
+
2324
+ declare interface LinkPresentationChanges {
2325
+ readonly insertions: number;
2326
+ readonly deletions: number;
2327
+ }
2328
+
2329
+ export declare type LinkPresentationKind = 'resource' | 'issue' | 'pullRequest' | 'commit' | 'file' | 'folder' | 'session' | 'repository' | 'branch';
2330
+
2331
+ export declare interface LinkPresentationStatus {
2332
+ readonly kind: LinkPresentationStatusKind;
2333
+ readonly label: string;
2334
+ }
2335
+
2336
+ export declare type LinkPresentationStatusKind = 'neutral' | 'pending' | 'success' | 'warning' | 'error' | 'open' | 'closed' | 'merged' | 'draft' | 'notPlanned';
2337
+
1090
2338
  declare class LinkViewData {
1091
2339
  readonly ast: LinkAstNode;
2340
+ /** Active: render the Markdown source; inactive: allow a rich presentation. */
2341
+ readonly showMarkup: boolean;
1092
2342
  readonly content: readonly AnyViewData[];
1093
2343
  readonly kind = "link";
1094
- constructor(ast: LinkAstNode, content: readonly AnyViewData[]);
2344
+ constructor(ast: LinkAstNode,
2345
+ /** Active: render the Markdown source; inactive: allow a rich presentation. */
2346
+ showMarkup: boolean, content: readonly AnyViewData[]);
1095
2347
  }
1096
2348
 
1097
2349
  export declare class ListAstNode extends BlockAstNodeBase {
1098
2350
  readonly ordered: boolean;
1099
- readonly content: readonly (ListItemAstNode | GlueAstNode)[];
2351
+ readonly content: readonly (ListItemAstNode | EmptyBlockAstNode | GlueAstNode)[];
1100
2352
  readonly leadingTrivia?: GlueAstNode | undefined;
1101
2353
  readonly kind = "list";
1102
- constructor(ordered: boolean, content: readonly (ListItemAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
2354
+ constructor(ordered: boolean, content: readonly (ListItemAstNode | EmptyBlockAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
1103
2355
  get children(): readonly AstNode[];
1104
2356
  get items(): readonly ListItemAstNode[];
1105
2357
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
@@ -1107,6 +2359,14 @@ export declare class ListAstNode extends BlockAstNodeBase {
1107
2359
  protected _localEquals(o: this): boolean;
1108
2360
  }
1109
2361
 
2362
+ declare interface ListContinuation {
2363
+ readonly item: ListItemAstNode;
2364
+ readonly level: number;
2365
+ readonly indentation: number;
2366
+ readonly mixedTasks: boolean;
2367
+ readonly outsideList: boolean;
2368
+ }
2369
+
1110
2370
  export declare class ListItemAstNode extends AstNode {
1111
2371
  readonly marker: MarkerAstNode;
1112
2372
  readonly content: readonly (BlockAstNode | GlueAstNode)[];
@@ -1116,6 +2376,7 @@ export declare class ListItemAstNode extends AstNode {
1116
2376
  constructor(marker: MarkerAstNode, content: readonly (BlockAstNode | GlueAstNode)[], checked?: boolean | undefined, leadingTrivia?: GlueAstNode | undefined);
1117
2377
  get children(): readonly AstNode[];
1118
2378
  get blocks(): readonly BlockAstNode[];
2379
+ get isIncomplete(): boolean;
1119
2380
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
1120
2381
  withLeadingTrivia(trivia: GlueAstNode | undefined): ListItemAstNode;
1121
2382
  protected _localEquals(o: this): boolean;
@@ -1128,12 +2389,27 @@ declare class ListItemViewData {
1128
2389
  readonly content: readonly AnyViewData[];
1129
2390
  /** 1-based list nesting depth, used to size the indentation gutter. */
1130
2391
  readonly level: number;
2392
+ /**
2393
+ * Whether this is an inactive task item whose first paragraph begins
2394
+ * with the `:running:` marker (see {@link TextViewData.hiddenPrefixLength}).
2395
+ * Always `false` while the item is active — an active/editing task
2396
+ * reveals the literal marker instead of the progress affordance.
2397
+ */
2398
+ readonly isRunning: boolean;
2399
+ readonly sourceIndentation: number;
1131
2400
  readonly kind = "listItem";
1132
2401
  constructor(ast: ListItemAstNode,
1133
2402
  /** Whether the selection reaches this item (reveals its markers). */
1134
2403
  isActive: boolean, content: readonly AnyViewData[],
1135
2404
  /** 1-based list nesting depth, used to size the indentation gutter. */
1136
- level: number);
2405
+ level: number,
2406
+ /**
2407
+ * Whether this is an inactive task item whose first paragraph begins
2408
+ * with the `:running:` marker (see {@link TextViewData.hiddenPrefixLength}).
2409
+ * Always `false` while the item is active — an active/editing task
2410
+ * reveals the literal marker instead of the progress affordance.
2411
+ */
2412
+ isRunning?: boolean, sourceIndentation?: number);
1137
2413
  }
1138
2414
 
1139
2415
  declare class ListViewData {
@@ -1143,6 +2419,41 @@ declare class ListViewData {
1143
2419
  constructor(ast: ListAstNode, content: readonly AnyViewData[]);
1144
2420
  }
1145
2421
 
2422
+ /**
2423
+ * Compact in-memory history for editors that hold the only copy of the
2424
+ * document, such as a standalone browser page. Where the surrounding host
2425
+ * already records history — a VS Code `TextDocument` — forward to that
2426
+ * instead.
2427
+ */
2428
+ export declare class LocalHistoryStrategy implements IHistoryStrategy {
2429
+ private readonly _model;
2430
+ private readonly _past;
2431
+ private readonly _future;
2432
+ /**
2433
+ * The source text as of the last change this strategy recorded or applied.
2434
+ * Any other value means the document was replaced behind its back, so the
2435
+ * stored edits no longer line up and must be discarded rather than applied.
2436
+ */
2437
+ private _lastKnownText;
2438
+ constructor(_model: EditorModel);
2439
+ record(operation: () => void, edit?: StringEdit): void;
2440
+ undo(): void;
2441
+ redo(): void;
2442
+ /** The entry on top of `stack`, or `undefined` when it cannot be applied. */
2443
+ private _peekApplicable;
2444
+ private _apply;
2445
+ private _clear;
2446
+ }
2447
+
2448
+ export declare interface MarkdownParseOptions {
2449
+ readonly explicitBlankLineBlocks?: boolean;
2450
+ readonly explicitFinalEmptyLine?: boolean;
2451
+ readonly preserveTrailingListContinuation?: boolean;
2452
+ readonly allowEmptyListItemInterrupts?: boolean;
2453
+ readonly requireListMarkerWhitespace?: boolean;
2454
+ readonly allowEmptyTaskItems?: boolean;
2455
+ }
2456
+
1146
2457
  /**
1147
2458
  * Parses markdown into a {@link DocumentAstNode}.
1148
2459
  *
@@ -1152,7 +2463,7 @@ declare class ListViewData {
1152
2463
  * blocks keep their incremental highlighting sessions.
1153
2464
  */
1154
2465
  export declare class MarkdownParser {
1155
- parse(text: StringValue, previous?: DocumentAstNode, edit?: StringEdit): DocumentAstNode;
2466
+ parse(text: StringValue, previous?: DocumentAstNode, edit?: StringEdit, options?: MarkdownParseOptions): DocumentAstNode;
1156
2467
  }
1157
2468
 
1158
2469
  /** A semantic syntax marker (heading `#`, fences, brackets, list bullet, …). */
@@ -1249,8 +2560,8 @@ export declare class MeasuredLayoutDebugRendering {
1249
2560
  * Exposes two DOM nodes the caller can place independently:
1250
2561
  *
1251
2562
  * - {@link overlayElement} — absolutely positioned; the caller mounts it
1252
- * inside the editor element so dashed line-bands and run-boxes line up
1253
- * with the editor's client coordinates.
2563
+ * inside the editor overlay container so dashed line-bands and run-boxes
2564
+ * share the measured editor-local coordinates.
1254
2565
  * - {@link infoElement} — block-flow; the caller mounts it as a sibling
1255
2566
  * *below* the editor. Contains the per-block summary table that used
1256
2567
  * to live on the overlay.
@@ -1261,7 +2572,6 @@ export declare class MeasuredLayoutDebugRendering {
1261
2572
  * the derived subscribed.
1262
2573
  */
1263
2574
  export declare class MeasuredLayoutDebugView extends Disposable {
1264
- private readonly _overlayParent;
1265
2575
  readonly overlayElement: HTMLElement;
1266
2576
  readonly infoElement: HTMLElement;
1267
2577
  readonly rendering: IObservable<MeasuredLayoutDebugRendering>;
@@ -1274,6 +2584,7 @@ export declare class MeasuredLayoutDebugView extends Disposable {
1274
2584
 
1275
2585
  export declare interface MeasuredLayoutDebugViewOptions {
1276
2586
  readonly model: MeasuredLayoutModel;
2587
+ readonly coordinateSpace: EditorCoordinateSpace;
1277
2588
  /**
1278
2589
  * DEBUG ONLY. Maps an absolute source offset to a fill color for that
1279
2590
  * character's glyph rect. The fixture passes the same function to the
@@ -1306,14 +2617,16 @@ export declare interface MeasuredLayoutDebugViewOptions {
1306
2617
  * through this model and never touches view fields directly.
1307
2618
  */
1308
2619
  export declare class MeasuredLayoutModel {
1309
- readonly measurements: ISettableObservable<readonly BlockMeasurement[], void>;
2620
+ private readonly _measurements;
2621
+ readonly measurements: IObservable<readonly BlockMeasurement[]>;
2622
+ private readonly _virtualLines;
1310
2623
  /**
1311
- * Concatenated visual line map across all mounted blocks. Lines are
1312
- * left in DOM (client-coordinate) y order — each per-block map already
1313
- * uses absolute client coordinates from `getClientRects()`, so the
1314
- * concatenation is well-formed without re-sorting.
2624
+ * Concatenated visual line map across all mounted blocks. Every per-block
2625
+ * map uses the same editor-local coordinate space, so concatenation is
2626
+ * well-formed without translation or re-sorting.
1315
2627
  */
1316
2628
  readonly visualLineMap: IObservableWithChange<VisualLineMap, void>;
2629
+ setMeasurements(measurements: readonly BlockMeasurement[], virtualLines: readonly VirtualLineMeasurement[]): void;
1317
2630
  }
1318
2631
 
1319
2632
  /**
@@ -1342,6 +2655,15 @@ export declare class MonacoSyntaxHighlighter implements ISyntaxHighlighter {
1342
2655
  private _tokenizerFor;
1343
2656
  }
1344
2657
 
2658
+ export declare const moveLinesDown: EditCommand;
2659
+
2660
+ export declare const moveLinesUp: EditCommand;
2661
+
2662
+ export declare interface NativeClipboardData {
2663
+ readonly text: string;
2664
+ readonly files: readonly File[];
2665
+ }
2666
+
1345
2667
  /**
1346
2668
  * Default strategy: handle the browser's native `copy`/`cut`/`paste` events,
1347
2669
  * reading and writing the synchronous {@link ClipboardEvent.clipboardData}.
@@ -1353,14 +2675,25 @@ export declare class NativeClipboardStrategy implements IClipboardStrategy {
1353
2675
  connect(context: IClipboardContext): IDisposable;
1354
2676
  }
1355
2677
 
2678
+ declare interface NestedItem {
2679
+ readonly kind: 'nested';
2680
+ readonly original: AstNode;
2681
+ readonly originalStart: number;
2682
+ readonly modified: AstNode;
2683
+ readonly modifiedStart: number;
2684
+ readonly children: readonly DiffItem[];
2685
+ }
2686
+
1356
2687
  /**
1357
- * Move the cursor one position left or right, skipping over hidden marker
2688
+ * Move the cursor one position left or right, skipping over hidden source
1358
2689
  * ranges in inactive blocks (and inactive items of an active list).
1359
2690
  */
1360
- export declare function nextCursorPosition(doc: DocumentAstNode, activeBlock: BlockAstNode | undefined, cursor: number, direction: 'left' | 'right'): number;
2691
+ export declare function nextCursorPosition(doc: DocumentAstNode, markerVisibleBlocks: ReadonlySet<BlockAstNode>, cursor: number, direction: 'left' | 'right', selectionRange?: OffsetRange): number;
1361
2692
 
1362
2693
  declare const NO_ACTIVE_BLOCKS: unique symbol;
1363
2694
 
2695
+ export declare function normalizeCursorPosition(doc: DocumentAstNode, markerVisibleBlocks: ReadonlySet<BlockAstNode>, cursor: number, target: number, direction: 'left' | 'right', includeHiddenRangeBoundary?: boolean, selectionRange?: OffsetRange): number;
2696
+
1364
2697
  export declare class OffsetRange {
1365
2698
  readonly start: number;
1366
2699
  readonly endExclusive: number;
@@ -1388,11 +2721,19 @@ export declare class OffsetRange {
1388
2721
  toString(): string;
1389
2722
  }
1390
2723
 
2724
+ /** The lossless source slices of a block HTML comment whose closer has not been typed. */
2725
+ declare interface OpenHtmlCommentSource extends HtmlCommentSourceBase {
2726
+ readonly kind: 'open';
2727
+ }
2728
+
2729
+ /** Outdent the current line, or every line touched by the selection. */
2730
+ export declare function outdent(config?: IndentationConfig): EditCommand;
2731
+
1391
2732
  export declare class ParagraphAstNode extends BlockAstNodeBase {
1392
- readonly content: readonly (InlineAstNode | GlueAstNode)[];
2733
+ readonly content: readonly InlineContentAstNode[];
1393
2734
  readonly leadingTrivia?: GlueAstNode | undefined;
1394
2735
  readonly kind = "paragraph";
1395
- constructor(content: readonly (InlineAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
2736
+ constructor(content: readonly InlineContentAstNode[], leadingTrivia?: GlueAstNode | undefined);
1396
2737
  get children(): readonly AstNode[];
1397
2738
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
1398
2739
  withLeadingTrivia(trivia: GlueAstNode | undefined): ParagraphAstNode;
@@ -1406,23 +2747,32 @@ declare class ParagraphViewData {
1406
2747
  }
1407
2748
 
1408
2749
  /**
1409
- * A *transient* editing state: the empty paragraph the user conjured by
1410
- * pressing Enter at the end of a paragraph. Markdown has no empty-paragraph
1411
- * node, so this never lives in {@link EditorModel.sourceText} or the parsed
1412
- * {@link EditorModel.document} — it is pure edit intent that the view renders
1413
- * as a synthetic blank line and that the controller either *materializes* (the
1414
- * user types) or *cancels* (the user navigates away / backspaces).
2750
+ * A *transient* editing state: an empty paragraph adjacent to a real block.
2751
+ * Markdown has no empty-paragraph node, so this never lives in
2752
+ * {@link EditorModel['sourceText']} or the parsed {@link EditorModel.document}
2753
+ * — it is pure edit intent that the view renders as a synthetic blank line and
2754
+ * that the controller either *materializes* (the user types) or *cancels* (the
2755
+ * user navigates away / backspaces).
1415
2756
  */
1416
2757
  declare interface PendingParagraph {
1417
- /** The paragraph the blank line is rendered directly after. */
2758
+ /** The block the blank line is rendered directly after. */
1418
2759
  readonly anchorBlock: BlockAstNode;
1419
2760
  /**
1420
2761
  * Source region rewritten when the pending paragraph is materialized — the
1421
2762
  * gap between {@link anchorBlock}'s text and whatever follows it.
1422
2763
  */
1423
2764
  readonly replaceRange: OffsetRange;
2765
+ /** Whether materialized text needs a blank-line separator before it. */
2766
+ readonly separateFromPreviousBlock: boolean;
1424
2767
  /** Whether {@link replaceRange} ends at the end of the document. */
1425
2768
  readonly atEof: boolean;
2769
+ /**
2770
+ * Horizontal whitespace typed on the source-less line. It remains transient
2771
+ * until other input materializes the paragraph. Contains only spaces and tabs.
2772
+ */
2773
+ readonly text: string;
2774
+ /** The source-less visual line occupied by the pending caret. */
2775
+ readonly cursorLine: VirtualCursorLine;
1426
2776
  /**
1427
2777
  * A throwaway AST node that exists only to give the synthetic view child a
1428
2778
  * stable identity across render frames (the view pairs nodes by `ast.id`).
@@ -1431,21 +2781,51 @@ declare interface PendingParagraph {
1431
2781
  readonly syntheticAst: ParagraphAstNode;
1432
2782
  }
1433
2783
 
2784
+ declare interface PendingParagraphResult {
2785
+ readonly kind: 'pending';
2786
+ readonly anchorBlock: BlockAstNode;
2787
+ readonly replaceRange: OffsetRange;
2788
+ /** Whether materialized text needs a blank-line separator before it. */
2789
+ readonly separateFromPreviousBlock: boolean;
2790
+ readonly atEof: boolean;
2791
+ }
2792
+
1434
2793
  /**
1435
2794
  * View-data for the transient empty paragraph (see `PendingParagraph` in the
1436
- * model). It carries only the throwaway {@link ParagraphAstNode} that gives the
1437
- * rendered blank line a stable identity across frames; it has no content and is
1438
- * never measured or part of the selection geometry — the caret is positioned
1439
- * over it via a dedicated rect, not via the visual-line map.
2795
+ * model). It carries the throwaway {@link ParagraphAstNode} that gives the
2796
+ * rendered line a stable identity across frames, its anchor block, source-less
2797
+ * cursor line, and transient horizontal whitespace. It has no source content or
2798
+ * selection range.
1440
2799
  */
1441
2800
  declare class PendingParagraphViewData {
1442
2801
  readonly ast: ParagraphAstNode;
2802
+ readonly anchorBlock: BlockAstNode;
2803
+ readonly cursorLine: VirtualCursorLine;
2804
+ readonly text: string;
1443
2805
  readonly kind = "pendingParagraph";
1444
- constructor(ast: ParagraphAstNode);
2806
+ constructor(ast: ParagraphAstNode, anchorBlock: BlockAstNode, cursorLine: VirtualCursorLine, text: string);
2807
+ }
2808
+
2809
+ /**
2810
+ * The mounted transient empty paragraph: a `<p class="md-pending-paragraph">`
2811
+ * holding either a `<br>` or decorated transient horizontal whitespace. It is a
2812
+ * leaf view node with no inline source content; the document view publishes its
2813
+ * element geometry as a virtual visual line.
2814
+ */
2815
+ declare class PendingParagraphViewNode extends ViewNode {
2816
+ readonly element: HTMLElement;
2817
+ readonly anchorBlock: BlockAstNode;
2818
+ readonly cursorLine: VirtualCursorLine;
2819
+ private _text;
2820
+ constructor(view: PendingParagraphViewData);
2821
+ update(text: string): void;
2822
+ getCaretClientRect(): DOMRect;
1445
2823
  }
1446
2824
 
1447
2825
  /**
1448
- * Immutable point in 2D space, in CSS-pixel client coordinates.
2826
+ * Immutable point in a caller-defined 2D CSS-pixel coordinate space.
2827
+ * Coordinate-owning APIs must document whether values are viewport-client or
2828
+ * editor-local; values from different spaces must not be mixed.
1449
2829
  */
1450
2830
  export declare class Point2D {
1451
2831
  readonly x: number;
@@ -1455,9 +2835,25 @@ export declare class Point2D {
1455
2835
  translate(dx: number, dy: number): Point2D;
1456
2836
  }
1457
2837
 
2838
+ export declare const presentationPolicies: Readonly<Record<EditorPresentation, PresentationPolicy>>;
2839
+
2840
+ declare interface PresentationPolicy {
2841
+ readonly parseOptions: MarkdownParseOptions;
2842
+ readonly preserveSourceWhitespace: boolean;
2843
+ readonly useSourceLineBreaks: boolean;
2844
+ }
2845
+
2846
+ /**
2847
+ * Read native clipboard formats through an editable target. Electron can expose
2848
+ * file clipboard entries here that navigator.clipboard.read() omits. EditContext
2849
+ * roots themselves do not receive execCommand('paste') events.
2850
+ * Returns undefined when the host does not support native programmatic paste.
2851
+ */
2852
+ export declare function readNativeClipboard(focusTarget: HTMLElement, executePaste?: () => void): NativeClipboardData | undefined;
2853
+
1458
2854
  /**
1459
- * Immutable axis-aligned rectangle in 2D space, in CSS-pixel client
1460
- * coordinates. `x`/`y` is the top-left corner, growing right/down.
2855
+ * Immutable axis-aligned rectangle in a caller-defined 2D CSS-pixel coordinate
2856
+ * space. `x`/`y` is the top-left corner, growing right/down.
1461
2857
  *
1462
2858
  * Half-open in both dimensions: `right` and `bottom` are excluded.
1463
2859
  */
@@ -1483,6 +2879,132 @@ export declare class Rect2D {
1483
2879
  translate(dx: number, dy: number): Rect2D;
1484
2880
  }
1485
2881
 
2882
+ declare interface RemovedItem {
2883
+ readonly kind: 'removed';
2884
+ readonly node: AstNode;
2885
+ readonly originalStart: number;
2886
+ readonly deletedLocal: readonly AnnotatedRange[];
2887
+ }
2888
+
2889
+ export declare interface RenameAnchor {
2890
+ readonly left: number;
2891
+ readonly top: number;
2892
+ readonly height: number;
2893
+ }
2894
+
2895
+ export declare class RenameModel<TContext = undefined> {
2896
+ private readonly _options;
2897
+ readonly name: ISettableObservable<string, void>;
2898
+ private readonly _session;
2899
+ private readonly _pending;
2900
+ private readonly _failure;
2901
+ private _submission;
2902
+ private _disposed;
2903
+ readonly session: IObservable<RenameSession<TContext> | undefined>;
2904
+ readonly pending: IObservable<boolean>;
2905
+ readonly isOpen: IObservableWithChange<boolean, void>;
2906
+ readonly error: IObservableWithChange<Error | undefined, void>;
2907
+ readonly validationMessage: IObservableWithChange<string | undefined, void>;
2908
+ readonly canSubmit: IObservableWithChange<boolean, void>;
2909
+ private readonly _nameObserver;
2910
+ constructor(_options: RenameModelOptions<TContext>);
2911
+ open(session: RenameSession<TContext>): void;
2912
+ submit(): Promise<RenameSubmitResult>;
2913
+ cancel(): void;
2914
+ dispose(): void;
2915
+ private _close;
2916
+ private _abortSubmission;
2917
+ private _isCurrent;
2918
+ }
2919
+
2920
+ export declare interface RenameModelOptions<TContext = undefined> {
2921
+ readonly onSubmit: (request: RenameRequest<TContext>) => void | Promise<void>;
2922
+ readonly onCancel?: (session: RenameSession<TContext>) => void;
2923
+ readonly validate?: (name: string, session: RenameSession<TContext>) => string | undefined;
2924
+ }
2925
+
2926
+ export declare interface RenameRequest<TContext = undefined> extends RenameSession<TContext> {
2927
+ readonly name: string;
2928
+ readonly signal: AbortSignal;
2929
+ }
2930
+
2931
+ export declare interface RenameSession<TContext = undefined> {
2932
+ readonly initialName: string;
2933
+ readonly context: TContext;
2934
+ }
2935
+
2936
+ export declare type RenameSubmitResult = {
2937
+ readonly kind: 'submitted';
2938
+ readonly name: string;
2939
+ } | {
2940
+ readonly kind: 'invalid';
2941
+ readonly message: string;
2942
+ } | {
2943
+ readonly kind: 'error';
2944
+ readonly error: Error;
2945
+ } | {
2946
+ readonly kind: 'closed' | 'pending' | 'cancelled' | 'superseded';
2947
+ };
2948
+
2949
+ export declare class RenameWidget<TContext = undefined> extends Disposable {
2950
+ private readonly _container;
2951
+ private readonly _model;
2952
+ private readonly _options;
2953
+ readonly element: HTMLDivElement;
2954
+ readonly inputElement: HTMLInputElement;
2955
+ private readonly _message;
2956
+ private _anchor;
2957
+ private _focusedSession;
2958
+ constructor(_container: HTMLElement, _model: RenameModel<TContext>, _options?: RenameWidgetOptions);
2959
+ focusAndSelect(): void;
2960
+ /** Anchor coordinates are relative to the positioned container's padding box. */
2961
+ layout(anchor?: RenameAnchor): void;
2962
+ }
2963
+
2964
+ export declare interface RenameWidgetOptions {
2965
+ readonly autoFocus?: boolean;
2966
+ /** Called when a focused widget closes; the host can restore editor focus. */
2967
+ readonly onDidHide?: () => void;
2968
+ }
2969
+
2970
+ export declare type RenderMarkupText = 'none' | 'selection' | 'all';
2971
+
2972
+ declare interface ReplacedItem {
2973
+ readonly kind: 'replaced';
2974
+ readonly original: AstNode;
2975
+ readonly originalStart: number;
2976
+ readonly modified: AstNode;
2977
+ readonly modifiedStart: number;
2978
+ readonly insertedLocal: readonly AnnotatedRange[];
2979
+ readonly deletedLocal: readonly AnnotatedRange[];
2980
+ }
2981
+
2982
+ export declare class RichLink {
2983
+ static create(options: RichLinkOptions): RichLink;
2984
+ static mount(element: HTMLElement, authoredLabel: HTMLSpanElement): RichLink;
2985
+ static clear(element: HTMLElement): void;
2986
+ readonly element: HTMLElement;
2987
+ readonly authoredLabel: HTMLSpanElement;
2988
+ private readonly _icon;
2989
+ private readonly _title;
2990
+ private readonly _detail;
2991
+ private readonly _reference;
2992
+ private readonly _changes;
2993
+ private readonly _status;
2994
+ private readonly _secondaryStatus;
2995
+ private constructor();
2996
+ update(presentation: LinkPresentation | undefined): void;
2997
+ private _renderUnavailable;
2998
+ private _layout;
2999
+ private _setDefaultOrder;
3000
+ }
3001
+
3002
+ export declare interface RichLinkOptions {
3003
+ readonly href: string;
3004
+ readonly authoredLabel: string;
3005
+ readonly presentation?: LinkPresentation;
3006
+ }
3007
+
1486
3008
  export declare const selectAll: SelectionCommand;
1487
3009
 
1488
3010
  export declare function selectBlock(ctx: CursorCommandContext, blockRange: OffsetRange): Selection_2;
@@ -1490,13 +3012,14 @@ export declare function selectBlock(ctx: CursorCommandContext, blockRange: Offse
1490
3012
  declare class Selection_2 {
1491
3013
  readonly anchor: SourceOffset;
1492
3014
  readonly active: SourceOffset;
1493
- static collapsed(offset: SourceOffset): Selection_2;
1494
- constructor(anchor: SourceOffset, active: SourceOffset);
3015
+ static collapsed(offset: SourceOffset, affinity?: SourceCursorPosition['affinity']): Selection_2;
3016
+ readonly activeAffinity?: SourceCursorPosition['affinity'];
3017
+ constructor(anchor: SourceOffset, active: SourceOffset, activeAffinity?: SourceCursorPosition['affinity']);
1495
3018
  get isCollapsed(): boolean;
1496
3019
  get isForward(): boolean;
1497
3020
  get range(): OffsetRange;
1498
3021
  collapseToActive(): Selection_2;
1499
- withActive(active: SourceOffset): Selection_2;
3022
+ withActive(active: SourceOffset, affinity?: SourceCursorPosition['affinity']): Selection_2;
1500
3023
  }
1501
3024
  export { Selection_2 as Selection }
1502
3025
 
@@ -1508,8 +3031,13 @@ export { Selection_2 as Selection }
1508
3031
  export declare interface SelectionBlock {
1509
3032
  readonly block: BlockAstNode;
1510
3033
  readonly absoluteStart: number;
1511
- readonly viewNode: ViewNode;
1512
- readonly element: HTMLElement;
3034
+ /** Block border box in editor-local coordinates. */
3035
+ readonly rect: Rect2D;
3036
+ /** Visible horizontal padding-box bounds for a scrolling block. */
3037
+ readonly viewportClip: {
3038
+ readonly left: number;
3039
+ readonly right: number;
3040
+ } | undefined;
1513
3041
  }
1514
3042
 
1515
3043
  export declare type SelectionCommand = (ctx: CursorCommandContext, offset: SourceOffset) => Selection_2;
@@ -1521,6 +3049,9 @@ export declare interface SelectionRect {
1521
3049
  readonly height: number;
1522
3050
  }
1523
3051
 
3052
+ /** The interaction that produced the current editor selection. */
3053
+ export declare type SelectionSource = 'user' | 'find';
3054
+
1524
3055
  /**
1525
3056
  * Owns the SVG overlay that paints the selection.
1526
3057
  *
@@ -1541,11 +3072,10 @@ export declare interface SelectionRect {
1541
3072
  * envelope shape used by IDE selection rendering.
1542
3073
  */
1543
3074
  export declare class SelectionView extends Disposable {
1544
- private readonly _parent;
1545
3075
  readonly element: SVGSVGElement;
1546
3076
  readonly rendering: IObservable<SelectionViewRendering>;
1547
3077
  private readonly _path;
1548
- constructor(_parent: HTMLElement, options: SelectionViewOptions);
3078
+ constructor(options: SelectionViewOptions);
1549
3079
  }
1550
3080
 
1551
3081
  export declare interface SelectionViewOptions {
@@ -1573,12 +3103,9 @@ export declare type SmartEnterResult = {
1573
3103
  readonly kind: 'edit';
1574
3104
  readonly edit: StringEdit;
1575
3105
  readonly selection: Selection_2;
1576
- } | {
1577
- readonly kind: 'pending';
1578
- readonly anchorBlock: BlockAstNode;
1579
- readonly replaceRange: OffsetRange;
1580
- readonly atEof: boolean;
1581
- };
3106
+ /** Post-edit range of indentation copied onto a new fenced-code line. */
3107
+ readonly generatedIndentation?: OffsetRange;
3108
+ } | PendingParagraphResult;
1582
3109
 
1583
3110
  /**
1584
3111
  * A run of {@link Token}s together with the exact {@link OffsetRange} they
@@ -1593,14 +3120,29 @@ export declare interface SnapshotTokens {
1593
3120
  readonly tokens: readonly Token[];
1594
3121
  }
1595
3122
 
3123
+ declare interface SourceCursorPosition {
3124
+ readonly kind: 'source';
3125
+ readonly offset: SourceOffset;
3126
+ /** Prefer the preceding visual line at a shared soft-wrap boundary. */
3127
+ readonly affinity?: 'upstream';
3128
+ }
3129
+
3130
+ /** Metadata delivered synchronously immediately before a model-owned source edit is applied. */
3131
+ export declare interface SourceEditEvent {
3132
+ readonly baseSourceTextId: number;
3133
+ readonly resultSourceTextId: number;
3134
+ readonly edit: StringEdit;
3135
+ readonly transaction: ITransaction;
3136
+ }
3137
+
1596
3138
  export declare type SourceOffset = number;
1597
3139
 
1598
3140
  export declare class StrikethroughAstNode extends AstNode {
1599
3141
  readonly openMarker: MarkerAstNode;
1600
- readonly content: readonly (InlineAstNode | GlueAstNode)[];
3142
+ readonly content: readonly InlineContentAstNode[];
1601
3143
  readonly closeMarker: MarkerAstNode;
1602
3144
  readonly kind = "strikethrough";
1603
- constructor(openMarker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], closeMarker: MarkerAstNode);
3145
+ constructor(openMarker: MarkerAstNode, content: readonly InlineContentAstNode[], closeMarker: MarkerAstNode);
1604
3146
  get children(): readonly AstNode[];
1605
3147
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
1606
3148
  }
@@ -1637,6 +3179,11 @@ export declare class StringReplacement {
1637
3179
  constructor(replaceRange: OffsetRange, newText: string);
1638
3180
  get isEmpty(): boolean;
1639
3181
  equals(other: StringReplacement): boolean;
3182
+ /**
3183
+ * Narrows this replacement to the span that actually changes, by trimming
3184
+ * the prefix and suffix it shares with the text it replaces in `source`.
3185
+ */
3186
+ removeCommonSuffixPrefix(source: string): StringReplacement;
1640
3187
  toString(): string;
1641
3188
  }
1642
3189
 
@@ -1650,10 +3197,10 @@ export declare class StringValue {
1650
3197
 
1651
3198
  export declare class StrongAstNode extends AstNode {
1652
3199
  readonly openMarker: MarkerAstNode;
1653
- readonly content: readonly (InlineAstNode | GlueAstNode)[];
3200
+ readonly content: readonly InlineContentAstNode[];
1654
3201
  readonly closeMarker: MarkerAstNode;
1655
3202
  readonly kind = "strong";
1656
- constructor(openMarker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], closeMarker: MarkerAstNode);
3203
+ constructor(openMarker: MarkerAstNode, content: readonly InlineContentAstNode[], closeMarker: MarkerAstNode);
1657
3204
  get children(): readonly AstNode[];
1658
3205
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
1659
3206
  }
@@ -1665,6 +3212,85 @@ declare class StrongViewData {
1665
3212
  constructor(ast: StrongAstNode, content: readonly AnyViewData[]);
1666
3213
  }
1667
3214
 
3215
+ export declare type SuggestAcceptance = 'enter' | 'tab' | 'pointer';
3216
+
3217
+ export declare interface SuggestCallbacks<T extends SuggestItem> {
3218
+ readonly onAccept: (item: T, source: SuggestAcceptance) => void;
3219
+ readonly onCancel?: () => void;
3220
+ readonly onSelect?: (item: T | undefined) => void;
3221
+ }
3222
+
3223
+ export declare interface SuggestItem {
3224
+ readonly id: string;
3225
+ readonly label: string;
3226
+ readonly detail?: string;
3227
+ readonly type?: string;
3228
+ readonly highlightLength?: number;
3229
+ }
3230
+
3231
+ export declare class SuggestModel<T extends SuggestItem = SuggestItem> {
3232
+ private readonly _callbacks;
3233
+ private readonly _state;
3234
+ readonly state: IObservable<SuggestState<T>>;
3235
+ readonly selectedItem: IObservableWithChange<T | undefined, void>;
3236
+ constructor(_callbacks: SuggestCallbacks<T>);
3237
+ show(items: readonly T[], selectedId?: string | undefined): void;
3238
+ showLoading(): void;
3239
+ showError(message: string): void;
3240
+ close(): void;
3241
+ select(id: string): boolean;
3242
+ navigate(direction: SuggestNavigation, pageSize?: number): boolean;
3243
+ accept(source?: SuggestAcceptance): boolean;
3244
+ cancel(): boolean;
3245
+ private _update;
3246
+ }
3247
+
3248
+ export declare type SuggestNavigation = 'next' | 'previous' | 'first' | 'last' | 'nextPage' | 'previousPage';
3249
+
3250
+ export declare type SuggestState<T extends SuggestItem = SuggestItem> = {
3251
+ readonly kind: 'closed';
3252
+ } | {
3253
+ readonly kind: 'loading';
3254
+ } | {
3255
+ readonly kind: 'empty';
3256
+ } | {
3257
+ readonly kind: 'error';
3258
+ readonly message: string;
3259
+ } | {
3260
+ readonly kind: 'ready';
3261
+ readonly items: readonly T[];
3262
+ readonly selectedIndex: number;
3263
+ };
3264
+
3265
+ export declare class SuggestWidget<T extends SuggestItem = SuggestItem> extends Disposable {
3266
+ private readonly _options;
3267
+ readonly element: HTMLDivElement;
3268
+ readonly listElement: HTMLDivElement;
3269
+ private readonly _message;
3270
+ private readonly _savedAttributes;
3271
+ private _items;
3272
+ private _disposed;
3273
+ private _pendingReveal;
3274
+ constructor(_options: SuggestWidgetOptions<T>);
3275
+ handleKeyDown(event: KeyboardEvent): boolean;
3276
+ dispose(): void;
3277
+ private _rowFromEvent;
3278
+ private _render;
3279
+ private _revealSelection;
3280
+ private _createRow;
3281
+ private _restoreAttributes;
3282
+ }
3283
+
3284
+ export declare interface SuggestWidgetOptions<T extends SuggestItem> {
3285
+ readonly model: SuggestModel<T>;
3286
+ readonly focusTarget: HTMLElement;
3287
+ readonly id: string;
3288
+ readonly label?: string;
3289
+ readonly listenForKeyboard?: boolean;
3290
+ }
3291
+
3292
+ export declare type TabKeyboardAction = 'insert' | 'outdent';
3293
+
1668
3294
  export declare class TableAstNode extends BlockAstNodeBase {
1669
3295
  readonly content: readonly (TableRowAstNode | GlueAstNode)[];
1670
3296
  readonly leadingTrivia?: GlueAstNode | undefined;
@@ -1727,10 +3353,10 @@ declare class TableViewData {
1727
3353
  }
1728
3354
 
1729
3355
  /**
1730
- * Source range (relative to `item`) of a task list item's `[x]`/`[ ]`
3356
+ * Source range (relative to `item`) of a task list item's `[x]`/`[ ]`/`[]`
1731
3357
  * checkbox, or `undefined` when the item is not a task item. The checkbox is
1732
3358
  * plain glue in the AST, so a host that wants to toggle it locates the literal
1733
- * `[x]`/`[ ]` token here.
3359
+ * checkbox token here.
1734
3360
  */
1735
3361
  export declare function taskCheckboxRange(item: ListItemAstNode): OffsetRange | undefined;
1736
3362
 
@@ -1747,6 +3373,14 @@ declare class TextViewData {
1747
3373
  readonly showWhitespace: boolean;
1748
3374
  readonly leftWordBoundary: boolean;
1749
3375
  readonly rightWordBoundary: boolean;
3376
+ /**
3377
+ * Number of leading source characters to keep out of the rendered
3378
+ * text (but not out of the source): the `:running:` marker plus its
3379
+ * mandatory leading separator, once
3380
+ * {@link isRunnerMarkerText} has matched this node. Zero otherwise.
3381
+ */
3382
+ readonly hiddenPrefixLength: number;
3383
+ readonly taskLabel: boolean;
1750
3384
  readonly kind = "text";
1751
3385
  /**
1752
3386
  * Whether non-obvious whitespace in this text is revealed (block is active).
@@ -1755,7 +3389,14 @@ declare class TextViewData {
1755
3389
  * emphasis); a single space touching such a sibling is obvious and stays
1756
3390
  * undecorated, just like a space between two words within this leaf.
1757
3391
  */
1758
- constructor(ast: TextAstNode, showWhitespace: boolean, leftWordBoundary?: boolean, rightWordBoundary?: boolean);
3392
+ constructor(ast: TextAstNode, showWhitespace: boolean, leftWordBoundary?: boolean, rightWordBoundary?: boolean,
3393
+ /**
3394
+ * Number of leading source characters to keep out of the rendered
3395
+ * text (but not out of the source): the `:running:` marker plus its
3396
+ * mandatory leading separator, once
3397
+ * {@link isRunnerMarkerText} has matched this node. Zero otherwise.
3398
+ */
3399
+ hiddenPrefixLength?: number, taskLabel?: boolean);
1759
3400
  }
1760
3401
 
1761
3402
  export declare class ThematicBreakAstNode extends BlockAstNodeBase {
@@ -1799,6 +3440,98 @@ export declare class Token {
1799
3440
  className: string | undefined);
1800
3441
  }
1801
3442
 
3443
+ declare interface UnchangedItem {
3444
+ readonly kind: 'unchanged';
3445
+ /** The modified-side node (identical in content to the original). */
3446
+ readonly node: AstNode;
3447
+ readonly modifiedStart: number;
3448
+ }
3449
+
3450
+ /**
3451
+ * A block whose token type the parser does not understand (a setext heading or
3452
+ * any future/extension construct). Rather than dropping the
3453
+ * span — which would demote its text to invisible glue — the parser captures the
3454
+ * whole source range verbatim as a single {@link MarkerAstNode} of kind
3455
+ * `content` and records the originating micromark {@link tokenType}, so the view
3456
+ * can render it as raw, editable text with an "unhandled" affordance. Offsets
3457
+ * stay sound: `content` tiles the block's full source span exactly.
3458
+ */
3459
+ declare class UnhandledBlockAstNode extends BlockAstNodeBase {
3460
+ readonly tokenType: string;
3461
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
3462
+ readonly leadingTrivia?: GlueAstNode | undefined;
3463
+ readonly kind = "unhandledBlock";
3464
+ constructor(tokenType: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
3465
+ get children(): readonly AstNode[];
3466
+ get code(): MarkerAstNode | undefined;
3467
+ /**
3468
+ * Lossless slices when this raw HTML block starts one comment after optional
3469
+ * whitespace. An open comment consumes the remaining source as its body. A
3470
+ * complete comment permits only trailing whitespace after its closer.
3471
+ */
3472
+ get htmlComment(): HtmlCommentSource | undefined;
3473
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
3474
+ withLeadingTrivia(trivia: GlueAstNode | undefined): UnhandledBlockAstNode;
3475
+ protected _localEquals(o: this): boolean;
3476
+ }
3477
+
3478
+ /**
3479
+ * View-data for an {@link UnhandledBlockAstNode}. The source remains verbatim
3480
+ * in both states. Complete HTML comments use {@link showMarkup} to switch
3481
+ * between their quiet reading treatment and editable source presentation;
3482
+ * other unhandled blocks ignore the flag and keep their warning treatment.
3483
+ */
3484
+ declare class UnhandledBlockViewData {
3485
+ readonly ast: UnhandledBlockAstNode;
3486
+ readonly showMarkup: boolean;
3487
+ readonly content: readonly AnyViewData[];
3488
+ readonly kind = "unhandledBlock";
3489
+ constructor(ast: UnhandledBlockAstNode, showMarkup: boolean, content: readonly AnyViewData[]);
3490
+ }
3491
+
3492
+ /**
3493
+ * A standalone HTML `<video>` whose source can be rendered without executing
3494
+ * arbitrary raw HTML. Its exact HTML remains in `content`, so activating the
3495
+ * block restores the original source for editing.
3496
+ */
3497
+ export declare class VideoAstNode extends BlockAstNodeBase {
3498
+ readonly attributes: VideoAttributes;
3499
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
3500
+ readonly leadingTrivia?: GlueAstNode | undefined;
3501
+ readonly kind = "video";
3502
+ constructor(attributes: VideoAttributes, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
3503
+ get children(): readonly AstNode[];
3504
+ get source(): MarkerAstNode | undefined;
3505
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
3506
+ withLeadingTrivia(trivia: GlueAstNode | undefined): VideoAstNode;
3507
+ protected _localEquals(o: this): boolean;
3508
+ }
3509
+
3510
+ /** The supported semantic attributes of a standalone HTML `<video>` block. */
3511
+ export declare interface VideoAttributes {
3512
+ readonly src: string;
3513
+ readonly title?: string;
3514
+ readonly autoplay: boolean;
3515
+ readonly controls: boolean;
3516
+ readonly loop: boolean;
3517
+ readonly muted: boolean;
3518
+ }
3519
+
3520
+ declare class VideoViewData {
3521
+ readonly ast: VideoAstNode;
3522
+ /** Active: reveal the exact HTML source; inactive: render the native video. */
3523
+ readonly showMarkup: boolean;
3524
+ readonly content: readonly AnyViewData[];
3525
+ /** Nested diff state; top-level video diff state lives on the document child. */
3526
+ readonly diffKind?: "added" | "modified" | undefined;
3527
+ readonly kind = "video";
3528
+ constructor(ast: VideoAstNode,
3529
+ /** Active: reveal the exact HTML source; inactive: render the native video. */
3530
+ showMarkup: boolean, content: readonly AnyViewData[],
3531
+ /** Nested diff state; top-level video diff state lives on the document child. */
3532
+ diffKind?: "added" | "modified" | undefined);
3533
+ }
3534
+
1802
3535
  /**
1803
3536
  * Immutable view of an AST node. Pairs `ast` with its rendered `dom` and a
1804
3537
  * mirror of `ast.children` as ViewNode children. Source offsets are NEVER
@@ -1863,10 +3596,12 @@ export declare class ViewNode extends Disposable {
1863
3596
  /**
1864
3597
  * Map a DOM hit that lands on THIS node's own representation into a source
1865
3598
  * range in this node's local space `[0, ast.length)`. Polymorphic: a text
1866
- * leaf maps the caret offset 1:1; an element-only node (KaTeX math, `<hr>`,
1867
- * an image, a hidden marker) has no internal text mapping and snaps to its
1868
- * start by default — subclasses may override (e.g. to snap to the nearer
1869
- * edge by x).
3599
+ * leaf maps the caret offset 1:1. For an element hit — an element-only node
3600
+ * (KaTeX math, `<hr>`, an image, a hidden marker) or a wrapper/container
3601
+ * element — the platform reports a child-index offset, not a text caret, so
3602
+ * there is no internal mapping to honour: it snaps to the node's nearer
3603
+ * edge, `offset 0` (the "before" side) → start, any `offset >= 1` (the
3604
+ * "after" side) → end. Subclasses may override for finer control.
1870
3605
  */
1871
3606
  getLocalSourceRange(pos: DomPosition): OffsetRange;
1872
3607
  /**
@@ -1888,6 +3623,24 @@ export declare class ViewNode extends Disposable {
1888
3623
  forEachTextLeaf(nodeOffset: number, visitor: (leaf: ViewNode, leafOffset: number) => void): void;
1889
3624
  }
1890
3625
 
3626
+ /**
3627
+ * A visual cursor line that has no representation in the source text.
3628
+ *
3629
+ * The two source offsets are the positions immediately before and after the
3630
+ * virtual line. The object itself is the stable identity of the line.
3631
+ */
3632
+ export declare class VirtualCursorLine {
3633
+ readonly sourceOffsetBefore: SourceOffset;
3634
+ readonly sourceOffsetAfter: SourceOffset;
3635
+ constructor(sourceOffsetBefore: SourceOffset, sourceOffsetAfter: SourceOffset);
3636
+ }
3637
+
3638
+ /** A measured source-less line inserted directly after a source block. */
3639
+ declare interface VirtualLineMeasurement {
3640
+ readonly afterBlock: BlockAstNode;
3641
+ readonly line: VisualLine;
3642
+ }
3643
+
1891
3644
  export declare type VisualCursorCommand = (ctx: VisualCursorCommandContext) => CursorMoveResult;
1892
3645
 
1893
3646
  export declare interface VisualCursorCommandContext extends CursorCommandContext {
@@ -1905,12 +3658,15 @@ export declare function visualizeAst(root: AstNode, source: string): AstVisualiz
1905
3658
  export declare class VisualLine {
1906
3659
  readonly rect: Rect2D;
1907
3660
  readonly runs: readonly VisualRun[];
1908
- constructor(rect: Rect2D, runs: readonly VisualRun[]);
3661
+ readonly virtualCursorLine?: VirtualCursorLine | undefined;
3662
+ static virtual(cursorLine: VirtualCursorLine, rect: Rect2D): VisualLine;
3663
+ constructor(rect: Rect2D, runs: readonly VisualRun[], virtualCursorLine?: VirtualCursorLine | undefined);
1909
3664
  containsOffset(offset: SourceOffset): boolean;
1910
3665
  /**
1911
3666
  * How `offset` relates to this line's runs:
1912
3667
  * - `'covers'`: a run starts at or strictly contains the offset
1913
- * (`start <= offset < endExclusive`) — the caret belongs on this line.
3668
+ * (`start <= offset < endExclusive`), or a zero-length visual-line
3669
+ * anchor sits at the offset — the caret belongs on this line.
1914
3670
  * - `'end'`: the offset is only some run's trailing boundary
1915
3671
  * (`offset === endExclusive`) with no run covering it — a line-break
1916
3672
  * boundary the caret should leave for the next line.
@@ -1923,23 +3679,42 @@ export declare class VisualLine {
1923
3679
  */
1924
3680
  sourceDistanceTo(offset: SourceOffset): number;
1925
3681
  /**
1926
- * x of the caret position before `offset` on this line. When `offset`
1927
- * is past all runs (trailing whitespace / blank line), returns the
1928
- * right edge of the last run; when before all runs, returns the left
1929
- * edge of the first run.
3682
+ * x of the caret position before `offset` on this line.
3683
+ *
3684
+ * The runs tile the source but are stored in paint order, not sorted by
3685
+ * source offset (hidden-marker runs are appended last). So this scans all
3686
+ * runs rather than assuming any ordering:
3687
+ *
3688
+ * - A zero-source visual anchor owns its exact offset, so a marker-only line
3689
+ * wins over the preceding line's inclusive end boundary.
3690
+ * - Otherwise a run starting at `offset` owns that seam. This keeps an
3691
+ * out-of-flow prefix from placing the caret at its trailing edge when the
3692
+ * following body starts at a visually separate x.
3693
+ * - Otherwise, if some run *covers* `offset`, its own geometry places the
3694
+ * caret (exact glyph boundary for text runs). In the active,
3695
+ * markers-visible form every interior offset is covered, so this branch
3696
+ * keeps distinct offsets distinct.
3697
+ * - Otherwise `offset` sits in a gap — a hidden inline marker such as the
3698
+ * `**` of `**bold**`, or before/after the painted text. It snaps to the
3699
+ * seam between the source-nearest runs on either side: the right edge of
3700
+ * the closest run ending at/before `offset`, else the left edge of the
3701
+ * closest run starting at/after it. A hidden marker collapses to zero
3702
+ * width, so both edges coincide at the seam.
1930
3703
  */
1931
3704
  xAtOffset(offset: SourceOffset): number;
1932
3705
  /**
1933
3706
  * Snap `x` to the nearest offset on this line. If `x` falls inside a
1934
- * run, the offset is interpolated by character fraction; otherwise it
1935
- * snaps to the closer edge of the nearest run.
3707
+ * run, the run resolves the offset (exact glyph boundary for text runs,
3708
+ * nearer edge for source-less runs); otherwise it snaps to the closer
3709
+ * edge of the nearest run.
1936
3710
  */
1937
3711
  offsetAtX(x: number): SourceOffset;
1938
3712
  }
1939
3713
 
1940
3714
  /**
1941
3715
  * Geometry of the rendered document, as a map from source offsets to 2D
1942
- * positions and back.
3716
+ * positions and back. All geometry is expressed in the editor overlay's local
3717
+ * CSS-pixel coordinate space.
1943
3718
  *
1944
3719
  * Structure (top to bottom):
1945
3720
  *
@@ -1974,7 +3749,9 @@ export declare class VisualLineMap {
1974
3749
  static measure(blockViews: readonly {
1975
3750
  readonly absoluteStart: number;
1976
3751
  readonly viewNode: ViewNode;
1977
- }[]): VisualLineMap;
3752
+ }[], coordinateSpace: EditorCoordinateSpace, transform?: EditorCoordinateTransform): VisualLineMap;
3753
+ /** Lines backed by source ranges, excluding source-less cursor lines. */
3754
+ readonly sourceLines: readonly VisualLine[];
1978
3755
  constructor(lines: readonly VisualLine[]);
1979
3756
  get lineCount(): number;
1980
3757
  get isEmpty(): boolean;
@@ -1993,12 +3770,18 @@ export declare class VisualLineMap {
1993
3770
  * The first such trailing-boundary line is remembered as a fallback for the
1994
3771
  * document's very last offset, where no later line starts it.
1995
3772
  */
1996
- lineIndexOfOffset(offset: SourceOffset): number;
3773
+ lineIndexOfOffset(offset: SourceOffset, affinity?: SourceCursorPosition['affinity']): number;
1997
3774
  /**
1998
3775
  * x of the caret position before `offset`, on the line returned by
1999
3776
  * {@link lineIndexOfOffset}. Returns `0` when the map is empty.
2000
3777
  */
2001
3778
  xAtOffset(offset: SourceOffset): number;
3779
+ /**
3780
+ * Line occupied by a source or virtual cursor position. A virtual position
3781
+ * returns `undefined` until its corresponding DOM line has been measured.
3782
+ */
3783
+ lineIndexOfPosition(position: CursorPosition): number | undefined;
3784
+ xAtPosition(position: CursorPosition): number;
2002
3785
  /**
2003
3786
  * Line whose vertical band contains `y`, clamped to the first/last
2004
3787
  * line when `y` is outside the document.
@@ -2010,8 +3793,13 @@ export declare class VisualLineMap {
2010
3793
  * uses {@link offsetInLineAtX} directly to preserve desired column.
2011
3794
  */
2012
3795
  offsetAtPoint(point: Point2D): SourceOffset;
3796
+ positionAtPoint(point: Point2D): SourceCursorPosition;
3797
+ positionAtOffsetInLine(lineIndex: number, offset: SourceOffset): SourceCursorPosition;
2013
3798
  /** Snap `x` to the nearest offset on a specific line. */
2014
3799
  offsetInLineAtX(lineIndex: number, x: number): SourceOffset;
3800
+ positionInLineAtX(lineIndex: number, x: number): CursorPosition;
3801
+ lineStartOffset(lineIndex: number): SourceOffset | undefined;
3802
+ lineEndOffset(lineIndex: number): SourceOffset | undefined;
2015
3803
  }
2016
3804
 
2017
3805
  /**
@@ -2020,14 +3808,22 @@ export declare class VisualLineMap {
2020
3808
  * When constructed with a {@link VisualRunSource}, `xAtOffset` returns the
2021
3809
  * pixel-exact x of the caret before character `offset` by measuring the
2022
3810
  * prefix `[textNodeStart, textNodeStart + (offset - sourceStart))` with a
2023
- * DOM `Range`. Without a source it falls back to linear interpolation
2024
- * across `rect.width`.
3811
+ * DOM `Range`.
3812
+ *
3813
+ * A source-less run has no per-offset geometry: it either represents an
3814
+ * element-only block (KaTeX math, a mermaid/custom diagram, an image, an
3815
+ * inactive `<hr>`) whose box does not correspond to source offsets, or a
3816
+ * hand-built run in a test. Either way it maps between offsets and x by
3817
+ * snapping to the nearer edge of {@link rect} rather than fabricating
3818
+ * interior positions.
2025
3819
  */
2026
3820
  export declare class VisualRun {
2027
3821
  readonly sourceRange: OffsetRange;
2028
3822
  readonly rect: Rect2D;
2029
3823
  readonly source?: VisualRunSource | undefined;
2030
- constructor(sourceRange: OffsetRange, rect: Rect2D, source?: VisualRunSource | undefined);
3824
+ readonly isVisualLineAnchor: boolean;
3825
+ static visualLineAnchor(sourceOffset: SourceOffset, rect: Rect2D): VisualRun;
3826
+ constructor(sourceRange: OffsetRange, rect: Rect2D, source?: VisualRunSource | undefined, isVisualLineAnchor?: boolean);
2031
3827
  get sourceStart(): SourceOffset;
2032
3828
  get sourceEndExclusive(): SourceOffset;
2033
3829
  get sourceLength(): number;
@@ -2039,19 +3835,32 @@ export declare class VisualRun {
2039
3835
 
2040
3836
  /**
2041
3837
  * The DOM source of a {@link VisualRun}. When set, `xAtOffset` and
2042
- * `offsetAtX` measure exact glyph positions via `Range.getBoundingClientRect`
2043
- * instead of linear interpolation across the run's rect. This matters for
2044
- * proportional fonts where character widths differ a lot (e.g. `m` vs `i`)
2045
- * and a caret placed by interpolation lands several pixels inside the
2046
- * wrong character.
3838
+ * `offsetAtX` measure exact glyph positions via `Range.getBoundingClientRect`.
3839
+ * This matters for proportional fonts where character widths differ a lot
3840
+ * (e.g. `m` vs `i`): a caret placed by anything coarser than real glyph
3841
+ * measurement lands several pixels inside the wrong character.
2047
3842
  *
2048
- * Hand-built runs (tests) omit this; their `xAtOffset` falls back to
2049
- * linear interpolation.
3843
+ * A run without a source has no per-offset geometry, so it maps between
3844
+ * offsets and x by snapping to the nearer run edge. Real text runs always
3845
+ * carry a source; source-less runs are element-only blocks (see
3846
+ * {@link _appendElementBlockRun}) and hand-built runs in tests.
2050
3847
  */
2051
3848
  declare interface VisualRunSource {
2052
3849
  readonly textNode: Text;
2053
3850
  /** Offset within `textNode.data` corresponding to `sourceRange.start`. */
2054
3851
  readonly textNodeStart: number;
3852
+ readonly coordinateSpace: EditorCoordinateSpace;
3853
+ }
3854
+
3855
+ export declare const vscodeHostKeyboardProfile: KeyboardProfile;
3856
+
3857
+ export declare const vscodeKeyboardProfile: KeyboardProfile;
3858
+
3859
+ export declare const vscodeLocalKeyboardProfile: KeyboardProfile;
3860
+
3861
+ export declare interface WordNavigationConfig {
3862
+ readonly wordSeparators: string;
3863
+ readonly wordSegmenterLocales: readonly string[];
2055
3864
  }
2056
3865
 
2057
3866
  export { }