Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@codingame/monaco-vscode-extensions-service-override

Package Overview
Dependencies
Maintainers
6
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codingame/monaco-vscode-extensions-service-override

VSCode public API plugged on the monaco editor - extensions service-override

  • 4.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34K
decreased by-7.11%
Maintainers
6
Weekly downloads
 
Created
Source

import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; import { localizeWithPath } from 'vscode/vscode/vs/nls'; import { toAction } from 'vscode/vscode/vs/base/common/actions'; import { MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol'; import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js'; import '../../../../../../override/vs/platform/dialogs/common/dialogs.js'; import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification'; import { Event } from 'vscode/vscode/vs/base/common/event'; import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands'; import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions'; import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';

let MainThreadMessageService = class MainThreadMessageService { constructor(extHostContext, _notificationService, _commandService, _dialogService, extensionService) { this._notificationService = _notificationService; this._commandService = _commandService; this._dialogService = _dialogService; this.extensionsListener = extensionService.onDidChangeExtensions(e => { for (const extension of e.removed) { this._notificationService.removeFilter(extension.identifier.value); } }); } dispose() { this.extensionsListener.dispose(); } $showMessage(severity, message, options, commands) { if (options.modal) { return this._showModalMessage(severity, message, options.detail, commands, options.useCustom); } else { return this._showMessage(severity, message, commands, options); } } _showMessage(severity, message, commands, options) { return ( new Promise(resolve => { const primaryActions = ( commands.map(command => toAction({ id: _extension_message_handle_${command.handle}, label: command.title, enabled: true, run: () => { resolve(command.handle); return Promise.resolve(); } }))); let source; if (options.source) { source = { label: options.source.label, id: options.source.identifier.value }; } if (!source) { source = ( localizeWithPath( 'vs/workbench/api/browser/mainThreadMessageService', 'defaultSource', "Extension" )); } const secondaryActions = []; if (options.source) { secondaryActions.push(toAction({ id: options.source.identifier.value, label: ( localizeWithPath( 'vs/workbench/api/browser/mainThreadMessageService', 'manageExtension', "Manage Extension" )), run: () => { return this._commandService.executeCommand('_extensions.manage', options.source.identifier.value); } })); } const messageHandle = this._notificationService.notify({ severity, message, actions: { primary: primaryActions, secondary: secondaryActions }, source }); Event.once(messageHandle.onDidClose)(() => { resolve(undefined); }); })); } async _showModalMessage(severity, message, detail, commands, useCustom) { const buttons = []; let cancelButton = undefined; for (const command of commands) { const button = { label: command.title, run: () => command.handle }; if (command.isCloseAffordance) { cancelButton = button; } else { buttons.push(button); } } if (!cancelButton) { if (buttons.length > 0) { cancelButton = { label: ( localizeWithPath('vs/workbench/api/browser/mainThreadMessageService', 'cancel', "Cancel")), run: () => undefined }; } else { cancelButton = { label: ( localizeWithPath( 'vs/workbench/api/browser/mainThreadMessageService', { key: 'ok', comment: ['&& denotes a mnemonic'] }, "&&OK" )), run: () => undefined }; } } const { result } = await this._dialogService.prompt({ type: severity, message, detail, buttons, cancelButton, custom: useCustom }); return result; } }; MainThreadMessageService = __decorate([ extHostNamedCustomer(MainContext.MainThreadMessageService), ( __param(1, INotificationService)), ( __param(2, ICommandService)), ( __param(3, IDialogService)), ( __param(4, IExtensionService)) ], MainThreadMessageService);

export { MainThreadMessageService };

FAQs

Package last updated on 18 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc