@monaco-neovim-wasm/lib 0.1.18 → 0.1.20

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 (46) hide show
  1. package/dist/client/bufferSync.d.ts +92 -0
  2. package/dist/client/buffers.d.ts +42 -0
  3. package/dist/client/clipboard.d.ts +15 -0
  4. package/dist/client/cursor.d.ts +45 -0
  5. package/dist/client/editorCursorPosition.d.ts +22 -0
  6. package/dist/client/editorListeners.d.ts +35 -0
  7. package/dist/client/execLua.d.ts +7 -0
  8. package/dist/client/hostAutocmdInstaller.d.ts +21 -0
  9. package/dist/client/hostAutocmds.d.ts +8 -0
  10. package/dist/client/hostCommands.d.ts +23 -0
  11. package/dist/client/inputEventDeduper.d.ts +14 -0
  12. package/dist/client/insertDelegation.d.ts +72 -0
  13. package/dist/client/keyAllowlist.d.ts +20 -0
  14. package/dist/client/keyHandler.d.ts +39 -0
  15. package/dist/client/modes.d.ts +3 -0
  16. package/dist/client/monacoNeovimClient.d.ts +141 -0
  17. package/dist/client/mouse.d.ts +16 -0
  18. package/dist/client/notifyRouter.d.ts +15 -0
  19. package/dist/client/options.d.ts +75 -0
  20. package/dist/client/overlays.d.ts +52 -0
  21. package/dist/client/recording.d.ts +17 -0
  22. package/dist/client/redraw.d.ts +35 -0
  23. package/dist/client/resize.d.ts +24 -0
  24. package/dist/client/searchHighlights.d.ts +26 -0
  25. package/dist/client/sessionBootstrap.d.ts +31 -0
  26. package/dist/client/sessionLifecycle.d.ts +29 -0
  27. package/dist/client/sessionPrime.d.ts +47 -0
  28. package/dist/client/textInputListeners.d.ts +40 -0
  29. package/dist/client/ui.d.ts +3 -0
  30. package/dist/client/viewport.d.ts +25 -0
  31. package/dist/client/visualSelection.d.ts +56 -0
  32. package/dist/index.d.ts +2 -2
  33. package/dist/monaco-neovim-wasm.es.js +4556 -3531
  34. package/dist/nvimWorker.worker.js +709 -674
  35. package/dist/nvimWorkerAsyncify.worker.js +675 -640
  36. package/dist/nvimWorkerCommon.d.ts +51 -0
  37. package/dist/types.d.ts +104 -0
  38. package/dist/utils/dom.d.ts +4 -0
  39. package/dist/utils/lsp.d.ts +21 -0
  40. package/dist/utils/msgpackHandles.d.ts +1 -0
  41. package/dist/utils/nvimInput.d.ts +2 -0
  42. package/dist/utils/sessionFiles.d.ts +17 -0
  43. package/dist/utils/shadowLines.d.ts +1 -0
  44. package/dist/utils/utf8.d.ts +4 -0
  45. package/package.json +1 -1
  46. package/dist/monacoNeovim.d.ts +0 -355
