@codingame/monaco-vscode-api 4.3.2 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/monaco.d.ts CHANGED
@@ -19,6 +19,8 @@ import { IKeybindingService } from './vscode/src/vs/platform/keybinding/common/k
19
19
  import { KeybindingResolver } from './vscode/src/vs/platform/keybinding/common/keybindingResolver.js';
20
20
  import { ResolvedKeybindingItem } from './vscode/src/vs/platform/keybinding/common/resolvedKeybindingItem.js';
21
21
  import { Event } from './vscode/src/vs/base/common/event.js';
22
+ export { EditorAction, EditorCommand, registerDiffEditorContribution, registerEditorAction, registerEditorContribution, registerMultiEditorAction } from './vscode/src/vs/editor/browser/editorExtensions.js';
23
+ export { IDiffEditorContribution, IEditorContribution } from './vscode/src/vs/editor/common/editorCommon.js';
22
24
 
23
25
  declare function writeFile(uri: URI, content: string): Promise<void>;
24
26
  declare function deleteFile(uri: URI, options?: Partial<IFileDeleteOptions>): Promise<void>;
package/monaco.js CHANGED
@@ -45,6 +45,7 @@ import { IKeybindingService } from './vscode/src/vs/platform/keybinding/common/k
45
45
  import { ResourceContextKey } from './vscode/src/vs/workbench/common/contextkeys.js';
46
46
  import { createInjectedClass } from './tools/injection.js';
47
47
  import { getService } from './services.js';
48
+ export { EditorAction, EditorCommand, registerDiffEditorContribution, registerEditorAction, registerEditorContribution, registerMultiEditorAction } from './vscode/src/vs/editor/browser/editorExtensions.js';
48
49
  function computeConfiguration(configuration, overrides) {
49
50
  const editorConfiguration = isObject(configuration.editor) ? deepClone(configuration.editor) : Object.create(null);
50
51
  Object.assign(editorConfiguration, deepClone(overrides));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "4.3.2",
3
+ "version": "4.4.0",
4
4
  "description": "VSCode public API plugged on the monaco editor",
5
5
  "keywords": [],
6
6
  "author": {
@@ -97,12 +97,12 @@
97
97
  }
98
98
  },
99
99
  "dependencies": {
100
- "@codingame/monaco-vscode-extensions-service-override": "4.3.2",
101
- "@codingame/monaco-vscode-files-service-override": "4.3.2",
102
- "@codingame/monaco-vscode-quickaccess-service-override": "4.3.2",
103
- "@codingame/monaco-vscode-environment-service-override": "4.3.2",
104
- "@codingame/monaco-vscode-layout-service-override": "4.3.2",
105
- "@codingame/monaco-vscode-host-service-override": "4.3.2",
106
- "@codingame/monaco-vscode-base-service-override": "4.3.2"
100
+ "@codingame/monaco-vscode-quickaccess-service-override": "4.4.0",
101
+ "@codingame/monaco-vscode-files-service-override": "4.4.0",
102
+ "@codingame/monaco-vscode-extensions-service-override": "4.4.0",
103
+ "@codingame/monaco-vscode-environment-service-override": "4.4.0",
104
+ "@codingame/monaco-vscode-layout-service-override": "4.4.0",
105
+ "@codingame/monaco-vscode-host-service-override": "4.4.0",
106
+ "@codingame/monaco-vscode-base-service-override": "4.4.0"
107
107
  }
108
108
  }
