@codingame/monaco-vscode-api 1.81.3 → 1.81.5-next.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/README.md +56 -24
- package/dist/default-extensions/npm/npmBrowserMain.js.map +1 -1
- package/dist/default-extensions/typescript-language-features/tsserver.web.js +1 -1
- package/dist/default-extensions/typescript-language-features/tsserver.web.js.map +1 -1
- package/dist/monaco.d.ts +9 -2
- package/dist/monaco.js +6 -16
- package/dist/service-override/keybindings.js +25 -1
- package/dist/service-override/storage.d.ts +1 -1
- package/dist/service-override/storage.js +1 -1
- package/dist/service-override/views.js +20 -3
- package/dist/vscode/vs/platform/keybinding/common/keybindingResolver.d.ts +47 -1
- package/dist/vscode/vs/workbench/api/worker/extensionHostWorker.js +3 -0
- package/dist/vscode/vs/workbench/services/keybinding/browser/keybindingService.js +4 -1
- package/monaco-editor-treemending.patch +945 -930
- package/package.json +1 -1
package/dist/monaco.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { create, createDiffEditor } from './vscode/vs/editor/standalone/browser/
|
|
|
2
2
|
export { errorHandler } from './vscode/vs/base/common/errors.js';
|
|
3
3
|
export { FoldingModel, setCollapseStateForMatchingLines } from './vscode/vs/editor/contrib/folding/browser/foldingModel.js';
|
|
4
4
|
export { FoldingController } from './vscode/vs/editor/contrib/folding/browser/folding.js';
|
|
5
|
-
import { IReference } from './vscode/vs/base/common/lifecycle.js';
|
|
5
|
+
import { IReference, IDisposable } from './vscode/vs/base/common/lifecycle.js';
|
|
6
6
|
export { DisposableStore } from './vscode/vs/base/common/lifecycle.js';
|
|
7
7
|
export { Registry } from './vscode/vs/platform/registry/common/platform.js';
|
|
8
8
|
export { IJSONContributionRegistry } from './vscode/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
|
|
@@ -12,10 +12,17 @@ export { registerColor } from './vscode/vs/platform/theme/common/colorRegistry.j
|
|
|
12
12
|
import { URI } from './vscode/vs/base/common/uri.js';
|
|
13
13
|
import { IFileDeleteOptions } from './vscode/vs/platform/files/common/files.js';
|
|
14
14
|
import { ITextFileEditorModel } from './vscode/vs/workbench/services/textfile/common/textfiles.js';
|
|
15
|
+
import { IKeybindingService } from './vscode/vs/platform/keybinding/common/keybinding.js';
|
|
16
|
+
import { KeybindingResolver } from './vscode/vs/platform/keybinding/common/keybindingResolver.js';
|
|
17
|
+
import { ResolvedKeybindingItem } from './vscode/vs/platform/keybinding/common/resolvedKeybindingItem.js';
|
|
15
18
|
|
|
16
19
|
declare function writeFile(uri: URI, content: string): Promise<void>;
|
|
17
20
|
declare function deleteFile(uri: URI, options?: Partial<IFileDeleteOptions>): Promise<void>;
|
|
18
21
|
declare function createModelReference(resource: URI, content?: string): Promise<IReference<ITextFileEditorModel>>;
|
|
22
|
+
interface DynamicKeybindingService extends IKeybindingService {
|
|
23
|
+
registerKeybindingProvider(provider: () => ResolvedKeybindingItem[]): IDisposable;
|
|
24
|
+
_getResolver(): KeybindingResolver;
|
|
25
|
+
}
|
|
19
26
|
declare const createConfiguredEditor: typeof create;
|
|
20
27
|
declare const createConfiguredDiffEditor: typeof createDiffEditor;
|
|
21
28
|
declare const Extensions: {
|
|
@@ -23,4 +30,4 @@ declare const Extensions: {
|
|
|
23
30
|
JSONContribution: string;
|
|
24
31
|
};
|
|
25
32
|
|
|
26
|
-
export { Extensions, IReference, ITextFileEditorModel, createConfiguredDiffEditor, createConfiguredEditor, createModelReference, deleteFile, writeFile };
|
|
33
|
+
export { DynamicKeybindingService, Extensions, IReference, ITextFileEditorModel, createConfiguredDiffEditor, createConfiguredEditor, createModelReference, deleteFile, writeFile };
|
package/dist/monaco.js
CHANGED
|
@@ -33,8 +33,6 @@ import { INotificationService } from 'monaco-editor/esm/vs/platform/notification
|
|
|
33
33
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
34
34
|
import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
|
|
35
35
|
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
36
|
-
import { KeybindingResolver } from 'monaco-editor/esm/vs/platform/keybinding/common/keybindingResolver.js';
|
|
37
|
-
import { WorkbenchKeybindingService } from './vscode/vs/workbench/services/keybinding/browser/keybindingService.js';
|
|
38
36
|
import { createInjectedClass } from './tools/injection.js';
|
|
39
37
|
import './vscode/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.js';
|
|
40
38
|
import './vscode/vs/workbench/contrib/codeEditor/browser/menuPreventer.js';
|
|
@@ -135,25 +133,17 @@ async function createModelReference(resource, content) {
|
|
|
135
133
|
}
|
|
136
134
|
return (await StandaloneServices.get(ITextModelService).createModelReference(resource));
|
|
137
135
|
}
|
|
136
|
+
function isDynamicKeybindingService(keybindingService) {
|
|
137
|
+
return keybindingService.registerKeybindingProvider != null;
|
|
138
|
+
}
|
|
138
139
|
let DelegateStandaloneKeybindingService = class DelegateStandaloneKeybindingService extends StandaloneKeybindingService {
|
|
139
140
|
constructor(delegate, contextKeyService, commandService, telemetryService, notificationService, logService, codeEditorService) {
|
|
140
141
|
super(contextKeyService, commandService, telemetryService, notificationService, logService, codeEditorService);
|
|
141
142
|
this.delegate = delegate;
|
|
142
|
-
this.
|
|
143
|
-
this.onDidUpdateKeybindings(() => {
|
|
144
|
-
this._cachedOverridenResolver = null;
|
|
145
|
-
});
|
|
146
|
-
this.delegate.onDidUpdateKeybindings(() => {
|
|
147
|
-
this._cachedOverridenResolver = null;
|
|
148
|
-
});
|
|
143
|
+
this._register(delegate.registerKeybindingProvider(() => this.getUserKeybindingItems()));
|
|
149
144
|
}
|
|
150
145
|
_getResolver() {
|
|
151
|
-
|
|
152
|
-
const overrides = this['_toNormalizedKeybindingItems'](this['_dynamicKeybindings'], false);
|
|
153
|
-
this._cachedOverridenResolver = new KeybindingResolver(
|
|
154
|
-
[...this.delegate['_getResolver']().getKeybindings()], overrides, (str) => this._log(str));
|
|
155
|
-
}
|
|
156
|
-
return this._cachedOverridenResolver;
|
|
146
|
+
return this.delegate._getResolver();
|
|
157
147
|
}
|
|
158
148
|
};
|
|
159
149
|
DelegateStandaloneKeybindingService = __decorate([
|
|
@@ -170,7 +160,7 @@ function getStandaloneEditorInstantiationService() {
|
|
|
170
160
|
const serviceCollection = new ServiceCollection();
|
|
171
161
|
serviceCollection.set(IQuickInputService, new SyncDescriptor(StandaloneQuickInputService, undefined, true));
|
|
172
162
|
const keybindingService = StandaloneServices.get(IKeybindingService);
|
|
173
|
-
if (keybindingService instanceof
|
|
163
|
+
if (!(keybindingService instanceof StandaloneKeybindingService) && isDynamicKeybindingService(keybindingService)) {
|
|
174
164
|
serviceCollection.set(IKeybindingService, new SyncDescriptor(DelegateStandaloneKeybindingService, [keybindingService], true));
|
|
175
165
|
}
|
|
176
166
|
standaloneEditorInstantiationService = StandaloneServices.get(IInstantiationService).createChild(serviceCollection);
|
|
@@ -10,6 +10,7 @@ import { BrowserKeyboardLayoutService } from '../vscode/vs/workbench/services/ke
|
|
|
10
10
|
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
11
11
|
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
12
12
|
import { CommandService } from '../vscode/vs/workbench/services/commands/common/commandService.js';
|
|
13
|
+
import { toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
13
14
|
import getServiceOverride$1 from './files.js';
|
|
14
15
|
import '../vscode/vs/workbench/browser/workbench.contribution.js';
|
|
15
16
|
import '../vscode/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js';
|
|
@@ -17,10 +18,33 @@ async function updateUserKeybindings(keybindingsJson) {
|
|
|
17
18
|
const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
|
|
18
19
|
await StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.keybindingsResource, VSBuffer.fromString(keybindingsJson));
|
|
19
20
|
}
|
|
21
|
+
class DynamicWorkbenchKeybindingService extends WorkbenchKeybindingService {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.keybindingProviders = [];
|
|
25
|
+
}
|
|
26
|
+
registerKeybindingProvider(provider) {
|
|
27
|
+
this.keybindingProviders.push(provider);
|
|
28
|
+
this.updateResolver();
|
|
29
|
+
return toDisposable(() => {
|
|
30
|
+
const idx = this.keybindingProviders.indexOf(provider);
|
|
31
|
+
if (idx >= 0) {
|
|
32
|
+
this.keybindingProviders.splice(idx, 1);
|
|
33
|
+
this.updateResolver();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
_getResolver() {
|
|
38
|
+
return super._getResolver();
|
|
39
|
+
}
|
|
40
|
+
getUserKeybindingItems() {
|
|
41
|
+
return [...super.getUserKeybindingItems(), ...this.keybindingProviders.flatMap(provider => provider())];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
20
44
|
function getServiceOverride() {
|
|
21
45
|
return {
|
|
22
46
|
...getServiceOverride$1(),
|
|
23
|
-
[( IKeybindingService.toString())]: new SyncDescriptor(
|
|
47
|
+
[( IKeybindingService.toString())]: new SyncDescriptor(DynamicWorkbenchKeybindingService, [], false),
|
|
24
48
|
[( IKeyboardLayoutService.toString())]: new SyncDescriptor(BrowserKeyboardLayoutService, undefined, true),
|
|
25
49
|
[( ICommandService.toString())]: new SyncDescriptor(CommandService, [], true)
|
|
26
50
|
};
|
|
@@ -37,4 +37,4 @@ declare class InjectedBrowserStorageService extends BrowserStorageService {
|
|
|
37
37
|
}
|
|
38
38
|
declare function getStorageServiceOverride(provider?: IStorageProvider): IEditorOverrideServices;
|
|
39
39
|
|
|
40
|
-
export { ExternalStorageService, IStorageItemsChangeEvent, IStorageProvider,
|
|
40
|
+
export { InjectedBrowserStorageService as BrowserStorageService, ExternalStorageService, IStorageItemsChangeEvent, IStorageProvider, StorageScope, getStorageServiceOverride as default };
|
|
@@ -113,4 +113,4 @@ function getStorageServiceOverride(provider) {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
export {
|
|
116
|
+
export { InjectedBrowserStorageService as BrowserStorageService, ExternalStorageService, StorageScope, getStorageServiceOverride as default };
|
|
@@ -93,6 +93,7 @@ import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/st
|
|
|
93
93
|
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
94
94
|
export { ConfirmResult } from '../override/vs/platform/dialogs/common/dialogs.js';
|
|
95
95
|
import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/layoutService.js';
|
|
96
|
+
import { StandaloneCodeEditor } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
|
|
96
97
|
import { wrapOpenEditor } from './tools/editor.js';
|
|
97
98
|
import getServiceOverride$2 from './bulkEdit.js';
|
|
98
99
|
import getServiceOverride$1 from './layout.js';
|
|
@@ -350,9 +351,21 @@ let EditorDropService = class EditorDropService {
|
|
|
350
351
|
EditorDropService = __decorate([
|
|
351
352
|
( __param(0, IEditorGroupsService))
|
|
352
353
|
], EditorDropService);
|
|
354
|
+
function isElementVisible(el) {
|
|
355
|
+
if (!el.isConnected) {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
if (el.checkVisibility != null) {
|
|
359
|
+
return el.checkVisibility({
|
|
360
|
+
checkOpacity: true,
|
|
361
|
+
checkVisibilityCSS: true
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
return el.offsetHeight > 0 && el.offsetWidth > 0;
|
|
365
|
+
}
|
|
353
366
|
function isEditorPartVisible() {
|
|
354
|
-
const
|
|
355
|
-
return
|
|
367
|
+
const container = StandaloneServices.get(IEditorGroupsService).getContainer();
|
|
368
|
+
return container != null && isElementVisible(container);
|
|
356
369
|
}
|
|
357
370
|
let MonacoEditorService = class MonacoEditorService extends EditorService {
|
|
358
371
|
constructor(_openEditorFallback, _editorGroupService, instantiationService, fileService, configurationService, contextService, uriIdentityService, editorResolverService, workspaceTrustRequestService, hostService, textEditorService, textModelService) {
|
|
@@ -360,7 +373,11 @@ let MonacoEditorService = class MonacoEditorService extends EditorService {
|
|
|
360
373
|
this.openEditor = wrapOpenEditor(textModelService, this.openEditor.bind(this), _openEditorFallback);
|
|
361
374
|
}
|
|
362
375
|
get activeTextEditorControl() {
|
|
363
|
-
|
|
376
|
+
const focusedCodeEditor = StandaloneServices.get(ICodeEditorService).getFocusedCodeEditor();
|
|
377
|
+
if (focusedCodeEditor != null && focusedCodeEditor instanceof StandaloneCodeEditor) {
|
|
378
|
+
return focusedCodeEditor;
|
|
379
|
+
}
|
|
380
|
+
return super.activeTextEditorControl;
|
|
364
381
|
}
|
|
365
382
|
async openEditor(editor, optionsOrPreferredGroup, preferredGroup) {
|
|
366
383
|
if (!isEditorPartVisible()) {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ContextKeyExpression, IContextKeyService, IContext } from '../../contextkey/common/contextkey.js';
|
|
2
|
+
import { ResolvedKeybindingItem } from './resolvedKeybindingItem.js';
|
|
3
|
+
|
|
1
4
|
declare const enum ResultKind {
|
|
2
5
|
/** No keybinding found this sequence of chords */
|
|
3
6
|
NoMatchingKb = 0,
|
|
@@ -16,5 +19,48 @@ type ResolutionResult = {
|
|
|
16
19
|
commandArgs: any;
|
|
17
20
|
isBubble: boolean;
|
|
18
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Stores mappings from keybindings to commands and from commands to keybindings.
|
|
24
|
+
* Given a sequence of chords, `resolve`s which keybinding it matches
|
|
25
|
+
*/
|
|
26
|
+
declare class KeybindingResolver {
|
|
27
|
+
private readonly _log;
|
|
28
|
+
private readonly _defaultKeybindings;
|
|
29
|
+
private readonly _keybindings;
|
|
30
|
+
private readonly _defaultBoundCommands;
|
|
31
|
+
private readonly _map;
|
|
32
|
+
private readonly _lookupMap;
|
|
33
|
+
constructor(
|
|
34
|
+
/** built-in and extension-provided keybindings */
|
|
35
|
+
defaultKeybindings: ResolvedKeybindingItem[],
|
|
36
|
+
/** user's keybindings */
|
|
37
|
+
overrides: ResolvedKeybindingItem[], log: (str: string) => void);
|
|
38
|
+
private static _isTargetedForRemoval;
|
|
39
|
+
/**
|
|
40
|
+
* Looks for rules containing "-commandId" and removes them.
|
|
41
|
+
*/
|
|
42
|
+
static handleRemovals(rules: ResolvedKeybindingItem[]): ResolvedKeybindingItem[];
|
|
43
|
+
private _addKeyPress;
|
|
44
|
+
private _addToLookupMap;
|
|
45
|
+
private _removeFromLookupMap;
|
|
46
|
+
/**
|
|
47
|
+
* Returns true if it is provable `a` implies `b`.
|
|
48
|
+
*/
|
|
49
|
+
static whenIsEntirelyIncluded(a: ContextKeyExpression | null | undefined, b: ContextKeyExpression | null | undefined): boolean;
|
|
50
|
+
getDefaultBoundCommands(): Map<string, boolean>;
|
|
51
|
+
getDefaultKeybindings(): readonly ResolvedKeybindingItem[];
|
|
52
|
+
getKeybindings(): readonly ResolvedKeybindingItem[];
|
|
53
|
+
lookupKeybindings(commandId: string): ResolvedKeybindingItem[];
|
|
54
|
+
lookupPrimaryKeybinding(commandId: string, context: IContextKeyService): ResolvedKeybindingItem | null;
|
|
55
|
+
/**
|
|
56
|
+
* Looks up a keybinding trigged as a result of pressing a sequence of chords - `[...currentChords, keypress]`
|
|
57
|
+
*
|
|
58
|
+
* Example: resolving 3 chords pressed sequentially - `cmd+k cmd+p cmd+i`:
|
|
59
|
+
* `currentChords = [ 'cmd+k' , 'cmd+p' ]` and `keypress = `cmd+i` - last pressed chord
|
|
60
|
+
*/
|
|
61
|
+
resolve(context: IContext, currentChords: string[], keypress: string): ResolutionResult;
|
|
62
|
+
private _findCommand;
|
|
63
|
+
private static _contextMatchesRules;
|
|
64
|
+
}
|
|
19
65
|
|
|
20
|
-
export { ResolutionResult, ResultKind };
|
|
66
|
+
export { KeybindingResolver, ResolutionResult, ResultKind };
|
|
@@ -98,6 +98,9 @@ function patchWorker(asBrowserUri, getAllStaticBrowserUris) {
|
|
|
98
98
|
self.importScripts = (...urls) => {
|
|
99
99
|
nativeImportScripts(...( urls.map(asWorkerBrowserUrl)));
|
|
100
100
|
};
|
|
101
|
+
self.importExt = (url) => {
|
|
102
|
+
return ( new Function('url', 'return import(url)'))(asWorkerBrowserUrl(url));
|
|
103
|
+
};
|
|
101
104
|
nativeImportScripts(workerUrl);
|
|
102
105
|
}).toString());
|
|
103
106
|
const js = `(${bootstrapFnSource}('${browserUrl}', ${JSON.stringify(staticBrowserUrls)}))`;
|
|
@@ -344,10 +344,13 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
|
|
|
344
344
|
this._cachedResolver = null;
|
|
345
345
|
this._onDidUpdateKeybindings.fire();
|
|
346
346
|
}
|
|
347
|
+
getUserKeybindingItems() {
|
|
348
|
+
return this._resolveUserKeybindingItems(this.userKeybindings.keybindings, false);
|
|
349
|
+
}
|
|
347
350
|
_getResolver() {
|
|
348
351
|
if (!this._cachedResolver) {
|
|
349
352
|
const defaults = this._resolveKeybindingItems(KeybindingsRegistry.getDefaultKeybindings(), true);
|
|
350
|
-
const overrides = this.
|
|
353
|
+
const overrides = this.getUserKeybindingItems();
|
|
351
354
|
this._cachedResolver = ( new KeybindingResolver(defaults, overrides, (str) => this._log(str)));
|
|
352
355
|
}
|
|
353
356
|
return this._cachedResolver;
|