@@ -0,0 +1,92 @@
1
+ import * as monaco from "monaco-editor";
2
+ import type { editor as MonacoEditor } from "monaco-editor";
3
+ export type PendingBufSetText = {
4
+ startRow: number;
5
+ startColByte: number;
6
+ endRow: number;
7
+ endColByte: number;
8
+ lines: string[];
9
+ };
10
+ export type BufferState = {
11
+ id: number;
12
+ name: string;
13
+ filetype: string;
14
+ model: monaco.editor.ITextModel;
15
+ createdModel: boolean;
16
+ shadowLines: string[] | null;
17
+ pendingBufEdits: PendingBufSetText[];
18
+ pendingFullSync: boolean;
19
+ pendingCursorSync: boolean;
20
+ };
21
+ export type BufferSyncManagerInit = {
22
+ editor: MonacoEditor.IStandaloneCodeEditor;
23
+ nowMs: () => number;
24
+ debugLog: (line: string) => void;
25
+ rpcCall: (method: string, params: unknown[]) => Promise<any>;
26
+ sendNotify: (method: string, params: unknown[]) => void;
27
+ isSessionRunning: () => boolean;
28
+ getBufHandle: () => number | null;
29
+ getActiveState: () => BufferState | null;
30
+ ensureActiveState: () => BufferState | null;
31
+ getBufferState: (id: number) => BufferState | null;
32
+ isDelegateInsertToMonaco: () => boolean;
33
+ isExitingInsertMode: () => boolean;
34
+ isCompositionActive: () => boolean;
35
+ setPendingResyncAfterComposition: (pending: boolean) => void;
36
+ getSyncModelFromMonaco: () => "insertOnly" | "always" | "never";
37
+ getInsertSyncDebounceMs: () => number;
38
+ scheduleVisualSelectionRefresh: () => void;
39
+ getLastMode: () => string;
40
+ isVisualMode: (mode: string) => boolean;
41
+ incrementPendingNvimBufUpdates: () => void;
42
+ decrementPendingNvimBufUpdates: () => number;
43
+ isPendingVisualRefresh: () => boolean;
44
+ setPendingVisualRefresh: (pending: boolean) => void;
45
+ getLastCursorPos: () => monaco.Position | null;
46
+ getEditorPosition: () => monaco.Position | null;
47
+ setSuppressCursorSync: (suppress: boolean) => void;
48
+ setApplyingFromNvim: (applying: boolean) => void;
49
+ isApplyingFromNvim: () => boolean;
50
+ syncCursorToNvimNow: () => void;
51
+ };
52
+ export type MonacoModelChangeResult = {
53
+ kind: "noop";
54
+ } | {
55
+ kind: "resyncScheduled";
56
+ } | {
57
+ kind: "syncToNvimScheduled";
58
+ } | {
59
+ kind: "delegatedInsertPatched";
60
+ dotRepeat?: {
61
+ deleted: number;
62
+ text: string;
63
+ simple: boolean;
64
+ };
65
+ resetDotRepeat?: boolean;
66
+ resetReplayPossible?: boolean;
67
+ };
68
+ export declare class BufferSyncManager {
69
+ private readonly init;
70
+ private resyncTimer;
71
+ private monacoToNvimTimer;
72
+ private flushTimer;
73
+ private ignoreActiveBufLinesEventsUntil;
74
+ constructor(init: BufferSyncManagerInit);
75
+ reset(): void;
76
+ cancelPendingFlush(): void;
77
+ scheduleResync(): void;
78
+ private resyncBufferFromNvim;
79
+ scheduleSyncBufferToNvim(): void;
80
+ syncBufferToNvimNow(): void;
81
+ applyBuffer(lines?: string[]): void;
82
+ handleMonacoModelChange(ev: monaco.editor.IModelContentChangedEvent): MonacoModelChangeResult;
83
+ scheduleCursorSyncToNvim(): void;
84
+ private scheduleFlushPendingMonacoSync;
85
+ flushPendingMonacoSync(): void;
86
+ flushPendingMonacoSyncBlocking(): Promise<void>;
87
+ handleNvimBufLinesEvent(params: unknown[], extractBufId: (val: unknown) => number | null): Promise<void>;
88
+ private computeLinePatch;
89
+ private applyLinePatch;
90
+ private applyLinePatchToModel;
91
+ private setModelText;
92
+ }
@@ -0,0 +1,42 @@
1
+ import type { editor as MonacoEditor } from "monaco-editor";
2
+ import type { BufferState } from "./bufferSync";
3
+ export type BufferManagerInit = {
4
+ editor: MonacoEditor.IStandaloneCodeEditor;
5
+ };
6
+ export declare class BufferManager {
7
+ private readonly editor;
8
+ private readonly buffers;
9
+ private readonly buffersByName;
10
+ constructor(init: BufferManagerInit);
11
+ getById(id: number): BufferState | null;
12
+ getIdByName(name: string): number | null;
13
+ getActiveState(bufHandle: number | null): BufferState | null;
14
+ ensureState(bufHandle: number | null): BufferState | null;
15
+ clear(): void;
16
+ detach(id: number): void;
17
+ delete(id: number): void;
18
+ setName(id: number, name: string): void;
19
+ setFiletype(id: number, filetype: string): void;
20
+ enterBuffer(arg: {
21
+ buf: number;
22
+ name?: string;
23
+ filetype?: string;
24
+ }, deps: {
25
+ bufHandle: number | null;
26
+ setBufHandle: (id: number) => void;
27
+ rpcCall: (method: string, params: unknown[]) => Promise<any>;
28
+ setSuppressCursorSync: (suppress: boolean) => void;
29
+ delegateInsertToMonaco: boolean;
30
+ flushPendingBeforeSwitch?: () => void;
31
+ syncTabstopFromMonaco?: () => void;
32
+ syncTabstop: boolean;
33
+ requestSearchHighlightRefresh: () => void;
34
+ }): Promise<void>;
35
+ openText(input: {
36
+ path: string;
37
+ text: string;
38
+ }, deps: {
39
+ rpcCall: (method: string, params: unknown[]) => Promise<any>;
40
+ extractBufId: (val: unknown) => number | null;
41
+ }): Promise<void>;
42
+ }
@@ -0,0 +1,15 @@
1
+ import type { ClipboardAdapter, StatusEmitter } from "../types";
2
+ export type ClipboardManagerInit = {
3
+ adapter?: ClipboardAdapter | null;
4
+ status?: StatusEmitter;
5
+ getLastClipboardText: () => string;
6
+ setLastClipboardText: (text: string) => void;
7
+ sendRpcResponse: (msgid: number, error: unknown, result: unknown) => void;
8
+ debugLog?: (line: string) => void;
9
+ };
10
+ export declare class ClipboardManager {
11
+ private readonly init;
12
+ constructor(init: ClipboardManagerInit);
13
+ handleCopy(lines: string[]): void;
14
+ handlePaste(msgid: number): void;
15
+ }
@@ -0,0 +1,45 @@
1
+ import * as monaco from "monaco-editor";
2
+ import type { editor as MonacoEditor } from "monaco-editor";
3
+ export type CursorManagerInit = {
4
+ editor: MonacoEditor.IStandaloneCodeEditor;
5
+ nowMs: () => number;
6
+ debugLog: (line: string) => void;
7
+ isCompositionActive: () => boolean;
8
+ setSuppressCursorSync: (suppress: boolean) => void;
9
+ isSessionRunning: () => boolean;
10
+ rpcCall: (method: string, params: unknown[]) => Promise<any>;
11
+ getLastMode: () => string;
12
+ setLastMode: (mode: string) => void;
13
+ onModeChange?: (mode: string) => void;
14
+ };
15
+ export declare class CursorManager {
16
+ private readonly init;
17
+ private lastCursorPos;
18
+ private lastCursorStyle;
19
+ private lastCursorBlink;
20
+ private lastCursorWidth;
21
+ private initialCursorWidth;
22
+ private typicalFullWidth;
23
+ private optimisticCursorUntil;
24
+ private optimisticCursorPos;
25
+ private optimisticCursorPrevPos;
26
+ private cursorRefreshTimer;
27
+ private cursorRefreshInFlight;
28
+ private cursorRefreshPending;
29
+ private cursorUpdateTimer;
30
+ private pendingCursorUpdate;
31
+ constructor(init: CursorManagerInit);
32
+ reset(): void;
33
+ setCursorMetricsFromEditor(): void;
34
+ getLastCursorPos(): monaco.Position | null;
35
+ setLastCursorPos(pos: monaco.Position | null): void;
36
+ applyCursorStyle(mode: string): void;
37
+ applyOptimisticInsert(text: string, isCmdlineVisible: () => boolean): void;
38
+ scheduleCursorUpdate(lineNumber: number, column: number, applyCursorSelectionFromNvim: (ln: number, col: number) => Promise<void>): void;
39
+ scheduleCursorRefresh(refreshCursorMode: () => Promise<unknown>): void;
40
+ refreshCursorMode(applyCursorSelectionFromNvim: (ln: number, col: number) => Promise<void>): Promise<boolean>;
41
+ }
42
+ export declare function clampCursor(editor: MonacoEditor.IStandaloneCodeEditor, ln: number, col0: number): {
43
+ line: number;
44
+ col: number;
45
+ };
@@ -0,0 +1,22 @@
1
+ import * as monaco from "monaco-editor";
2
+ import type { editor as MonacoEditor } from "monaco-editor";
3
+ export type CursorPositionHandlerInit = {
4
+ editor: MonacoEditor.IStandaloneCodeEditor;
5
+ nowMs: () => number;
6
+ getLastCursorPos: () => monaco.Position | null;
7
+ setLastCursorPos: (pos: monaco.Position) => void;
8
+ isDelegatingInsert: () => boolean;
9
+ isSuppressCursorSync: () => boolean;
10
+ getLastMode: () => string;
11
+ getIgnoreMonacoCursorSyncToNvimUntil: () => number;
12
+ isCompositionActive: () => boolean;
13
+ positionPreedit: () => void;
14
+ scheduleCursorSyncToNvim: () => void;
15
+ syncCursorToNvimNow: (force: boolean) => void;
16
+ restorePendingSelections: () => boolean;
17
+ };
18
+ export declare class CursorPositionHandler {
19
+ private readonly init;
20
+ constructor(init: CursorPositionHandlerInit);
21
+ handle(ev: monaco.editor.ICursorPositionChangedEvent): void;
22
+ }
@@ -0,0 +1,35 @@
1
+ import * as monaco from "monaco-editor";
2
+ import type { editor as MonacoEditor } from "monaco-editor";
3
+ export type DisposableLike = {
4
+ dispose(): void;
5
+ };
6
+ export type EditorListenersManagerInit = {
7
+ editor: MonacoEditor.IStandaloneCodeEditor;
8
+ instanceClassName: string;
9
+ };
10
+ export type EditorListenersHandlers = {
11
+ onDidChangeModel: () => void;
12
+ onKeyDown: (ev: monaco.IKeyboardEvent) => void;
13
+ onMouseDown: (ev: monaco.editor.IEditorMouseEvent) => void;
14
+ onDidChangeCursorSelection: (ev: monaco.editor.ICursorSelectionChangedEvent) => void;
15
+ onDidChangeCursorPosition: (ev: monaco.editor.ICursorPositionChangedEvent) => void;
16
+ onDidScrollChangePreedit: () => void;
17
+ onDidScrollChangeSearch: () => void;
18
+ onDidChangeConfiguration: (e: monaco.editor.ConfigurationChangedEvent) => void;
19
+ onDidLayoutChange?: () => void;
20
+ onDidChangeConfigurationLayout?: (e: monaco.editor.ConfigurationChangedEvent) => void;
21
+ onModelContentChange: (ev: monaco.editor.IModelContentChangedEvent) => void;
22
+ initTextInputListeners: () => DisposableLike[];
23
+ };
24
+ export declare class EditorListenersManager {
25
+ private readonly init;
26
+ private disposables;
27
+ private modelContentDisposable;
28
+ private originalOptions;
29
+ constructor(init: EditorListenersManagerInit);
30
+ private captureOriginalOptions;
31
+ private applyInstanceClass;
32
+ private attachActiveModelListener;
33
+ attach(handlers: EditorListenersHandlers): void;
34
+ detach(): void;
35
+ }
@@ -0,0 +1,7 @@
1
+ export type RpcCall = (method: string, params: unknown[]) => Promise<unknown>;
2
+ export declare class ExecLuaClient {
3
+ private execLuaAvailable;
4
+ private readonly rpcCall;
5
+ constructor(rpcCall: RpcCall);
6
+ execLua<T = unknown>(code: string, args?: unknown[]): Promise<T>;
7
+ }
@@ -0,0 +1,21 @@
1
+ export type HostAutocmdInstallerInit = {
2
+ isClipboardEnabled: () => boolean;
3
+ isWrappedLineMotionsEnabled: () => boolean;
4
+ isScrollMotionsEnabled: () => boolean;
5
+ isSyncScrolloffEnabled: () => boolean;
6
+ hasScrolloffOverride: () => boolean;
7
+ isHostCommandsEnabled: () => boolean;
8
+ rpcCall: (method: string, params: unknown[]) => Promise<any>;
9
+ execLua: (code: string, args: unknown[]) => Promise<any>;
10
+ };
11
+ export declare class HostAutocmdInstaller {
12
+ private readonly init;
13
+ private installed;
14
+ private channelId;
15
+ constructor(init: HostAutocmdInstallerInit);
16
+ reset(): void;
17
+ isInstalled(): boolean;
18
+ markInstalledFromNotify(): void;
19
+ getChannelId(): number | null;
20
+ install(): Promise<void>;
21
+ }
@@ -0,0 +1,8 @@
1
+ export type HostAutocmdsLuaOptions = {
2
+ clipboard: boolean;
3
+ wrappedLineMotions: boolean;
4
+ scrollMotions: boolean;
5
+ syncScrolloff: boolean;
6
+ hostCommands: boolean;
7
+ };
8
+ export declare function buildHostAutocmdsLua(opts: HostAutocmdsLuaOptions): string;
@@ -0,0 +1,23 @@
1
+ import type { editor as MonacoEditor } from "monaco-editor";
2
+ import type { BufferState } from "./bufferSync";
3
+ import type { BufferManager } from "./buffers";
4
+ import type { FileSystemAdapter, HostCommand, StatusEmitter } from "../types";
5
+ export type HostCommandManagerInit = {
6
+ editor: MonacoEditor.IStandaloneCodeEditor;
7
+ bufferManager: BufferManager;
8
+ fileSystem?: FileSystemAdapter | null;
9
+ onHostCommand?: (cmd: HostCommand) => void | Promise<void>;
10
+ status: StatusEmitter;
11
+ seedName: string;
12
+ rpcCall: (method: string, params: unknown[]) => Promise<any>;
13
+ openText: (args: {
14
+ path: string;
15
+ text: string;
16
+ }) => Promise<void>;
17
+ getActiveState: () => BufferState | null;
18
+ };
19
+ export declare class HostCommandManager {
20
+ private readonly init;
21
+ constructor(init: HostCommandManagerInit);
22
+ handle(arg: Record<string, unknown>): Promise<void>;
23
+ }
@@ -0,0 +1,14 @@
1
+ export type InputEventDeduperInit = {
2
+ nowMs: () => number;
3
+ };
4
+ export declare class InputEventDeduper {
5
+ private readonly init;
6
+ private armed;
7
+ private untilMs;
8
+ private target;
9
+ constructor(init: InputEventDeduperInit);
10
+ reset(): void;
11
+ arm(target?: EventTarget | null, ms?: number): void;
12
+ shouldIgnore(target?: EventTarget | null): boolean;
13
+ clear(): void;
14
+ }
@@ -0,0 +1,72 @@
1
+ import type { editor as MonacoEditor } from "monaco-editor";
2
+ import type { BufferState } from "./bufferSync";
3
+ export type InsertDelegationManagerInit = {
4
+ editor: MonacoEditor.IStandaloneCodeEditor;
5
+ nowMs: () => number;
6
+ debugLog: (line: string) => void;
7
+ setPreedit: (text: string | null) => void;
8
+ setEditorReadOnly: (readOnly: boolean) => void;
9
+ getRecordingRegister: () => string;
10
+ isNvimBlocking: () => boolean;
11
+ getActiveState: () => BufferState | null;
12
+ ensureActiveState: () => BufferState | null;
13
+ flushPendingMonacoSync: () => void;
14
+ flushPendingMonacoSyncBlocking: () => Promise<void>;
15
+ cancelPendingBufferFlush: () => void;
16
+ isSessionRunning: () => boolean;
17
+ getBufHandle: () => number | null;
18
+ rpcCall: (method: string, params: unknown[]) => Promise<any>;
19
+ sendInput: (keys: string) => void;
20
+ };
21
+ export type IgnoreInsertExitCursor = {
22
+ line: number;
23
+ col0: number;
24
+ untilMs: number;
25
+ };
26
+ export declare class InsertDelegationManager {
27
+ private readonly init;
28
+ private delegateInsertToMonaco;
29
+ private exitingInsertMode;
30
+ private pendingKeysAfterExit;
31
+ private exitInsertTimer;
32
+ private dotRepeatKeys;
33
+ private dotRepeatBackspaces;
34
+ private delegatedInsertReplayPossible;
35
+ private recentNormalKeys;
36
+ private lastDelegatedInsertPrefix;
37
+ private lastDelegatedDotRepeat;
38
+ private ignoreInsertExitCursor;
39
+ private ignoreMonacoCursorSyncToNvimUntil;
40
+ constructor(init: InsertDelegationManagerInit);
41
+ reset(): void;
42
+ isDelegating(): boolean;
43
+ isExitingInsertMode(): boolean;
44
+ getIgnoreMonacoCursorSyncToNvimUntil(): number;
45
+ recordRecentNormalKey(key: string): void;
46
+ getLastDelegatedDotRepeat(): {
47
+ prefix: string;
48
+ keys: string;
49
+ } | null;
50
+ clearLastDelegatedDotRepeat(): void;
51
+ setDelegatedInsertReplayPossible(possible: boolean): void;
52
+ appendPendingKeysAfterExit(keys: string): void;
53
+ shouldIgnoreInsertExitCursor(nowMs: number, ln: unknown, col0: unknown): boolean;
54
+ applyMode(mode: string): void;
55
+ armInsertExit(): void;
56
+ finalizeDelegatedInsertDotRepeat(): void;
57
+ exitDelegatedInsertMode(exitKey: string): void;
58
+ handleDelegatedInsertPatched(res: {
59
+ resetDotRepeat?: boolean;
60
+ resetReplayPossible?: boolean;
61
+ dotRepeat?: {
62
+ deleted: number;
63
+ text: string;
64
+ } | null;
65
+ }): void;
66
+ consumeDotRepeat(): {
67
+ keys: string;
68
+ backspaces: number;
69
+ };
70
+ setIgnoreInsertExitCursorFromEditor(): void;
71
+ private performDelegatedInsertExit;
72
+ }
@@ -0,0 +1,20 @@
1
+ export type KeyAllowlistManagerInit = {
2
+ ctrlKeysForNormalMode?: string[] | null;
3
+ ctrlKeysForInsertMode?: string[] | null;
4
+ altKeysForNormalMode?: string[] | null;
5
+ altKeysForInsertMode?: string[] | null;
6
+ metaKeysForNormalMode?: string[] | null;
7
+ metaKeysForInsertMode?: string[] | null;
8
+ };
9
+ export declare class KeyAllowlistManager {
10
+ private readonly ctrlKeysNormal;
11
+ private readonly ctrlKeysInsert;
12
+ private readonly altKeysNormal;
13
+ private readonly altKeysInsert;
14
+ private readonly metaKeysNormal;
15
+ private readonly metaKeysInsert;
16
+ constructor(init: KeyAllowlistManagerInit);
17
+ modifiedKeyName(ev: KeyboardEvent): string | null;
18
+ hasExplicitModAllowlist(insertMode: boolean): boolean;
19
+ shouldForwardModifiedKeys(ev: KeyboardEvent, insertMode: boolean): boolean;
20
+ }
@@ -0,0 +1,39 @@
1
+ import * as monaco from "monaco-editor";
2
+ export type KeyHandlerInsertDelegation = {
3
+ isExitingInsertMode: () => boolean;
4
+ isDelegating: () => boolean;
5
+ exitDelegatedInsertMode: (key: string) => void;
6
+ appendPendingKeysAfterExit: (keys: string) => void;
7
+ getLastDelegatedDotRepeat: () => {
8
+ prefix: string;
9
+ keys: string;
10
+ } | null;
11
+ clearLastDelegatedDotRepeat: () => void;
12
+ recordRecentNormalKey: (key: string) => void;
13
+ };
14
+ export type KeyHandlerManagerInit = {
15
+ nowMs: () => number;
16
+ shouldHandleKey: (ev: KeyboardEvent) => boolean;
17
+ translateKey: (ev: KeyboardEvent) => string | null;
18
+ hasExplicitModAllowlist: (insertMode: boolean) => boolean;
19
+ shouldForwardModifiedKeys: (ev: KeyboardEvent, insertMode: boolean) => boolean;
20
+ getLastMode: () => string;
21
+ isCompositionActive: () => boolean;
22
+ setCompositionActive: (active: boolean) => void;
23
+ setPendingEscAfterComposition: (pending: boolean) => void;
24
+ insertDelegation: KeyHandlerInsertDelegation;
25
+ handleNormalModeKey: (key: string) => void;
26
+ armIgnoreNextInputEvent: (target?: EventTarget | null, ms?: number) => void;
27
+ flushPendingMonacoSync: () => void;
28
+ sendInput: (keys: string) => void;
29
+ scheduleCursorRefresh: () => void;
30
+ scheduleVisualSelectionRefresh: () => void;
31
+ };
32
+ export declare class KeyHandlerManager {
33
+ private readonly init;
34
+ private ignoreTextKeydownUntil;
35
+ constructor(init: KeyHandlerManagerInit);
36
+ reset(): void;
37
+ setIgnoreTextKeydownUntil(deadlineMs: number): void;
38
+ handleKey(ev: monaco.IKeyboardEvent): void;
39
+ }
@@ -0,0 +1,3 @@
1
+ export declare function isVisualMode(mode: string): boolean;
2
+ export declare function isInsertLike(mode: string): boolean;
3
+ export declare function isCmdlineLike(mode: string): boolean;
@@ -0,0 +1,141 @@
1
+ import type { editor as MonacoEditor } from "monaco-editor";
2
+ import { NeovimWasmSession } from "../neovimWasmSession";
3
+ import type { MonacoNeovimOptions } from "../types";
4
+ export type { ClipboardAdapter, FileSystemAdapter, HostCommand, MonacoNeovimOptions, PopupMenuItem, StatusEmitter } from "../types";
5
+ export declare class MonacoNeovimClient {
6
+ private readonly editor;
7
+ private readonly opts;
8
+ private session;
9
+ private readonly notifyHandlers;
10
+ private bufHandle;
11
+ private uiCols;
12
+ private uiRows;
13
+ private wrapColumnApplied;
14
+ private wrapStrategyApplied;
15
+ private primeSent;
16
+ private suppressCursorSync;
17
+ private lastMode;
18
+ private monacoPrevOccurrencesHighlight;
19
+ private monacoPrevSelectionHighlight;
20
+ private monacoPrevSelectionHighlightMultiline;
21
+ private monacoHighlightsSuppressed;
22
+ private pendingNvimBufUpdates;
23
+ private readonly notifyRouter;
24
+ private readonly hostAutocmdInstaller;
25
+ private nvimScrolloff;
26
+ private readonly keyAllowlist;
27
+ private readonly execLuaClient;
28
+ private nextSeedLines;
29
+ private readonly overlays;
30
+ private readonly editorListeners;
31
+ private readonly redraw;
32
+ private readonly bufferSync;
33
+ private readonly bufferManager;
34
+ private readonly searchHighlights;
35
+ private readonly clipboard;
36
+ private readonly hostCommandManager;
37
+ private readonly cursor;
38
+ private readonly viewport;
39
+ private readonly recording;
40
+ private readonly insertDelegation;
41
+ private readonly visualSelection;
42
+ private readonly keyHandler;
43
+ private readonly mouse;
44
+ private readonly cursorPositionHandler;
45
+ private readonly sessionPrime;
46
+ private readonly instanceId;
47
+ private readonly instanceClassName;
48
+ private readonly resizeManager;
49
+ private compositionActive;
50
+ private pendingResyncAfterComposition;
51
+ private readonly inputEventDeduper;
52
+ private pendingEscAfterComposition;
53
+ private lastClipboardText;
54
+ private lastImeCommitAt;
55
+ private lastImeCommitText;
56
+ private nvimBlocking;
57
+ private editorReadOnly;
58
+ private applyingFromNvim;
59
+ private ignoreSelectionSyncUntil;
60
+ private debugLog;
61
+ private nowMs;
62
+ private sendImeText;
63
+ constructor(editor: MonacoEditor.IStandaloneCodeEditor, options?: MonacoNeovimOptions);
64
+ start(seedLines?: string[]): Promise<void>;
65
+ stop(silent?: boolean): void;
66
+ dispose(): void;
67
+ notify(method: string, params?: unknown[]): void;
68
+ call<T = unknown>(method: string, params?: unknown[]): Promise<T>;
69
+ command(cmd: string): void;
70
+ input(keys: string): void;
71
+ type(text: string, wrapEnter?: boolean): void;
72
+ paste(text: string): void;
73
+ execLua<T = unknown>(code: string, args?: unknown[]): Promise<T>;
74
+ getSession(): NeovimWasmSession | null;
75
+ resize(cols: number, rows: number): void;
76
+ resizeToEditor(): void;
77
+ private attachEditorListeners;
78
+ private handleActiveModelChanged;
79
+ private scheduleResizeToEditor;
80
+ private setPreedit;
81
+ private applyOptimisticInsert;
82
+ private positionPreedit;
83
+ private disposeEditorListeners;
84
+ private getActiveState;
85
+ private ensureActiveState;
86
+ private clearBufferStates;
87
+ private primeSession;
88
+ private handleRequest;
89
+ private handleNotifyMonacoCursorMove;
90
+ private handleNotifyMonacoScroll;
91
+ private handleNotifyMonacoReveal;
92
+ private handleNotifyMonacoMoveCursor;
93
+ private handleNotifyMonacoScrolloff;
94
+ private handleNotifyMonacoHostCommand;
95
+ private handleNotifyMonacoBufEnter;
96
+ private handleNotifyMonacoBufDelete;
97
+ private handleNotifyMonacoCursor;
98
+ private handleNotifyMonacoMode;
99
+ private handleNotifyMonacoRecording;
100
+ private initCmdlineUi;
101
+ private setCmdline;
102
+ private setCmdlineCursor;
103
+ private setMessage;
104
+ private setPopupmenu;
105
+ private applyMonacoWrap;
106
+ private syncTabstopFromMonaco;
107
+ private updatePopupmenuSelection;
108
+ private initTextInputListeners;
109
+ private scheduleResync;
110
+ private scheduleSyncBufferToNvim;
111
+ private syncBufferToNvimNow;
112
+ private applyBuffer;
113
+ private clearSearchHighlights;
114
+ private scheduleSearchHighlightRefresh;
115
+ private applyNvimMode;
116
+ private setEditorReadOnly;
117
+ private flushPendingMonacoSyncBlocking;
118
+ private sendInput;
119
+ private pasteText;
120
+ private handleMonacoModelChange;
121
+ private scheduleCursorSyncToNvim;
122
+ private flushPendingMonacoSync;
123
+ private syncCursorToNvimNow;
124
+ private installHostAutocmds;
125
+ private handleBufEnter;
126
+ private handleBufDelete;
127
+ private openText;
128
+ private sendNotify;
129
+ private sendRpcResponse;
130
+ private rpcCall;
131
+ private updateCursor;
132
+ private applyCursorSelectionFromNvim;
133
+ private scheduleCursorUpdate;
134
+ private requestSearchHighlightRefresh;
135
+ private scheduleCursorRefresh;
136
+ private refreshCursorMode;
137
+ private syncVisualSelectionColor;
138
+ private setMonacoHighlightsSuppressed;
139
+ private seedBuffer;
140
+ }
141
+ export declare function createMonacoNeovim(editor: MonacoEditor.IStandaloneCodeEditor, options?: MonacoNeovimOptions): MonacoNeovimClient;
@@ -0,0 +1,16 @@
1
+ import * as monaco from "monaco-editor";
2
+ import type { editor as MonacoEditor } from "monaco-editor";
3
+ export type MouseManagerInit = {
4
+ editor: MonacoEditor.IStandaloneCodeEditor;
5
+ isSessionRunning: () => boolean;
6
+ getBufHandle: () => number | null;
7
+ isDelegateInsertToMonaco: () => boolean;
8
+ sendNotify: (method: string, params: unknown[]) => void;
9
+ execLua: (code: string, args: unknown[]) => Promise<any>;
10
+ };
11
+ export declare class MouseManager {
12
+ private readonly init;
13
+ constructor(init: MouseManagerInit);
14
+ handleMouseDown(ev: monaco.editor.IEditorMouseEvent): void;
15
+ sendNvimMouse(button: string, action: "press" | "drag" | "release" | "up" | "down", mods: string, pos: monaco.Position): Promise<void>;
16
+ }
@@ -0,0 +1,15 @@
1
+ export type NotifyRouterInit = {
2
+ debugLog: (line: string) => void;
3
+ notifyHandlers: Map<string, (params: unknown[]) => void | Promise<void>>;
4
+ handleNvimBufLinesEvent: (params: unknown[]) => Promise<void>;
5
+ handleNvimBufDetachEvent: (params: unknown[]) => void;
6
+ handleRedraw: (params: unknown[]) => void;
7
+ };
8
+ export declare class NotifyRouter {
9
+ private readonly init;
10
+ private chain;
11
+ constructor(init: NotifyRouterInit);
12
+ reset(): void;
13
+ onNotify(method: string, params: unknown[]): void;
14
+ private dispatch;
15
+ }