@@ -0,0 +1,138 @@
1
+ import { ICodeEditor, IDiffEditor } from './editorBrowser.js';
2
+ import { IEditorContribution } from '../common/editorCommon.js';
3
+ import '../editor.api.js';
4
+ import { IDisposable } from '../../base/common/lifecycle.js';
5
+ import { ThemeIcon } from '../../base/common/themables.js';
6
+ import { BrandedService, ServicesAccessor as ServicesAccessor$1 } from '../../platform/instantiation/common/instantiation.js';
7
+ import { ContextKeyExpression } from '../../platform/contextkey/common/contextkey.js';
8
+ import { ICommandMetadata } from '../../platform/commands/common/commands.js';
9
+ import { MenuId } from '../../platform/actions/common/actions.js';
10
+ import { IKeybindings } from '../../platform/keybinding/common/keybindingsRegistry.js';
11
+
12
+ type ServicesAccessor = ServicesAccessor$1;
13
+ declare const enum EditorContributionInstantiation {
14
+ /**
15
+ * The contribution is created eagerly when the {@linkcode ICodeEditor} is instantiated.
16
+ * Only Eager contributions can participate in saving or restoring of view state.
17
+ */
18
+ Eager = 0,
19
+ /**
20
+ * The contribution is created at the latest 50ms after the first render after attaching a text model.
21
+ * If the contribution is explicitly requested via `getContribution`, it will be instantiated sooner.
22
+ * If there is idle time available, it will be instantiated sooner.
23
+ */
24
+ AfterFirstRender = 1,
25
+ /**
26
+ * The contribution is created before the editor emits events produced by user interaction (mouse events, keyboard events).
27
+ * If the contribution is explicitly requested via `getContribution`, it will be instantiated sooner.
28
+ * If there is idle time available, it will be instantiated sooner.
29
+ */
30
+ BeforeFirstInteraction = 2,
31
+ /**
32
+ * The contribution is created when there is idle time available, at the latest 5000ms after the editor creation.
33
+ * If the contribution is explicitly requested via `getContribution`, it will be instantiated sooner.
34
+ */
35
+ Eventually = 3,
36
+ /**
37
+ * The contribution is created only when explicitly requested via `getContribution`.
38
+ */
39
+ Lazy = 4
40
+ }
41
+ interface ICommandKeybindingsOptions extends IKeybindings {
42
+ kbExpr?: ContextKeyExpression | null;
43
+ weight: number;
44
+ /**
45
+ * the default keybinding arguments
46
+ */
47
+ args?: any;
48
+ }
49
+ interface ICommandMenuOptions {
50
+ menuId: MenuId;
51
+ group: string;
52
+ order: number;
53
+ when?: ContextKeyExpression;
54
+ title: string;
55
+ icon?: ThemeIcon;
56
+ }
57
+ interface ICommandOptions {
58
+ id: string;
59
+ precondition: ContextKeyExpression | undefined;
60
+ kbOpts?: ICommandKeybindingsOptions | ICommandKeybindingsOptions[];
61
+ metadata?: ICommandMetadata;
62
+ menuOpts?: ICommandMenuOptions | ICommandMenuOptions[];
63
+ }
64
+ declare abstract class Command {
65
+ readonly id: string;
66
+ readonly precondition: ContextKeyExpression | undefined;
67
+ private readonly _kbOpts;
68
+ private readonly _menuOpts;
69
+ readonly metadata: ICommandMetadata | undefined;
70
+ constructor(opts: ICommandOptions);
71
+ register(): void;
72
+ private _registerMenuItem;
73
+ abstract runCommand(accessor: ServicesAccessor, args: any): void | Promise<void>;
74
+ }
75
+ interface IContributionCommandOptions<T> extends ICommandOptions {
76
+ handler: (controller: T, args: any) => void;
77
+ }
78
+ interface EditorControllerCommand<T extends IEditorContribution> {
79
+ new (opts: IContributionCommandOptions<T>): EditorCommand;
80
+ }
81
+ declare abstract class EditorCommand extends Command {
82
+ /**
83
+ * Create a command class that is bound to a certain editor contribution.
84
+ */
85
+ static bindToContribution<T extends IEditorContribution>(controllerGetter: (editor: ICodeEditor) => T | null): EditorControllerCommand<T>;
86
+ static runEditorCommand(accessor: ServicesAccessor, args: any, precondition: ContextKeyExpression | undefined, runner: (accessor: ServicesAccessor | null, editor: ICodeEditor, args: any) => void | Promise<void>): void | Promise<void>;
87
+ runCommand(accessor: ServicesAccessor, args: any): void | Promise<void>;
88
+ abstract runEditorCommand(accessor: ServicesAccessor | null, editor: ICodeEditor, args: any): void | Promise<void>;
89
+ }
90
+ interface IEditorActionContextMenuOptions {
91
+ group: string;
92
+ order: number;
93
+ when?: ContextKeyExpression;
94
+ menuId?: MenuId;
95
+ }
96
+ interface IActionOptions extends ICommandOptions {
97
+ label: string;
98
+ alias: string;
99
+ contextMenuOpts?: IEditorActionContextMenuOptions | IEditorActionContextMenuOptions[];
100
+ }
101
+ declare abstract class EditorAction extends EditorCommand {
102
+ private static convertOptions;
103
+ readonly label: string;
104
+ readonly alias: string;
105
+ constructor(opts: IActionOptions);
106
+ runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Promise<void>;
107
+ protected reportTelemetry(accessor: ServicesAccessor, editor: ICodeEditor): void;
108
+ abstract run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Promise<void>;
109
+ }
110
+ type EditorActionImplementation = (accessor: ServicesAccessor, editor: ICodeEditor, args: any) => boolean | Promise<void>;
111
+ declare class MultiEditorAction extends EditorAction {
112
+ private readonly _implementations;
113
+ /**
114
+ * A higher priority gets to be looked at first
115
+ */
116
+ addImplementation(priority: number, implementation: EditorActionImplementation): IDisposable;
117
+ run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Promise<void>;
118
+ }
119
+ declare function registerEditorAction<T extends EditorAction>(ctor: {
120
+ new (): T;
121
+ }): T;
122
+ declare function registerMultiEditorAction<T extends MultiEditorAction>(action: T): T;
123
+ /**
124
+ * Registers an editor contribution. Editor contributions have a lifecycle which is bound
125
+ * to a specific code editor instance.
126
+ */
127
+ declare function registerEditorContribution<Services extends BrandedService[]>(id: string, ctor: {
128
+ new (editor: ICodeEditor, ...services: Services): IEditorContribution;
129
+ }, instantiation: EditorContributionInstantiation): void;
130
+ /**
131
+ * Registers a diff editor contribution. Diff editor contributions have a lifecycle which
132
+ * is bound to a specific diff editor instance.
133
+ */
134
+ declare function registerDiffEditorContribution<Services extends BrandedService[]>(id: string, ctor: {
135
+ new (editor: IDiffEditor, ...services: Services): IEditorContribution;
136
+ }): void;
137
+
138
+ export { Command, EditorAction, type EditorActionImplementation, EditorCommand, EditorContributionInstantiation, type EditorControllerCommand, type IActionOptions, type ICommandKeybindingsOptions, type ICommandMenuOptions, type ICommandOptions, type IContributionCommandOptions, type IEditorActionContextMenuOptions, MultiEditorAction, type ServicesAccessor, registerDiffEditorContribution, registerEditorAction, registerEditorContribution, registerMultiEditorAction };
@@ -100,6 +100,16 @@ interface IEditorContribution {
100
100
  */
101
101
  restoreViewState?(state: any): void;
102
102
  }
103
+ /**
104
+ * A diff editor contribution that gets created every time a new diffeditor gets created and gets disposed when the diff editor gets disposed.
105
+ * @internal
106
+ */
107
+ interface IDiffEditorContribution {
108
+ /**
109
+ * Dispose this contribution.
110
+ */
111
+ dispose(): void;
112
+ }
103
113
  /**
104
114
  * @internal
105
115
  */
@@ -181,4 +191,4 @@ interface IDecorationRenderOptions extends IThemeDecorationRenderOptions {
181
191
  dark?: IThemeDecorationRenderOptions;
182
192
  }
183
193
 
184
- export type { ICodeEditorViewState, IContentDecorationRenderOptions, ICursorState, IDecorationRenderOptions, IDiffEditor, IDiffEditorModel, IDiffEditorViewModel, IDiffEditorViewState, IEditor, IEditorContribution, IThemeDecorationRenderOptions, IViewState };
194
+ export type { ICodeEditorViewState, IContentDecorationRenderOptions, ICursorState, IDecorationRenderOptions, IDiffEditor, IDiffEditorContribution, IDiffEditorModel, IDiffEditorViewModel, IDiffEditorViewState, IEditor, IEditorContribution, IThemeDecorationRenderOptions, IViewState };