@vscode/markdown-editor 0.0.2-0 → 0.0.2-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_observables/assert.d.ts +2 -0
- package/dist/_observables/deps.d.ts +28 -0
- package/dist/_observables/disposables.d.ts +19 -0
- package/dist/_observables/equals.d.ts +32 -0
- package/dist/_observables/index.d.ts +2 -0
- package/dist/_observables/observableInternal/base.d.ts +172 -0
- package/dist/_observables/observableInternal/changeTracker.d.ts +44 -0
- package/dist/_observables/observableInternal/commonFacade/cancellation.d.ts +24 -0
- package/dist/_observables/observableInternal/commonFacade/deps.d.ts +24 -0
- package/dist/_observables/observableInternal/debugLocation.d.ts +21 -0
- package/dist/_observables/observableInternal/debugName.d.ts +33 -0
- package/dist/_observables/observableInternal/experimental/deferUnobserve.d.ts +16 -0
- package/dist/_observables/observableInternal/experimental/reducer.d.ts +37 -0
- package/dist/_observables/observableInternal/experimental/utils.d.ts +15 -0
- package/dist/_observables/observableInternal/index.d.ts +25 -0
- package/dist/_observables/observableInternal/logging/consoleObservableLogger.d.ts +40 -0
- package/dist/_observables/observableInternal/logging/debugGetDependencyGraph.d.ts +4 -0
- package/dist/_observables/observableInternal/logging/debugger/debuggerRpc.d.ts +4 -0
- package/dist/_observables/observableInternal/logging/debugger/devToolsLogger.d.ts +43 -0
- package/dist/_observables/observableInternal/logging/debugger/rpc.d.ts +41 -0
- package/dist/_observables/observableInternal/logging/debugger/utils.d.ts +13 -0
- package/dist/_observables/observableInternal/logging/logging.d.ts +30 -0
- package/dist/_observables/observableInternal/map.d.ts +18 -0
- package/dist/_observables/observableInternal/observables/baseObservable.d.ts +58 -0
- package/dist/_observables/observableInternal/observables/constObservable.d.ts +5 -0
- package/dist/_observables/observableInternal/observables/derived.d.ts +46 -0
- package/dist/_observables/observableInternal/observables/derivedImpl.d.ts +83 -0
- package/dist/_observables/observableInternal/observables/lazyObservableValue.d.ts +27 -0
- package/dist/_observables/observableInternal/observables/observableFromEvent.d.ts +37 -0
- package/dist/_observables/observableInternal/observables/observableSignal.d.ts +11 -0
- package/dist/_observables/observableInternal/observables/observableSignalFromEvent.d.ts +5 -0
- package/dist/_observables/observableInternal/observables/observableValue.d.ts +37 -0
- package/dist/_observables/observableInternal/observables/observableValueOpts.d.ts +8 -0
- package/dist/_observables/observableInternal/reactions/autorun.d.ts +56 -0
- package/dist/_observables/observableInternal/reactions/autorunImpl.d.ts +53 -0
- package/dist/_observables/observableInternal/set.d.ts +17 -0
- package/dist/_observables/observableInternal/transaction.d.ts +27 -0
- package/dist/_observables/observableInternal/utils/promise.d.ts +75 -0
- package/dist/_observables/observableInternal/utils/runOnChange.d.ts +7 -0
- package/dist/_observables/observableInternal/utils/utils.d.ts +43 -0
- package/dist/_observables/observableInternal/utils/utilsCancellation.d.ts +10 -0
- package/dist/_observables/observableInternal/utils/valueWithChangeEvent.d.ts +10 -0
- package/dist/_observables/utils.d.ts +15 -0
- package/dist/index.d.ts +1769 -6
- package/dist/observables.d.ts +4 -1
- package/package.json +1 -1
- package/dist/commands/cursorCommands.d.ts +0 -13
- package/dist/commands/editCommands.d.ts +0 -14
- package/dist/commands/index.d.ts +0 -4
- package/dist/commands/selectionCommands.d.ts +0 -6
- package/dist/commands/types.d.ts +0 -26
- package/dist/core/geometry.d.ts +0 -37
- package/dist/core/index.d.ts +0 -8
- package/dist/core/lengthEdit.d.ts +0 -38
- package/dist/core/offsetRange.d.ts +0 -26
- package/dist/core/selection.d.ts +0 -13
- package/dist/core/sourceOffset.d.ts +0 -1
- package/dist/core/stringEdit.d.ts +0 -27
- package/dist/core/stringValue.d.ts +0 -8
- package/dist/core/wordUtils.d.ts +0 -6
- package/dist/highlighter/defaultMonacoSyntaxHighlighter.d.ts +0 -20
- package/dist/highlighter/index.d.ts +0 -3
- package/dist/highlighter/monacoSyntaxHighlighter.d.ts +0 -38
- package/dist/highlighter/syntaxHighlighter.d.ts +0 -67
- package/dist/model/cursorNavigation.d.ts +0 -7
- package/dist/model/editorModel.d.ts +0 -54
- package/dist/model/index.d.ts +0 -4
- package/dist/model/measuredLayoutModel.d.ts +0 -50
- package/dist/parser/_micromarkAdapter.d.ts +0 -7
- package/dist/parser/ast.d.ts +0 -274
- package/dist/parser/index.d.ts +0 -4
- package/dist/parser/parse.d.ts +0 -2
- package/dist/parser/parser.d.ts +0 -14
- package/dist/parser/reconcile.d.ts +0 -33
- package/dist/parser/test/getAnnotatedSource.d.ts +0 -2
- package/dist/parser/test/snapshot.d.ts +0 -9
- package/dist/parser/visualizeAst.d.ts +0 -33
- package/dist/test/random.d.ts +0 -16
- package/dist/view/content/blockView.d.ts +0 -179
- package/dist/view/content/documentView.d.ts +0 -41
- package/dist/view/content/dom.d.ts +0 -16
- package/dist/view/content/katexEditableIdentifiers.d.ts +0 -36
- package/dist/view/content/viewNode.d.ts +0 -93
- package/dist/view/editorController.d.ts +0 -34
- package/dist/view/editorView.d.ts +0 -100
- package/dist/view/fixture/astViewerView.d.ts +0 -27
- package/dist/view/fixture/cyclingTsHighlighter.d.ts +0 -17
- package/dist/view/fixture/debugColors.d.ts +0 -26
- package/dist/view/fixture/monacoDebugPanel.d.ts +0 -7
- package/dist/view/index.d.ts +0 -9
- package/dist/view/measuredLayoutDebugView.d.ts +0 -70
- package/dist/view/parts/cursorView.d.ts +0 -29
- package/dist/view/parts/selectionView.d.ts +0 -57
- package/dist/view/viewData.d.ts +0 -251
- package/dist/view/visualLineMap.d.ts +0 -157
- package/dist/view/visualizeViewTree.d.ts +0 -5
package/dist/observables.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CursorCommand, VisualCursorCommand } from './types.js';
|
|
2
|
-
export declare const cursorRight: CursorCommand;
|
|
3
|
-
export declare const cursorLeft: CursorCommand;
|
|
4
|
-
export declare const cursorMoveRight: CursorCommand;
|
|
5
|
-
export declare const cursorMoveLeft: CursorCommand;
|
|
6
|
-
export declare const cursorWordRight: CursorCommand;
|
|
7
|
-
export declare const cursorWordLeft: CursorCommand;
|
|
8
|
-
export declare const cursorLineStart: CursorCommand;
|
|
9
|
-
export declare const cursorLineEnd: CursorCommand;
|
|
10
|
-
export declare const cursorDocumentStart: CursorCommand;
|
|
11
|
-
export declare const cursorDocumentEnd: CursorCommand;
|
|
12
|
-
export declare const cursorDown: VisualCursorCommand;
|
|
13
|
-
export declare const cursorUp: VisualCursorCommand;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { EditCommand } from './types.js';
|
|
2
|
-
export declare const deleteLeft: EditCommand;
|
|
3
|
-
export declare const deleteRight: EditCommand;
|
|
4
|
-
export declare const deleteWordLeft: EditCommand;
|
|
5
|
-
export declare const deleteWordRight: EditCommand;
|
|
6
|
-
export declare function insertText(text: string): EditCommand;
|
|
7
|
-
export declare const insertParagraph: EditCommand;
|
|
8
|
-
export declare const insertLineBreak: EditCommand;
|
|
9
|
-
/**
|
|
10
|
-
* A Markdown hard line break: a `\n` whose preceding line ends with two spaces.
|
|
11
|
-
* Any spaces already trailing the insertion point count toward the two, so the
|
|
12
|
-
* line never accumulates more than the two needed to form the break.
|
|
13
|
-
*/
|
|
14
|
-
export declare const insertHardLineBreak: EditCommand;
|
package/dist/commands/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type { CursorCommand, VisualCursorCommand, EditCommand, SelectionCommand, CursorCommandContext, VisualCursorCommandContext, CursorMoveResult } from './types.js';
|
|
2
|
-
export { cursorRight, cursorLeft, cursorMoveRight, cursorMoveLeft, cursorWordRight, cursorWordLeft, cursorLineStart, cursorLineEnd, cursorDocumentStart, cursorDocumentEnd, cursorDown, cursorUp } from './cursorCommands.js';
|
|
3
|
-
export { deleteLeft, deleteRight, deleteWordLeft, deleteWordRight, insertText, insertParagraph, insertLineBreak, insertHardLineBreak } from './editCommands.js';
|
|
4
|
-
export { selectAll, selectWord, selectBlock } from './selectionCommands.js';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { OffsetRange } from '../core/offsetRange.js';
|
|
2
|
-
import { Selection } from '../core/selection.js';
|
|
3
|
-
import { CursorCommandContext, SelectionCommand } from './types.js';
|
|
4
|
-
export declare const selectAll: SelectionCommand;
|
|
5
|
-
export declare const selectWord: SelectionCommand;
|
|
6
|
-
export declare function selectBlock(ctx: CursorCommandContext, blockRange: OffsetRange): Selection;
|
package/dist/commands/types.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Selection } from '../core/selection.js';
|
|
2
|
-
import { SourceOffset } from '../core/sourceOffset.js';
|
|
3
|
-
import { StringEdit } from '../core/stringEdit.js';
|
|
4
|
-
import { BlockAstNode, DocumentAstNode } from '../parser/ast.js';
|
|
5
|
-
import { VisualLineMap } from '../view/visualLineMap.js';
|
|
6
|
-
export interface CursorCommandContext {
|
|
7
|
-
readonly text: string;
|
|
8
|
-
readonly selection: Selection;
|
|
9
|
-
readonly document: DocumentAstNode;
|
|
10
|
-
readonly activeBlock: BlockAstNode | undefined;
|
|
11
|
-
}
|
|
12
|
-
export interface VisualCursorCommandContext extends CursorCommandContext {
|
|
13
|
-
readonly lineMap: VisualLineMap;
|
|
14
|
-
readonly desiredColumn: number | undefined;
|
|
15
|
-
}
|
|
16
|
-
export type CursorCommand = (ctx: CursorCommandContext) => SourceOffset;
|
|
17
|
-
export type VisualCursorCommand = (ctx: VisualCursorCommandContext) => CursorMoveResult;
|
|
18
|
-
export type EditCommand = (ctx: CursorCommandContext) => {
|
|
19
|
-
readonly edit: StringEdit;
|
|
20
|
-
readonly selection: Selection;
|
|
21
|
-
} | undefined;
|
|
22
|
-
export type SelectionCommand = (ctx: CursorCommandContext, offset: SourceOffset) => Selection;
|
|
23
|
-
export interface CursorMoveResult {
|
|
24
|
-
readonly offset: SourceOffset;
|
|
25
|
-
readonly desiredColumn: number | undefined;
|
|
26
|
-
}
|
package/dist/core/geometry.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Immutable point in 2D space, in CSS-pixel client coordinates.
|
|
3
|
-
*/
|
|
4
|
-
export declare class Point2D {
|
|
5
|
-
readonly x: number;
|
|
6
|
-
readonly y: number;
|
|
7
|
-
static readonly ZERO: Point2D;
|
|
8
|
-
constructor(x: number, y: number);
|
|
9
|
-
translate(dx: number, dy: number): Point2D;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Immutable axis-aligned rectangle in 2D space, in CSS-pixel client
|
|
13
|
-
* coordinates. `x`/`y` is the top-left corner, growing right/down.
|
|
14
|
-
*
|
|
15
|
-
* Half-open in both dimensions: `right` and `bottom` are excluded.
|
|
16
|
-
*/
|
|
17
|
-
export declare class Rect2D {
|
|
18
|
-
readonly x: number;
|
|
19
|
-
readonly y: number;
|
|
20
|
-
readonly width: number;
|
|
21
|
-
readonly height: number;
|
|
22
|
-
static readonly EMPTY: Rect2D;
|
|
23
|
-
static fromPointPoint(left: number, top: number, right: number, bottom: number): Rect2D;
|
|
24
|
-
static fromPointSize(x: number, y: number, width: number, height: number): Rect2D;
|
|
25
|
-
private constructor();
|
|
26
|
-
get left(): number;
|
|
27
|
-
get top(): number;
|
|
28
|
-
get right(): number;
|
|
29
|
-
get bottom(): number;
|
|
30
|
-
get topLeft(): Point2D;
|
|
31
|
-
containsX(x: number): boolean;
|
|
32
|
-
containsY(y: number): boolean;
|
|
33
|
-
containsPoint(p: Point2D): boolean;
|
|
34
|
-
/** Same y/height, zero-width band at `x = this.left`. Useful for caret rects derived from a line. */
|
|
35
|
-
withZeroWidthAt(x: number): Rect2D;
|
|
36
|
-
translate(dx: number, dy: number): Rect2D;
|
|
37
|
-
}
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { OffsetRange } from './offsetRange.js';
|
|
2
|
-
export { StringEdit, StringReplacement } from './stringEdit.js';
|
|
3
|
-
export { LengthEdit, LengthReplacement } from './lengthEdit.js';
|
|
4
|
-
export { StringValue } from './stringValue.js';
|
|
5
|
-
export { Selection } from './selection.js';
|
|
6
|
-
export type { SourceOffset } from './sourceOffset.js';
|
|
7
|
-
export { Point2D, Rect2D } from './geometry.js';
|
|
8
|
-
export { findWordBoundaryLeft, findWordBoundaryRight, findWordAt } from './wordUtils.js';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { OffsetRange } from './offsetRange.js';
|
|
2
|
-
/**
|
|
3
|
-
* A single "the text in `replaceRange` now spans `newLength` characters"
|
|
4
|
-
* statement. Unlike {@link StringReplacement} it carries no text — it only
|
|
5
|
-
* describes *where* and *by how much* something changed, not *what to*.
|
|
6
|
-
*
|
|
7
|
-
* For syntax highlighting it means: the characters that used to occupy
|
|
8
|
-
* `replaceRange` are replaced by `newLength` characters whose tokens may now
|
|
9
|
-
* be coloured differently. A same-length replacement (`replaceRange.length ===
|
|
10
|
-
* newLength`) therefore means "these characters kept their positions but got
|
|
11
|
-
* re-coloured".
|
|
12
|
-
*/
|
|
13
|
-
export declare class LengthReplacement {
|
|
14
|
-
readonly replaceRange: OffsetRange;
|
|
15
|
-
readonly newLength: number;
|
|
16
|
-
static replace(replaceRange: OffsetRange, newLength: number): LengthReplacement;
|
|
17
|
-
constructor(replaceRange: OffsetRange, newLength: number);
|
|
18
|
-
get lengthDelta(): number;
|
|
19
|
-
equals(other: LengthReplacement): boolean;
|
|
20
|
-
toString(): string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* A set of disjoint, sorted {@link LengthReplacement}s — the length-only
|
|
24
|
-
* counterpart of {@link StringEdit}. Used as the change reason of an
|
|
25
|
-
* observable so observers learn which offset ranges of the previous value map
|
|
26
|
-
* to which ranges of the new value (and thus what to invalidate) without
|
|
27
|
-
* carrying the new content itself.
|
|
28
|
-
*/
|
|
29
|
-
export declare class LengthEdit {
|
|
30
|
-
static readonly empty: LengthEdit;
|
|
31
|
-
static single(replacement: LengthReplacement): LengthEdit;
|
|
32
|
-
static replace(replaceRange: OffsetRange, newLength: number): LengthEdit;
|
|
33
|
-
readonly replacements: readonly LengthReplacement[];
|
|
34
|
-
constructor(replacements: readonly LengthReplacement[]);
|
|
35
|
-
get isEmpty(): boolean;
|
|
36
|
-
equals(other: LengthEdit): boolean;
|
|
37
|
-
toString(): string;
|
|
38
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare class OffsetRange {
|
|
2
|
-
readonly start: number;
|
|
3
|
-
readonly endExclusive: number;
|
|
4
|
-
static fromTo(start: number, endExclusive: number): OffsetRange;
|
|
5
|
-
static ofLength(length: number): OffsetRange;
|
|
6
|
-
static ofStartAndLength(start: number, length: number): OffsetRange;
|
|
7
|
-
static emptyAt(offset: number): OffsetRange;
|
|
8
|
-
constructor(start: number, endExclusive: number);
|
|
9
|
-
get isEmpty(): boolean;
|
|
10
|
-
get length(): number;
|
|
11
|
-
delta(offset: number): OffsetRange;
|
|
12
|
-
deltaStart(offset: number): OffsetRange;
|
|
13
|
-
deltaEnd(offset: number): OffsetRange;
|
|
14
|
-
contains(offset: number): boolean;
|
|
15
|
-
containsRange(other: OffsetRange): boolean;
|
|
16
|
-
intersects(other: OffsetRange): boolean;
|
|
17
|
-
intersectsOrTouches(other: OffsetRange): boolean;
|
|
18
|
-
intersect(other: OffsetRange): OffsetRange | undefined;
|
|
19
|
-
join(other: OffsetRange): OffsetRange;
|
|
20
|
-
isBefore(other: OffsetRange): boolean;
|
|
21
|
-
isAfter(other: OffsetRange): boolean;
|
|
22
|
-
substring(str: string): string;
|
|
23
|
-
slice<T>(arr: readonly T[]): T[];
|
|
24
|
-
equals(other: OffsetRange): boolean;
|
|
25
|
-
toString(): string;
|
|
26
|
-
}
|
package/dist/core/selection.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SourceOffset } from './sourceOffset.js';
|
|
2
|
-
import { OffsetRange } from './offsetRange.js';
|
|
3
|
-
export declare class Selection {
|
|
4
|
-
readonly anchor: SourceOffset;
|
|
5
|
-
readonly active: SourceOffset;
|
|
6
|
-
static collapsed(offset: SourceOffset): Selection;
|
|
7
|
-
constructor(anchor: SourceOffset, active: SourceOffset);
|
|
8
|
-
get isCollapsed(): boolean;
|
|
9
|
-
get isForward(): boolean;
|
|
10
|
-
get range(): OffsetRange;
|
|
11
|
-
collapseToActive(): Selection;
|
|
12
|
-
withActive(active: SourceOffset): Selection;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type SourceOffset = number;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { OffsetRange } from './offsetRange.js';
|
|
2
|
-
export declare class StringReplacement {
|
|
3
|
-
readonly replaceRange: OffsetRange;
|
|
4
|
-
readonly newText: string;
|
|
5
|
-
static insert(offset: number, text: string): StringReplacement;
|
|
6
|
-
static replace(range: OffsetRange, text: string): StringReplacement;
|
|
7
|
-
static delete(range: OffsetRange): StringReplacement;
|
|
8
|
-
constructor(replaceRange: OffsetRange, newText: string);
|
|
9
|
-
get isEmpty(): boolean;
|
|
10
|
-
equals(other: StringReplacement): boolean;
|
|
11
|
-
toString(): string;
|
|
12
|
-
}
|
|
13
|
-
export declare class StringEdit {
|
|
14
|
-
static readonly empty: StringEdit;
|
|
15
|
-
static single(replacement: StringReplacement): StringEdit;
|
|
16
|
-
static replace(range: OffsetRange, text: string): StringEdit;
|
|
17
|
-
static insert(offset: number, text: string): StringEdit;
|
|
18
|
-
static delete(range: OffsetRange): StringEdit;
|
|
19
|
-
readonly replacements: readonly StringReplacement[];
|
|
20
|
-
constructor(replacements: readonly StringReplacement[]);
|
|
21
|
-
get isEmpty(): boolean;
|
|
22
|
-
apply(base: string): string;
|
|
23
|
-
inverse(original: string): StringEdit;
|
|
24
|
-
equals(other: StringEdit): boolean;
|
|
25
|
-
mapOffset(offset: number): number;
|
|
26
|
-
toString(): string;
|
|
27
|
-
}
|
package/dist/core/wordUtils.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function findWordBoundaryLeft(text: string, offset: number): number;
|
|
2
|
-
export declare function findWordBoundaryRight(text: string, offset: number): number;
|
|
3
|
-
export declare function findWordAt(text: string, offset: number): {
|
|
4
|
-
start: number;
|
|
5
|
-
end: number;
|
|
6
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { MonacoSyntaxHighlighter, IMonarchApi } from './monacoSyntaxHighlighter.js';
|
|
2
|
-
/** The Monarch language definitions the default highlighter wires up. */
|
|
3
|
-
export interface IDefaultMonarchGrammars {
|
|
4
|
-
typescript: unknown;
|
|
5
|
-
javascript: unknown;
|
|
6
|
-
css: unknown;
|
|
7
|
-
html: unknown;
|
|
8
|
-
python: unknown;
|
|
9
|
-
rust: unknown;
|
|
10
|
-
shell: unknown;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A {@link MonacoSyntaxHighlighter} preloaded with a handful of common Monarch
|
|
14
|
-
* grammars (plus the usual short aliases). Unknown languages fall back to an
|
|
15
|
-
* unstyled single token, so the highlighter is always safe to call.
|
|
16
|
-
*
|
|
17
|
-
* The Monarch runtime and grammar definitions are injected so this package
|
|
18
|
-
* depends on `monaco-editor` for types only.
|
|
19
|
-
*/
|
|
20
|
-
export declare function createDefaultMonacoSyntaxHighlighter(monaco: IMonarchApi, grammars: IDefaultMonarchGrammars): MonacoSyntaxHighlighter;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { Token, type ISyntaxHighlighter, type ISyntaxHighlighterDocument, type ISyntaxHighlightedSnapshot, type SnapshotTokens, } from './syntaxHighlighter.js';
|
|
2
|
-
export { MonacoSyntaxHighlighter, type IMonarchApi } from './monacoSyntaxHighlighter.js';
|
|
3
|
-
export { createDefaultMonacoSyntaxHighlighter, type IDefaultMonarchGrammars } from './defaultMonacoSyntaxHighlighter.js';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { MonarchTokenizer } from 'monaco-editor/esm/vs/editor/standalone/common/monarch/monarchLexer.js';
|
|
2
|
-
import { ISyntaxHighlighterDocument, ISyntaxHighlighter } from './syntaxHighlighter.js';
|
|
3
|
-
/**
|
|
4
|
-
* The slice of monaco's Monarch internals the highlighter needs at runtime.
|
|
5
|
-
*
|
|
6
|
-
* `monaco-editor` is only a *type* dependency of this package; the caller (who
|
|
7
|
-
* owns a real monaco runtime) passes these in, keeping monaco out of the bundle.
|
|
8
|
-
*/
|
|
9
|
-
export interface IMonarchApi {
|
|
10
|
-
/** Compiles a Monarch language definition into the internal lexer form. */
|
|
11
|
-
compile(languageId: string, json: unknown): unknown;
|
|
12
|
-
MonarchTokenizer: new (languageService: unknown, standaloneThemeService: unknown, languageId: string, lexer: unknown, configurationService: unknown) => MonarchTokenizer;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* {@link ISyntaxHighlighter} backed by monaco's Monarch tokenizer.
|
|
16
|
-
*
|
|
17
|
-
* Highlighting is synchronous and incremental: an edit only re-runs the
|
|
18
|
-
* tokenizer from the first changed line onward (earlier lines and their saved
|
|
19
|
-
* end-states are reused), and the {@link LengthEdit} delivered with the new
|
|
20
|
-
* snapshot is the minimal char range whose colour actually changed.
|
|
21
|
-
*
|
|
22
|
-
* Only Monarch's *classic* tokenizer path is used, which needs neither a theme
|
|
23
|
-
* nor the DOM, so this runs headless (Node, workers) as well as in the browser.
|
|
24
|
-
*/
|
|
25
|
-
export declare class MonacoSyntaxHighlighter implements ISyntaxHighlighter {
|
|
26
|
-
private readonly _monaco;
|
|
27
|
-
private readonly _grammars;
|
|
28
|
-
private readonly _tokenizers;
|
|
29
|
-
/**
|
|
30
|
-
* @param _monaco The Monarch runtime ({@link IMonarchApi}), injected so this
|
|
31
|
-
* package depends on `monaco-editor` for types only.
|
|
32
|
-
* @param _grammars Maps a language id to its Monarch language definition.
|
|
33
|
-
*/
|
|
34
|
-
constructor(_monaco: IMonarchApi, _grammars: ReadonlyMap<string, unknown>);
|
|
35
|
-
create(language: string, initialText: string): ISyntaxHighlighterDocument;
|
|
36
|
-
dispose(): void;
|
|
37
|
-
private _tokenizerFor;
|
|
38
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { IObservableWithChange, ITransaction, IDisposable } from '@vscode/observables';
|
|
2
|
-
import { OffsetRange } from '../core/offsetRange.js';
|
|
3
|
-
import { StringEdit } from '../core/stringEdit.js';
|
|
4
|
-
import { LengthEdit } from '../core/lengthEdit.js';
|
|
5
|
-
export interface ISyntaxHighlighter {
|
|
6
|
-
create(language: string, initialText: string): ISyntaxHighlighterDocument;
|
|
7
|
-
}
|
|
8
|
-
export interface ISyntaxHighlighterDocument extends IDisposable {
|
|
9
|
-
/**
|
|
10
|
-
* Apply a source edit. The {@link snapshot} updates synchronously within
|
|
11
|
-
* `tx`, and the change it carries is the *minimal* {@link LengthEdit} that
|
|
12
|
-
* actually re-coloured — not the whole document.
|
|
13
|
-
*/
|
|
14
|
-
update(edit: StringEdit, tx: ITransaction): void;
|
|
15
|
-
/**
|
|
16
|
-
* The current snapshot. Its change reason is a {@link LengthEdit} mapping
|
|
17
|
-
* the previous snapshot's offsets to this one's wherever tokens changed.
|
|
18
|
-
*/
|
|
19
|
-
readonly snapshot: IObservableWithChange<ISyntaxHighlightedSnapshot, LengthEdit>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* An immutable view of one document's tokens at a point in time. It may be a
|
|
23
|
-
* thin view over the highlighter's mutable state: once the underlying document
|
|
24
|
-
* advances, calling a stale snapshot is allowed to throw.
|
|
25
|
-
*
|
|
26
|
-
* Token stability: across snapshots `S1 -> S2` (with the change delivered as a
|
|
27
|
-
* {@link LengthEdit}), `getTokens(r)` returns the same tokens for any range `r`
|
|
28
|
-
* not touched by that edit. Only ranges the edit reports as changed may recolour.
|
|
29
|
-
*/
|
|
30
|
-
export interface ISyntaxHighlightedSnapshot {
|
|
31
|
-
/**
|
|
32
|
-
* Tokens covering a region that contains `queryRange`. Tokens are never
|
|
33
|
-
* split: the returned {@link SnapshotTokens.range} is `queryRange` *grown*
|
|
34
|
-
* to whole-token boundaries, so a token that straddles an end of
|
|
35
|
-
* `queryRange` is returned in full. The result is dense over that grown
|
|
36
|
-
* range — `sum(token.length) === range.length` — which is why the range is
|
|
37
|
-
* returned alongside the tokens.
|
|
38
|
-
*/
|
|
39
|
-
getTokens(queryRange: OffsetRange): SnapshotTokens;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A run of {@link Token}s together with the exact {@link OffsetRange} they
|
|
43
|
-
* cover.
|
|
44
|
-
*
|
|
45
|
-
* Because tokens are returned whole (never clipped), this is the natural unit
|
|
46
|
-
* of structural comparison: for any region untouched by an edit, two snapshots
|
|
47
|
-
* return an equal `SnapshotTokens` (same `range`, same token lengths/classes).
|
|
48
|
-
*/
|
|
49
|
-
export interface SnapshotTokens {
|
|
50
|
-
readonly range: OffsetRange;
|
|
51
|
-
readonly tokens: readonly Token[];
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* A coloured run of `length` characters. Tokens are *dense* and *offset-free*:
|
|
55
|
-
* a snapshot's tokens for a range cover it exactly, back to back, so
|
|
56
|
-
* `sum(token.length) === range.length`. A token never stores where it is — its
|
|
57
|
-
* position is implied by the lengths of the tokens before it, mirroring how the
|
|
58
|
-
* rest of the editor keeps source offsets out of its data structures.
|
|
59
|
-
*/
|
|
60
|
-
export declare class Token {
|
|
61
|
-
readonly length: number;
|
|
62
|
-
/** CSS class for this run, or `undefined` for an unstyled run. */
|
|
63
|
-
readonly className: string | undefined;
|
|
64
|
-
constructor(length: number,
|
|
65
|
-
/** CSS class for this run, or `undefined` for an unstyled run. */
|
|
66
|
-
className: string | undefined);
|
|
67
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BlockAstNode, DocumentAstNode, ListAstNode } from '../parser/ast.js';
|
|
2
|
-
/**
|
|
3
|
-
* Move the cursor one position left or right, skipping over hidden marker
|
|
4
|
-
* ranges in inactive blocks (and inactive items of an active list).
|
|
5
|
-
*/
|
|
6
|
-
export declare function nextCursorPosition(doc: DocumentAstNode, activeBlock: BlockAstNode | undefined, cursor: number, direction: 'left' | 'right'): number;
|
|
7
|
-
export declare function findActiveListItemIndex(list: ListAstNode, cursorOffset: number): number | undefined;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { StringValue } from '../core/stringValue.js';
|
|
2
|
-
import { StringEdit } from '../core/stringEdit.js';
|
|
3
|
-
import { Selection } from '../core/selection.js';
|
|
4
|
-
import { BlockAstNode, DocumentAstNode } from '../parser/ast.js';
|
|
5
|
-
export declare const NO_ACTIVE_BLOCKS: unique symbol;
|
|
6
|
-
export declare class EditorModel {
|
|
7
|
-
private readonly _parser;
|
|
8
|
-
/**
|
|
9
|
-
* The most recent edit applied to {@link sourceText}, used by
|
|
10
|
-
* {@link document} to let the parser link incrementally edited code
|
|
11
|
-
* blocks. Only trusted when it exactly bridges the previous and current
|
|
12
|
-
* source text (see {@link document}).
|
|
13
|
-
*/
|
|
14
|
-
private _pendingEdit;
|
|
15
|
-
readonly sourceText: import('@vscode/observables').ISettableObservable<StringValue, void>;
|
|
16
|
-
/**
|
|
17
|
-
* The current selection, or `undefined` when the editor has no caret
|
|
18
|
-
* (e.g. an inactive/unfocused rendering).
|
|
19
|
-
*/
|
|
20
|
-
readonly selection: import('@vscode/observables').ISettableObservable<Selection | undefined, void>;
|
|
21
|
-
/**
|
|
22
|
-
* Forces the rendered active-block set. `undefined` (the default)
|
|
23
|
-
* derives the set from the current selection range (see
|
|
24
|
-
* {@link activeBlocks}). The sentinel {@link NO_ACTIVE_BLOCKS} forces
|
|
25
|
-
* "no active block" — useful in fixtures that always want the
|
|
26
|
-
* collapsed/inactive rendering.
|
|
27
|
-
*/
|
|
28
|
-
readonly activeBlocksOverride: import('@vscode/observables').ISettableObservable<readonly BlockAstNode[] | typeof NO_ACTIVE_BLOCKS | undefined, void>;
|
|
29
|
-
readonly cursorOffset: import('@vscode/observables').IObservableWithChange<number | undefined, void>;
|
|
30
|
-
/**
|
|
31
|
-
* The parsed document. Threads the previous document into the parser so
|
|
32
|
-
* unchanged blocks keep their object identity across reparses (see
|
|
33
|
-
* {@link MarkdownParser.parse}). Writing `previous` inside the compute is
|
|
34
|
-
* a safe optimization: `derived` only recomputes when `sourceText`
|
|
35
|
-
* changes, and the result is structurally identical to a full reparse.
|
|
36
|
-
*/
|
|
37
|
-
readonly document: import('@vscode/observables').IObservableWithChange<DocumentAstNode, void>;
|
|
38
|
-
/**
|
|
39
|
-
* Block that contains the cursor (selection's active end). Used by
|
|
40
|
-
* cursor navigation to know which block's marker ranges count as
|
|
41
|
-
* visible. Unaffected by {@link activeBlocksOverride} because
|
|
42
|
-
* navigation is independent of rendering.
|
|
43
|
-
*/
|
|
44
|
-
readonly activeBlock: import('@vscode/observables').IObservableWithChange<BlockAstNode | undefined, void>;
|
|
45
|
-
/**
|
|
46
|
-
* All blocks whose source range intersects the current selection.
|
|
47
|
-
* The rendering side uses this to decide which blocks render in
|
|
48
|
-
* their expanded (markers-visible) form. When the selection is
|
|
49
|
-
* collapsed this is a one-element set holding {@link activeBlock}.
|
|
50
|
-
*/
|
|
51
|
-
readonly activeBlocks: import('@vscode/observables').IObservableWithChange<Set<BlockAstNode>, void>;
|
|
52
|
-
applyEdit(edit: StringEdit): void;
|
|
53
|
-
applyEditForSelection(edit: StringEdit): void;
|
|
54
|
-
}
|
package/dist/model/index.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { BlockAstNode } from '../parser/ast.js';
|
|
2
|
-
import { ViewNode } from '../view/content/viewNode.js';
|
|
3
|
-
import { VisualLineMap } from '../view/visualLineMap.js';
|
|
4
|
-
/**
|
|
5
|
-
* One block's place in the rendered document.
|
|
6
|
-
*
|
|
7
|
-
* `height` is in CSS pixels. It is either a real DOM measurement
|
|
8
|
-
* (`isMeasured: true`) or an estimate produced when the block is not
|
|
9
|
-
* currently mounted (`isMeasured: false`). Estimates exist so virtual
|
|
10
|
-
* rendering can size the scroll container without mounting every block.
|
|
11
|
-
*
|
|
12
|
-
* `visualLineMap` and `viewNode` are set only when the block is mounted
|
|
13
|
-
* and measured. Cursor positioning, selection painting and up/down
|
|
14
|
-
* navigation read through `visualLineMap`; the debug view walks
|
|
15
|
-
* `viewNode` to enumerate text leaves for per-character introspection.
|
|
16
|
-
* Unmeasured blocks have neither.
|
|
17
|
-
*/
|
|
18
|
-
export interface BlockMeasurement {
|
|
19
|
-
readonly block: BlockAstNode;
|
|
20
|
-
readonly absoluteStart: number;
|
|
21
|
-
readonly height: number;
|
|
22
|
-
readonly isMeasured: boolean;
|
|
23
|
-
readonly visualLineMap: VisualLineMap | undefined;
|
|
24
|
-
readonly viewNode: ViewNode | undefined;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The set of measurements/estimates the view has produced for the current
|
|
28
|
-
* document. This is the "view → derived facts about layout" channel: the
|
|
29
|
-
* view writes here as a side effect of rendering and measuring; the
|
|
30
|
-
* controller (and selection/cursor rendering) reads from here.
|
|
31
|
-
*
|
|
32
|
-
* Keeping these facts in their own observable model — instead of as ad-hoc
|
|
33
|
-
* fields on the view — preserves the invariant
|
|
34
|
-
*
|
|
35
|
-
* view(model + Δ) = view(model) + Δ
|
|
36
|
-
*
|
|
37
|
-
* i.e. the view becomes a pure function of (EditorModel, MeasuredLayoutModel).
|
|
38
|
-
* Everything else that depends on layout (controller, commands) goes
|
|
39
|
-
* through this model and never touches view fields directly.
|
|
40
|
-
*/
|
|
41
|
-
export declare class MeasuredLayoutModel {
|
|
42
|
-
readonly measurements: import('@vscode/observables').ISettableObservable<readonly BlockMeasurement[], void>;
|
|
43
|
-
/**
|
|
44
|
-
* Concatenated visual line map across all mounted blocks. Lines are
|
|
45
|
-
* left in DOM (client-coordinate) y order — each per-block map already
|
|
46
|
-
* uses absolute client coordinates from `getClientRects()`, so the
|
|
47
|
-
* concatenation is well-formed without re-sorting.
|
|
48
|
-
*/
|
|
49
|
-
readonly visualLineMap: import('@vscode/observables').IObservableWithChange<VisualLineMap, void>;
|
|
50
|
-
}
|