Skip to content

Commit

Permalink
[monaco] Align signatures for monaco/index.d.ts
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
  • Loading branch information
RomanNikitenko committed Jun 26, 2020
1 parent 6c414db commit a3f599f
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 193 deletions.
22 changes: 20 additions & 2 deletions packages/monaco/src/browser/monaco-bulk-edit-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,29 @@ export class MonacoBulkEditService implements monaco.editor.IBulkEditService {
@inject(MonacoWorkspace)
protected readonly workspace: MonacoWorkspace;

private _previewHandler?: monaco.editor.IBulkEditPreviewHandler;

apply(edit: monaco.languages.WorkspaceEdit): Promise<monaco.editor.IBulkEditResult> {
return this.workspace.applyBulkEdit(edit);
}

hasPreviewHandler(): boolean {
return false; // todo
}
return Boolean(this._previewHandler);
}

setPreviewHandler(handler: monaco.editor.IBulkEditPreviewHandler): monaco.IDisposable {
this._previewHandler = handler;

const disposePreviewHandler = () => {
if (this._previewHandler === handler) {
this._previewHandler = undefined;
}
};

return {
dispose(): void {
disposePreviewHandler();
}
};
}
}
2 changes: 1 addition & 1 deletion packages/monaco/src/browser/monaco-editor-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export class MonacoEditorProvider {

if (referencesController._widget) {
referencesController._widget.show(range);
referencesController._widget.focus();
referencesController._widget.focusOnReferenceTree();
}

}, (e: any) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/monaco/src/browser/monaco-frontend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function createMonacoConfigurationService(container: interfaces.Container
};

const initFromConfiguration = debounce(() => {
const event = new monaco.services.ConfigurationChangeEvent();
const event = new monaco.services.ConfigurationChangeEvent(); // todo: align ConfigurationChangeEvent with VS Code
event._source = 6 /* DEFAULT */;
service._onDidChangeConfiguration.fire(event);
});
Expand All @@ -177,7 +177,7 @@ export function createMonacoConfigurationService(container: interfaces.Container
});
configurations.onDidChangeConfiguration(e => {
if (e.affectedSections) {
const event = new monaco.services.ConfigurationChangeEvent();
const event = new monaco.services.ConfigurationChangeEvent(); // todo: align ConfigurationChangeEvent with VS Code
event.change(e.affectedSections);
service._onDidChangeConfiguration.fire(event);
}
Expand Down
8 changes: 6 additions & 2 deletions packages/monaco/src/browser/monaco-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ export class MonacoEditorMenuContribution implements MenuContribution {
this.registerPeekSubmenu(registry);

registry.registerSubmenu(MonacoMenus.SELECTION, 'Selection');
for (const item of MenuRegistry.getMenuItems(23)) {
for (const item of MenuRegistry.getMenuItems(25)) {
if (!monaco.actions.isIMenuItem(item)) {
continue;
}
const commandId = this.commands.validate(item.command.id);
if (commandId) {
const menuPath = [...MonacoMenus.SELECTION, (item.group || '')];
const label = this.removeMnemonic(item.command.title);
const title = typeof item.command.title === 'string' ? item.command.title : item.command.title.value;
const label = this.removeMnemonic(title);
const order = item.order ? String(item.order) : '';
registry.registerMenuAction(menuPath, { commandId, order, label });
}
Expand All @@ -69,6 +70,9 @@ export class MonacoEditorMenuContribution implements MenuContribution {
registry.registerSubmenu(MonacoMenus.PEEK_CONTEXT_SUBMENU, 'Peek');

for (const item of MenuRegistry.getMenuItems(8)) {
if (!monaco.actions.isIMenuItem(item)) {
continue;
}
const commandId = this.commands.validate(item.command.id);
if (commandId) {
const order = item.order ? String(item.order) : '';
Expand Down
Loading

0 comments on commit a3f599f

Please sign in to comment.