Archived
Merge from vscode aba87f135229c17c4624341b7a2499dcedafcb87 (#6430)
* Merge from vscode aba87f135229c17c4624341b7a2499dcedafcb87 * fix compile errors
This commit is contained in:
@@ -8,7 +8,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { SimpleTelemetryService } from 'vs/workbench/browser/web.simpleservices';
|
||||
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
|
||||
|
||||
suite('SQL Telemetry Utilities tests', () => {
|
||||
let telemetryService: TypeMoq.Mock<ITelemetryService>;
|
||||
@@ -35,7 +35,7 @@ suite('SQL Telemetry Utilities tests', () => {
|
||||
};
|
||||
|
||||
setup(() => {
|
||||
telemetryService = TypeMoq.Mock.ofType(SimpleTelemetryService, TypeMoq.MockBehavior.Strict);
|
||||
telemetryService = TypeMoq.Mock.ofType(TelemetryService, TypeMoq.MockBehavior.Strict, Object.create(null));
|
||||
telemetryService.setup(x => x.publicLog(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(x => Promise.resolve(none));
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import { ComponentBase } from 'sql/workbench/browser/modelComponents/componentBa
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/workbench/browser/modelComponents/interfaces';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { WebviewElement } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
|
||||
import { ElectronWebviewBasedWebview } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
|
||||
import { WebviewContentOptions } from 'vs/workbench/contrib/webview/common/webview';
|
||||
|
||||
function reviveWebviewOptions(options: vscode.WebviewOptions): vscode.WebviewOptions {
|
||||
@@ -38,7 +38,7 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
|
||||
private static readonly standardSupportedLinkSchemes = ['http', 'https', 'mailto'];
|
||||
|
||||
private _webview: WebviewElement;
|
||||
private _webview: ElectronWebviewBasedWebview;
|
||||
private _renderedHtml: string;
|
||||
private _extensionLocationUri: URI;
|
||||
private _ready: Promise<void>;
|
||||
@@ -65,7 +65,7 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
}
|
||||
|
||||
private _createWebview(): void {
|
||||
this._webview = this.instantiationService.createInstance(WebviewElement,
|
||||
this._webview = this.instantiationService.createInstance(ElectronWebviewBasedWebview,
|
||||
{
|
||||
allowSvgs: true
|
||||
},
|
||||
@@ -158,7 +158,7 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
this._ready.then(() => {
|
||||
super.setProperties(properties);
|
||||
if (this.options) {
|
||||
this._webview.options = this.getExtendedOptions();
|
||||
this._webview.contentOptions = this.getExtendedOptions();
|
||||
}
|
||||
if (this.html !== this._renderedHtml) {
|
||||
this.setHtml();
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ import { AngularDisposable } from 'sql/base/browser/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { WebviewElement } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
|
||||
import { ElectronWebviewBasedWebview } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
|
||||
|
||||
@Component({
|
||||
template: '',
|
||||
@@ -33,7 +33,7 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
|
||||
public readonly onMessage: Event<string> = this._onMessage.event;
|
||||
|
||||
private _onMessageDisposable: IDisposable;
|
||||
private _webview: WebviewElement;
|
||||
private _webview: ElectronWebviewBasedWebview;
|
||||
private _html: string;
|
||||
|
||||
constructor(
|
||||
@@ -100,7 +100,7 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
|
||||
this._onMessageDisposable.dispose();
|
||||
}
|
||||
|
||||
this._webview = this.instantiationService.createInstance(WebviewElement,
|
||||
this._webview = this.instantiationService.createInstance(ElectronWebviewBasedWebview,
|
||||
{},
|
||||
{
|
||||
allowScripts: true
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ import { IDashboardWebview, IDashboardViewService } from 'sql/platform/dashboard
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { WebviewElement } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
|
||||
import { ElectronWebviewBasedWebview } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
|
||||
|
||||
interface IWebviewWidgetConfig {
|
||||
id: string;
|
||||
@@ -31,7 +31,7 @@ const selector = 'webview-widget';
|
||||
export class WebviewWidget extends DashboardWidget implements IDashboardWidget, OnInit, IDashboardWebview {
|
||||
|
||||
private _id: string;
|
||||
private _webview: WebviewElement;
|
||||
private _webview: ElectronWebviewBasedWebview;
|
||||
private _html: string;
|
||||
private _onMessage = new Emitter<string>();
|
||||
public readonly onMessage: Event<string> = this._onMessage.event;
|
||||
@@ -99,7 +99,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
|
||||
this._onMessageDisposable.dispose();
|
||||
}
|
||||
|
||||
this._webview = this.instantiationService.createInstance(WebviewElement,
|
||||
this._webview = this.instantiationService.createInstance(ElectronWebviewBasedWebview,
|
||||
{},
|
||||
{
|
||||
allowScripts: true,
|
||||
|
||||
@@ -5,17 +5,13 @@
|
||||
|
||||
import 'vs/css!./media/connectionViewletPanel';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IExtensionTipsService, IExtensionManagementServerService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { ServerTreeView } from 'sql/workbench/parts/objectExplorer/browser/serverTreeView';
|
||||
import {
|
||||
@@ -23,12 +19,10 @@ import {
|
||||
AddServerAction, AddServerGroupAction
|
||||
} from 'sql/workbench/parts/objectExplorer/browser/connectionTreeAction';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
|
||||
import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
|
||||
export class ConnectionViewletPanel extends ViewletPanel {
|
||||
|
||||
private _root: HTMLElement;
|
||||
private _toDisposeViewlet: IDisposable[] = [];
|
||||
private _serverTreeView: ServerTreeView;
|
||||
private _addServerAction: IAction;
|
||||
private _addServerGroupAction: IAction;
|
||||
@@ -36,17 +30,11 @@ export class ConnectionViewletPanel extends ViewletPanel {
|
||||
|
||||
constructor(
|
||||
private options: IViewletViewOptions,
|
||||
@INotificationService protected notificationService: INotificationService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IInstantiationService protected instantiationService: IInstantiationService,
|
||||
@IThemeService private themeService: IThemeService,
|
||||
@IExtensionsWorkbenchService protected extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionTipsService protected tipsService: IExtensionTipsService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IWorkspaceContextService protected contextService: IWorkspaceContextService,
|
||||
@IExtensionManagementServerService protected extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IObjectExplorerService private objectExplorerService: IObjectExplorerService
|
||||
@IObjectExplorerService private readonly objectExplorerService: IObjectExplorerService
|
||||
) {
|
||||
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService);
|
||||
this._addServerAction = this.instantiationService.createInstance(AddServerAction,
|
||||
|
||||
@@ -16,7 +16,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
|
||||
import { localize } from 'vs/nls';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { WebviewElement } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
|
||||
import { ElectronWebviewBasedWebview } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -27,7 +27,7 @@ export class WebViewDialog extends Modal {
|
||||
private _okButton: Button;
|
||||
private _okLabel: string;
|
||||
private _closeLabel: string;
|
||||
private _webview: WebviewElement;
|
||||
private _webview: ElectronWebviewBasedWebview;
|
||||
private _html: string;
|
||||
private _headerTitle: string;
|
||||
|
||||
@@ -87,7 +87,7 @@ export class WebViewDialog extends Modal {
|
||||
protected renderBody(container: HTMLElement) {
|
||||
this._body = DOM.append(container, DOM.$('div.webview-dialog'));
|
||||
|
||||
this._webview = this._instantiationService.createInstance(WebviewElement,
|
||||
this._webview = this._instantiationService.createInstance(ElectronWebviewBasedWebview,
|
||||
{},
|
||||
{
|
||||
allowScripts: true
|
||||
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'semver-umd' {
|
||||
|
||||
export * from "semver";
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ let _isWeb = false;
|
||||
let _locale: string | undefined = undefined;
|
||||
let _language: string = LANGUAGE_DEFAULT;
|
||||
let _translationsConfigFile: string | undefined = undefined;
|
||||
let _userAgent: string | undefined = undefined;
|
||||
|
||||
interface NLSConfig {
|
||||
locale: string;
|
||||
@@ -48,10 +49,10 @@ const isElectronRenderer = (typeof process !== 'undefined' && typeof process.ver
|
||||
|
||||
// OS detection
|
||||
if (typeof navigator === 'object' && !isElectronRenderer) {
|
||||
const userAgent = navigator.userAgent;
|
||||
_isWindows = userAgent.indexOf('Windows') >= 0;
|
||||
_isMacintosh = userAgent.indexOf('Macintosh') >= 0;
|
||||
_isLinux = userAgent.indexOf('Linux') >= 0;
|
||||
_userAgent = navigator.userAgent;
|
||||
_isWindows = _userAgent.indexOf('Windows') >= 0;
|
||||
_isMacintosh = _userAgent.indexOf('Macintosh') >= 0;
|
||||
_isLinux = _userAgent.indexOf('Linux') >= 0;
|
||||
_isWeb = true;
|
||||
_locale = navigator.language;
|
||||
_language = _locale;
|
||||
@@ -108,6 +109,7 @@ export const isLinux = _isLinux;
|
||||
export const isNative = _isNative;
|
||||
export const isWeb = _isWeb;
|
||||
export const platform = _platform;
|
||||
export const userAgent = _userAgent;
|
||||
|
||||
export function isRootUser(): boolean {
|
||||
return _isNative && !_isWindows && (process.getuid() === 0);
|
||||
|
||||
@@ -30,7 +30,7 @@ for PID in "$@"; do
|
||||
fi
|
||||
|
||||
PROCESS_BEFORE_TIMES[$ITER]=$PROCESS_TIME_BEFORE
|
||||
((ITER++))
|
||||
((++ITER))
|
||||
done
|
||||
|
||||
# Wait for a second
|
||||
@@ -60,5 +60,5 @@ for PID in "$@"; do
|
||||
|
||||
# Parent script reads from stdout, so echo result to be read
|
||||
echo $CPU_USAGE
|
||||
((ITER++))
|
||||
((++ITER))
|
||||
done
|
||||
|
||||
@@ -23,7 +23,7 @@ export interface IChannel {
|
||||
}
|
||||
|
||||
/**
|
||||
* An `IServerChannel` is the couter part to `IChannel`,
|
||||
* An `IServerChannel` is the counter part to `IChannel`,
|
||||
* on the server-side. You should implement this interface
|
||||
* if you'd like to handle remote promises or events.
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
|
||||
<meta http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote:; media-src 'none'; child-src 'self' {{WEBVIEW_ENDPOINT}}; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: https:; font-src 'self' blob: vscode-remote:;">
|
||||
content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote:; media-src 'none'; child-src 'self' {{WEBVIEW_ENDPOINT}}; script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: https:; font-src 'self' blob: vscode-remote:;">
|
||||
|
||||
<meta id="vscode-workbench-web-configuration" data-settings="{{WORKBENCH_WEB_CONGIGURATION}}">
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
<body aria-label="">
|
||||
</body>
|
||||
|
||||
<!-- Application insights telemetry library -->
|
||||
<script src="https://az416426.vo.msecnd.net/scripts/a/ai.0.js"></script>
|
||||
|
||||
<!-- Require our AMD loader -->
|
||||
<script src="./out/vs/loader.js"></script>
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
'xterm': `${window.location.origin}/node_modules/xterm/lib/xterm.js`,
|
||||
'xterm-addon-search': `${window.location.origin}/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
|
||||
'xterm-addon-web-links': `${window.location.origin}/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
|
||||
'semver-umd': `${window.location.origin}/node_modules/semver-umd/lib/semver-umd.js`,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ export class IssueReporter extends Disposable {
|
||||
const channel = getDelayedChannel(sharedProcess.then(c => c.getChannel('telemetryAppender')));
|
||||
const appender = combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(logService));
|
||||
const commonProperties = resolveCommonProperties(product.commit || 'Commit unknown', pkg.version, configuration.machineId, this.environmentService.installSourcePath);
|
||||
const piiPaths = [this.environmentService.appRoot, this.environmentService.extensionsPath];
|
||||
const piiPaths = this.environmentService.extensionsPath ? [this.environmentService.appRoot, this.environmentService.extensionsPath] : [this.environmentService.appRoot];
|
||||
const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths };
|
||||
|
||||
const telemetryService = instantiationService.createInstance(TelemetryService, config);
|
||||
|
||||
@@ -13,7 +13,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { ExtensionManagementChannel } from 'vs/platform/extensionManagement/node/extensionManagementIpc';
|
||||
import { ExtensionManagementChannel } from 'vs/platform/extensionManagement/common/extensionManagementIpc';
|
||||
import { IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService';
|
||||
import { ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService';
|
||||
@@ -158,7 +158,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
|
||||
const config: ITelemetryServiceConfig = {
|
||||
appender: combinedAppender(appInsightsAppender, new LogAppender(logService)),
|
||||
commonProperties: resolveCommonProperties(product.commit, pkg.version, configuration.machineId, installSourcePath),
|
||||
piiPaths: [appRoot, extensionsPath]
|
||||
piiPaths: extensionsPath ? [appRoot, extensionsPath] : [appRoot]
|
||||
};
|
||||
|
||||
telemetryService = new TelemetryService(config, configurationService);
|
||||
|
||||
@@ -86,6 +86,7 @@ import { DiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsIpc'
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
|
||||
import { ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc';
|
||||
|
||||
export class CodeApplication extends Disposable {
|
||||
|
||||
@@ -240,6 +241,7 @@ export class CodeApplication extends Disposable {
|
||||
context: OpenContext.DOCK /* can also be opening from finder while app is running */,
|
||||
cli: this.environmentService.args,
|
||||
urisToOpen: macOpenFileURIs,
|
||||
gotoLineMode: false,
|
||||
preferNewWindow: true /* dropping on the dock or opening from finder prefers to open in a new window */
|
||||
});
|
||||
|
||||
@@ -279,12 +281,6 @@ export class CodeApplication extends Disposable {
|
||||
}
|
||||
});
|
||||
|
||||
ipc.on('vscode:extensionHostDebug', (_: Event, windowId: number, broadcast: any) => {
|
||||
if (this.windowsMainService) {
|
||||
this.windowsMainService.sendToAll('vscode:extensionHostDebug', broadcast, [windowId]); // Send to all windows (except sender window)
|
||||
}
|
||||
});
|
||||
|
||||
ipc.on('vscode:toggleDevTools', (event: Event) => event.sender.toggleDevTools());
|
||||
ipc.on('vscode:openDevTools', (event: Event) => event.sender.openDevTools());
|
||||
|
||||
@@ -484,7 +480,7 @@ export class CodeApplication extends Disposable {
|
||||
const channel = getDelayedChannel(sharedProcessClient.then(client => client.getChannel('telemetryAppender')));
|
||||
const appender = combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(this.logService));
|
||||
const commonProperties = resolveCommonProperties(product.commit, pkg.version, machineId, this.environmentService.installSourcePath);
|
||||
const piiPaths = [this.environmentService.appRoot, this.environmentService.extensionsPath];
|
||||
const piiPaths = this.environmentService.extensionsPath ? [this.environmentService.appRoot, this.environmentService.extensionsPath] : [this.environmentService.appRoot];
|
||||
const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths, trueMachineId };
|
||||
|
||||
services.set(ITelemetryService, new SyncDescriptor(TelemetryService, [config]));
|
||||
@@ -577,6 +573,9 @@ export class CodeApplication extends Disposable {
|
||||
electronIpcServer.registerChannel('loglevel', logLevelChannel);
|
||||
sharedProcessClient.then(client => client.registerChannel('loglevel', logLevelChannel));
|
||||
|
||||
// ExtensionHost Debug broadcast service
|
||||
electronIpcServer.registerChannel(ExtensionHostDebugBroadcastChannel.ChannelName, new ExtensionHostDebugBroadcastChannel());
|
||||
|
||||
// Signal phase: ready (services set)
|
||||
this.lifecycleService.phase = LifecycleMainPhase.Ready;
|
||||
|
||||
@@ -597,8 +596,8 @@ export class CodeApplication extends Disposable {
|
||||
urlService.registerHandler({
|
||||
async handleURL(uri: URI): Promise<boolean> {
|
||||
if (windowsMainService.getWindowCount() === 0) {
|
||||
const cli = { ...environmentService.args, goto: true };
|
||||
const [window] = windowsMainService.open({ context: OpenContext.API, cli, forceEmpty: true });
|
||||
const cli = { ...environmentService.args };
|
||||
const [window] = windowsMainService.open({ context: OpenContext.API, cli, forceEmpty: true, gotoLineMode: true });
|
||||
|
||||
await window.ready();
|
||||
|
||||
@@ -649,6 +648,7 @@ export class CodeApplication extends Disposable {
|
||||
urisToOpen: macOpenFiles.map(file => this.getURIToOpenFromPathSync(file)),
|
||||
noRecentEntry,
|
||||
waitMarkerFileURI,
|
||||
gotoLineMode: false,
|
||||
initialStartup: true
|
||||
});
|
||||
}
|
||||
@@ -661,6 +661,7 @@ export class CodeApplication extends Disposable {
|
||||
diffMode: args.diff,
|
||||
noRecentEntry,
|
||||
waitMarkerFileURI,
|
||||
gotoLineMode: args.goto,
|
||||
initialStartup: true
|
||||
});
|
||||
}
|
||||
|
||||
@@ -334,7 +334,9 @@ class CodeMain {
|
||||
if (error.code === 'EACCES' || error.code === 'EPERM') {
|
||||
this.showStartupWarningDialog(
|
||||
localize('startupDataDirError', "Unable to write program user data."),
|
||||
localize('startupDataDirErrorDetail', "Please make sure the directories {0} and {1} are writeable.", environmentService.userDataPath, environmentService.extensionsPath)
|
||||
environmentService.extensionsPath
|
||||
? localize('startupUserDataAndExtensionsDirErrorDetail', "Please make sure the directories {0} and {1} are writeable.", environmentService.userDataPath, environmentService.extensionsPath)
|
||||
: localize('startupUserDataDirErrorDetail', "Please make sure the directory {0} is writeable.", environmentService.userDataPath)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -844,8 +844,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
|
||||
|
||||
private doExtractPathsFromAPI(openConfig: IOpenConfiguration): IPathToOpen[] {
|
||||
const pathsToOpen: IPathToOpen[] = [];
|
||||
const cli = openConfig.cli;
|
||||
const parseOptions: IPathParseOptions = { gotoLineMode: cli && cli.goto };
|
||||
const parseOptions: IPathParseOptions = { gotoLineMode: openConfig.gotoLineMode };
|
||||
for (const pathToOpen of openConfig.urisToOpen || []) {
|
||||
if (!pathToOpen) {
|
||||
continue;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as semver from 'semver';
|
||||
import * as semver from 'semver-umd';
|
||||
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
@@ -102,7 +102,7 @@ export class Main {
|
||||
const ids: string[] = typeof arg === 'string' ? [arg] : arg;
|
||||
await this.locateExtension(ids);
|
||||
} else if (argv['telemetry']) {
|
||||
console.log(buildTelemetryMessage(this.environmentService.appRoot, this.environmentService.extensionsPath));
|
||||
console.log(buildTelemetryMessage(this.environmentService.appRoot, this.environmentService.extensionsPath ? this.environmentService.extensionsPath : undefined));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,8 @@ export async function main(argv: ParsedArgs): Promise<void> {
|
||||
process.once('exit', () => logService.dispose());
|
||||
logService.info('main', argv);
|
||||
|
||||
await Promise.all([environmentService.appSettingsHome.fsPath, environmentService.extensionsPath].map(p => mkdirp(p)));
|
||||
await Promise.all<void | undefined>([environmentService.appSettingsHome.fsPath, environmentService.extensionsPath]
|
||||
.map((path): undefined | Promise<void> => path ? mkdirp(path) : undefined));
|
||||
|
||||
const configurationService = new ConfigurationService(environmentService.settingsResource);
|
||||
disposables.add(configurationService);
|
||||
@@ -339,7 +340,7 @@ export async function main(argv: ParsedArgs): Promise<void> {
|
||||
const config: ITelemetryServiceConfig = {
|
||||
appender: combinedAppender(...appenders),
|
||||
commonProperties: resolveCommonProperties(product.commit, pkg.version, stateService.getItem('telemetry.machineId'), installSourcePath),
|
||||
piiPaths: [appRoot, extensionsPath]
|
||||
piiPaths: extensionsPath ? [appRoot, extensionsPath] : [appRoot]
|
||||
};
|
||||
|
||||
services.set(ITelemetryService, new SyncDescriptor(TelemetryService, [config]));
|
||||
|
||||
@@ -451,6 +451,7 @@ export class Minimap extends ViewPart {
|
||||
|
||||
private _options: MinimapOptions;
|
||||
private _lastRenderData: RenderData | null;
|
||||
private _lastDecorations: ViewModelDecoration[] | undefined;
|
||||
private _renderDecorations: boolean = false;
|
||||
private _buffers: MinimapBuffers | null;
|
||||
|
||||
@@ -675,6 +676,13 @@ export class Minimap extends ViewPart {
|
||||
return true;
|
||||
}
|
||||
|
||||
public onThemeChanged(e: viewEvents.ViewThemeChangedEvent): boolean {
|
||||
this._context.model.invalidateMinimapColorCache();
|
||||
// Only bother calling render if decorations are currently shown
|
||||
this._renderDecorations = !!this._lastDecorations;
|
||||
return !!this._lastDecorations;
|
||||
}
|
||||
|
||||
// --- end event handlers
|
||||
|
||||
public prepareRender(ctx: RenderingContext): void {
|
||||
@@ -751,6 +759,8 @@ export class Minimap extends ViewPart {
|
||||
this.renderDecorationOnLine(canvasContext, lineOffsetMap, decoration, layout, line, height, lineHeight, tabSize, characterWidth);
|
||||
}
|
||||
}
|
||||
|
||||
this._lastDecorations = decorations;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2703,6 +2703,10 @@ export class ModelDecorationMinimapOptions extends DecorationOptions {
|
||||
return this._resolvedColor;
|
||||
}
|
||||
|
||||
public invalidateCachedColor(): void {
|
||||
this._resolvedColor = undefined;
|
||||
}
|
||||
|
||||
private _resolveColor(color: string | ThemeColor, theme: ITheme): Color | undefined {
|
||||
if (typeof color === 'string') {
|
||||
return Color.fromHex(color);
|
||||
|
||||
@@ -1285,7 +1285,7 @@ export interface CommentThread {
|
||||
commentThreadHandle: number;
|
||||
controllerHandle: number;
|
||||
extensionId?: string;
|
||||
threadId: string | null;
|
||||
threadId: string;
|
||||
resource: string | null;
|
||||
range: IRange;
|
||||
label: string;
|
||||
@@ -1333,8 +1333,7 @@ export enum CommentMode {
|
||||
* @internal
|
||||
*/
|
||||
export interface Comment {
|
||||
readonly commentId: string;
|
||||
readonly uniqueIdInThread?: number;
|
||||
readonly uniqueIdInThread: number;
|
||||
readonly body: IMarkdownString;
|
||||
readonly userName: string;
|
||||
readonly userIconPath?: string;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { Color, RGBA } from 'vs/base/common/color';
|
||||
import { activeContrastBorder, editorBackground, editorForeground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { activeContrastBorder, editorBackground, editorForeground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ export const editorRuler = registerColor('editorRuler.foreground', { dark: '#5A5
|
||||
export const editorCodeLensForeground = registerColor('editorCodeLens.foreground', { dark: '#999999', light: '#999999', hc: '#999999' }, nls.localize('editorCodeLensForeground', 'Foreground color of editor code lenses'));
|
||||
|
||||
export const editorBracketMatchBackground = registerColor('editorBracketMatch.background', { dark: '#0064001a', light: '#0064001a', hc: '#0064001a' }, nls.localize('editorBracketMatchBackground', 'Background color behind matching brackets'));
|
||||
export const editorBracketMatchBorder = registerColor('editorBracketMatch.border', { dark: '#888', light: '#B9B9B9', hc: '#fff' }, nls.localize('editorBracketMatchBorder', 'Color for matching brackets boxes'));
|
||||
export const editorBracketMatchBorder = registerColor('editorBracketMatch.border', { dark: '#888', light: '#B9B9B9', hc: contrastBorder }, nls.localize('editorBracketMatchBorder', 'Color for matching brackets boxes'));
|
||||
|
||||
export const editorOverviewRulerBorder = registerColor('editorOverviewRuler.border', { dark: '#7f7f7f4d', light: '#7f7f7f4d', hc: '#7f7f7f4d' }, nls.localize('editorOverviewRulerBorder', 'Color of the overview ruler border.'));
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ export interface IViewModel {
|
||||
getLineLastNonWhitespaceColumn(lineNumber: number): number;
|
||||
getAllOverviewRulerDecorations(theme: ITheme): IOverviewRulerDecorations;
|
||||
invalidateOverviewRulerColorCache(): void;
|
||||
invalidateMinimapColorCache(): void;
|
||||
getValueInRange(range: Range, eol: EndOfLinePreference): string;
|
||||
|
||||
getModelLineMaxColumn(modelLineNumber: number): number;
|
||||
|
||||
@@ -11,7 +11,7 @@ import { IPosition, Position } from 'vs/editor/common/core/position';
|
||||
import { IRange, Range } from 'vs/editor/common/core/range';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { EndOfLinePreference, IActiveIndentGuideInfo, ITextModel, TrackedRangeStickiness, TextModelResolvedOptions } from 'vs/editor/common/model';
|
||||
import { ModelDecorationOverviewRulerOptions } from 'vs/editor/common/model/textModel';
|
||||
import { ModelDecorationOverviewRulerOptions, ModelDecorationMinimapOptions } from 'vs/editor/common/model/textModel';
|
||||
import * as textModelEvents from 'vs/editor/common/model/textModelEvents';
|
||||
import { ColorId, LanguageId, TokenizationRegistry } from 'vs/editor/common/modes';
|
||||
import { tokenizeLineToHTML } from 'vs/editor/common/modes/textToHtmlTokenizer';
|
||||
@@ -565,6 +565,16 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public invalidateMinimapColorCache(): void {
|
||||
const decorations = this.model.getAllDecorations();
|
||||
for (const decoration of decorations) {
|
||||
const opts = <ModelDecorationMinimapOptions>decoration.options.minimap;
|
||||
if (opts) {
|
||||
opts.invalidateCachedColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public getValueInRange(range: Range, eol: EndOfLinePreference): string {
|
||||
const modelRange = this.coordinatesConverter.convertViewRangeToModelRange(range);
|
||||
return this.model.getValueInRange(modelRange, eol);
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IServerChannel, IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IReloadSessionEvent, ICloseSessionEvent, IAttachSessionEvent, ILogToSessionEvent, ITerminateSessionEvent, IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IRemoteConsoleLog } from 'vs/base/common/console';
|
||||
|
||||
export class ExtensionHostDebugBroadcastChannel<TContext> implements IServerChannel<TContext> {
|
||||
|
||||
static readonly ChannelName = 'extensionhostdebugservice';
|
||||
|
||||
private _onCloseEmitter = new Emitter<ICloseSessionEvent>();
|
||||
private _onReloadEmitter = new Emitter<IReloadSessionEvent>();
|
||||
private _onTerminateEmitter = new Emitter<ITerminateSessionEvent>();
|
||||
private _onLogToEmitter = new Emitter<ILogToSessionEvent>();
|
||||
private _onAttachEmitter = new Emitter<IAttachSessionEvent>();
|
||||
|
||||
call(ctx: TContext, command: string, arg?: any): Promise<any> {
|
||||
switch (command) {
|
||||
case 'close':
|
||||
return Promise.resolve(this._onCloseEmitter.fire({ sessionId: arg[0] }));
|
||||
case 'reload':
|
||||
return Promise.resolve(this._onReloadEmitter.fire({ sessionId: arg[0] }));
|
||||
case 'terminate':
|
||||
return Promise.resolve(this._onTerminateEmitter.fire({ sessionId: arg[0] }));
|
||||
case 'log':
|
||||
return Promise.resolve(this._onLogToEmitter.fire({ sessionId: arg[0], log: arg[1] }));
|
||||
case 'attach':
|
||||
return Promise.resolve(this._onAttachEmitter.fire({ sessionId: arg[0], port: arg[1], subId: arg[2] }));
|
||||
}
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
listen(ctx: TContext, event: string, arg?: any): Event<any> {
|
||||
switch (event) {
|
||||
case 'close':
|
||||
return this._onCloseEmitter.event;
|
||||
case 'reload':
|
||||
return this._onReloadEmitter.event;
|
||||
case 'terminate':
|
||||
return this._onTerminateEmitter.event;
|
||||
case 'log':
|
||||
return this._onLogToEmitter.event;
|
||||
case 'attach':
|
||||
return this._onAttachEmitter.event;
|
||||
}
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtensionHostDebugChannelClient implements IExtensionHostDebugService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
constructor(private channel: IChannel) { }
|
||||
|
||||
reload(sessionId: string): void {
|
||||
this.channel.call('reload', [sessionId]);
|
||||
}
|
||||
|
||||
get onReload(): Event<IReloadSessionEvent> {
|
||||
return this.channel.listen('reload');
|
||||
}
|
||||
|
||||
close(sessionId: string): void {
|
||||
this.channel.call('close', [sessionId]);
|
||||
}
|
||||
|
||||
get onClose(): Event<ICloseSessionEvent> {
|
||||
return this.channel.listen('close');
|
||||
}
|
||||
|
||||
attachSession(sessionId: string, port: number, subId?: string): void {
|
||||
this.channel.call('attach', [sessionId, port, subId]);
|
||||
}
|
||||
|
||||
get onAttachSession(): Event<IAttachSessionEvent> {
|
||||
return this.channel.listen('attach');
|
||||
}
|
||||
|
||||
logToSession(sessionId: string, log: IRemoteConsoleLog): void {
|
||||
this.channel.call('log', [sessionId, log]);
|
||||
}
|
||||
|
||||
get onLogToSession(): Event<ILogToSessionEvent> {
|
||||
return this.channel.listen('log');
|
||||
}
|
||||
|
||||
terminateSession(sessionId: string, subId?: string): void {
|
||||
this.channel.call('terminate', [sessionId, subId]);
|
||||
}
|
||||
|
||||
get onTerminateSession(): Event<ITerminateSessionEvent> {
|
||||
return this.channel.listen('terminate');
|
||||
}
|
||||
}
|
||||
@@ -520,14 +520,17 @@ export class DiagnosticsService implements IDiagnosticsService {
|
||||
if (folderUri.scheme === 'file') {
|
||||
const folder = folderUri.fsPath;
|
||||
collectWorkspaceStats(folder, ['node_modules', '.git']).then(stats => {
|
||||
/* __GDPR__
|
||||
"workspace.stats" : {
|
||||
"fileTypes" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"configTypes" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"launchConfigs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('workspace.stats', {
|
||||
type WorkspaceStatsClassification = {
|
||||
fileTypes: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
|
||||
configTypes: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
|
||||
launchConfigs: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
|
||||
};
|
||||
type WorkspaceStatsEvent = {
|
||||
fileTypes: WorkspaceStatItem[];
|
||||
configTypes: WorkspaceStatItem[];
|
||||
launchConfigs: WorkspaceStatItem[];
|
||||
};
|
||||
this.telemetryService.publicLog2<WorkspaceStatsEvent, WorkspaceStatsClassification>('workspace.stats', {
|
||||
fileTypes: stats.fileTypes,
|
||||
configTypes: stats.configFiles,
|
||||
launchConfigs: stats.launchConfigFiles
|
||||
|
||||
@@ -140,7 +140,7 @@ export interface IEnvironmentService {
|
||||
isExtensionDevelopment: boolean;
|
||||
disableExtensions: boolean | string[];
|
||||
builtinExtensionsPath: string;
|
||||
extensionsPath: string;
|
||||
extensionsPath?: string;
|
||||
extensionDevelopmentLocationURI?: URI[];
|
||||
extensionTestsLocationURI?: URI;
|
||||
|
||||
@@ -178,4 +178,6 @@ export interface IEnvironmentService {
|
||||
webviewEndpoint?: string;
|
||||
readonly webviewResourceRoot: string;
|
||||
readonly webviewCspSource: string;
|
||||
|
||||
readonly galleryMachineIdResource?: URI;
|
||||
}
|
||||
|
||||
@@ -266,6 +266,9 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
@memoize
|
||||
get nodeCachedDataDir(): string | undefined { return process.env['VSCODE_NODE_CACHED_DATA_DIR'] || undefined; }
|
||||
|
||||
@memoize
|
||||
get galleryMachineIdResource(): URI { return resources.joinPath(URI.file(this.userDataPath), 'machineid'); }
|
||||
|
||||
get disableUpdates(): boolean { return !!this._args['disable-updates']; }
|
||||
get disableCrashReporter(): boolean { return !!this._args['disable-crash-reporter']; }
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getGalleryExtensionId, getGalleryExtensionTelemetryData, adoptToGallery
|
||||
import { assign, getOrDefault } from 'vs/base/common/objects';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IPager } from 'vs/base/common/paging';
|
||||
import { IRequestService, IRequestOptions, IRequestContext, asJson, asText } from 'vs/platform/request/common/request';
|
||||
import { IRequestService, IRequestOptions, IRequestContext, asJson, asText, IHeaders } from 'vs/platform/request/common/request';
|
||||
import { isEngineValid } from 'vs/platform/extensions/common/extensionValidator';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { generateUuid, isUUID } from 'vs/base/common/uuid';
|
||||
@@ -467,13 +467,15 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
||||
let text = options.text || '';
|
||||
const pageSize = getOrDefault(options, o => o.pageSize, 50);
|
||||
|
||||
/* __GDPR__
|
||||
"galleryService:query" : {
|
||||
"type" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"text": { "classification": "CustomerContent", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('galleryService:query', { type, text });
|
||||
type GalleryServiceQueryClassification = {
|
||||
type: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
text: { classification: 'CustomerContent', purpose: 'FeatureInsight' };
|
||||
};
|
||||
type GalleryServiceQueryEvent = {
|
||||
type: string;
|
||||
text: string;
|
||||
};
|
||||
this.telemetryService.publicLog2<GalleryServiceQueryEvent, GalleryServiceQueryClassification>('galleryService:query', { type, text });
|
||||
|
||||
let query = new Query()
|
||||
.withFlags(Flags.IncludeLatestVersionOnly, Flags.IncludeAssetUri, Flags.IncludeStatistics, Flags.IncludeFiles, Flags.IncludeVersionProperties)
|
||||
@@ -943,29 +945,30 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
||||
}
|
||||
|
||||
export async function resolveMarketplaceHeaders(version: string, environmentService: IEnvironmentService, fileService: IFileService): Promise<{ [key: string]: string; }> {
|
||||
const marketplaceMachineIdFile = joinPath(URI.file(environmentService.userDataPath), 'machineid');
|
||||
|
||||
let uuid: string | null = null;
|
||||
|
||||
try {
|
||||
const contents = await fileService.readFile(marketplaceMachineIdFile);
|
||||
const value = contents.value.toString();
|
||||
uuid = isUUID(value) ? value : null;
|
||||
} catch (e) {
|
||||
uuid = null;
|
||||
}
|
||||
|
||||
if (!uuid) {
|
||||
uuid = generateUuid();
|
||||
try {
|
||||
await fileService.writeFile(marketplaceMachineIdFile, VSBuffer.fromString(uuid));
|
||||
} catch (error) {
|
||||
//noop
|
||||
}
|
||||
}
|
||||
return {
|
||||
const headers: IHeaders = {
|
||||
'X-Market-Client-Id': `VSCode ${version}`,
|
||||
'User-Agent': `VSCode ${version}`,
|
||||
'X-Market-User-Id': uuid
|
||||
'User-Agent': `VSCode ${version}`
|
||||
};
|
||||
let uuid: string | null = null;
|
||||
if (environmentService.galleryMachineIdResource) {
|
||||
try {
|
||||
const contents = await fileService.readFile(environmentService.galleryMachineIdResource);
|
||||
const value = contents.value.toString();
|
||||
uuid = isUUID(value) ? value : null;
|
||||
} catch (e) {
|
||||
uuid = null;
|
||||
}
|
||||
|
||||
if (!uuid) {
|
||||
uuid = generateUuid();
|
||||
try {
|
||||
await fileService.writeFile(environmentService.galleryMachineIdResource, VSBuffer.fromString(uuid));
|
||||
} catch (error) {
|
||||
//noop
|
||||
}
|
||||
}
|
||||
headers['X-Market-User-Id'] = uuid;
|
||||
}
|
||||
return headers;
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import { Event } from 'vs/base/common/event';
|
||||
import { IPager } from 'vs/base/common/paging';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IExtensionManifest, IExtension, ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
@@ -210,110 +209,6 @@ export interface IExtensionManagementService {
|
||||
updateMetadata(local: ILocalExtension, metadata: IGalleryMetadata): Promise<ILocalExtension>;
|
||||
}
|
||||
|
||||
export const IExtensionManagementServerService = createDecorator<IExtensionManagementServerService>('extensionManagementServerService');
|
||||
|
||||
export interface IExtensionManagementServer {
|
||||
extensionManagementService: IExtensionManagementService;
|
||||
authority: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface IExtensionManagementServerService {
|
||||
_serviceBrand: any;
|
||||
readonly localExtensionManagementServer: IExtensionManagementServer;
|
||||
readonly remoteExtensionManagementServer: IExtensionManagementServer | null;
|
||||
getExtensionManagementServer(location: URI): IExtensionManagementServer | null;
|
||||
}
|
||||
|
||||
export const enum EnablementState {
|
||||
Disabled,
|
||||
WorkspaceDisabled,
|
||||
Enabled,
|
||||
WorkspaceEnabled
|
||||
}
|
||||
|
||||
export const IExtensionEnablementService = createDecorator<IExtensionEnablementService>('extensionEnablementService');
|
||||
|
||||
export interface IExtensionEnablementService {
|
||||
_serviceBrand: any;
|
||||
|
||||
readonly allUserExtensionsDisabled: boolean;
|
||||
|
||||
/**
|
||||
* Event to listen on for extension enablement changes
|
||||
*/
|
||||
onEnablementChanged: Event<IExtension[]>;
|
||||
|
||||
/**
|
||||
* Returns the enablement state for the given extension
|
||||
*/
|
||||
getEnablementState(extension: IExtension): EnablementState;
|
||||
|
||||
/**
|
||||
* Returns `true` if the enablement can be changed.
|
||||
*/
|
||||
canChangeEnablement(extension: IExtension): boolean;
|
||||
|
||||
/**
|
||||
* Returns `true` if the given extension identifier is enabled.
|
||||
*/
|
||||
isEnabled(extension: IExtension): boolean;
|
||||
|
||||
/**
|
||||
* Enable or disable the given extension.
|
||||
* if `workspace` is `true` then enablement is done for workspace, otherwise globally.
|
||||
*
|
||||
* Returns a promise that resolves to boolean value.
|
||||
* if resolves to `true` then requires restart for the change to take effect.
|
||||
*
|
||||
* Throws error if enablement is requested for workspace and there is no workspace
|
||||
*/
|
||||
setEnablement(extensions: IExtension[], state: EnablementState): Promise<boolean[]>;
|
||||
}
|
||||
|
||||
export interface IExtensionsConfigContent {
|
||||
recommendations: string[];
|
||||
unwantedRecommendations: string[];
|
||||
}
|
||||
|
||||
export type RecommendationChangeNotification = {
|
||||
extensionId: string,
|
||||
isRecommended: boolean
|
||||
};
|
||||
|
||||
export type DynamicRecommendation = 'dynamic';
|
||||
export type ExecutableRecommendation = 'executable';
|
||||
export type CachedRecommendation = 'cached';
|
||||
export type ApplicationRecommendation = 'application';
|
||||
export type ExtensionRecommendationSource = IWorkspace | IWorkspaceFolder | URI | DynamicRecommendation | ExecutableRecommendation | CachedRecommendation | ApplicationRecommendation;
|
||||
|
||||
export interface IExtensionRecommendation {
|
||||
extensionId: string;
|
||||
sources: ExtensionRecommendationSource[];
|
||||
}
|
||||
|
||||
export const IExtensionTipsService = createDecorator<IExtensionTipsService>('extensionTipsService');
|
||||
|
||||
export interface IExtensionTipsService {
|
||||
_serviceBrand: any;
|
||||
getAllRecommendationsWithReason(): { [id: string]: { reasonId: ExtensionRecommendationReason, reasonText: string }; };
|
||||
getFileBasedRecommendations(): IExtensionRecommendation[];
|
||||
getOtherRecommendations(): Promise<IExtensionRecommendation[]>;
|
||||
getWorkspaceRecommendations(): Promise<IExtensionRecommendation[]>;
|
||||
getKeymapRecommendations(): IExtensionRecommendation[];
|
||||
toggleIgnoredRecommendation(extensionId: string, shouldIgnore: boolean): void;
|
||||
getAllIgnoredRecommendations(): { global: string[], workspace: string[] };
|
||||
onRecommendationChange: Event<RecommendationChangeNotification>;
|
||||
}
|
||||
|
||||
export const enum ExtensionRecommendationReason {
|
||||
Workspace,
|
||||
File,
|
||||
Executable,
|
||||
DynamicWorkspace,
|
||||
Experimental
|
||||
}
|
||||
|
||||
export const ExtensionsLabel = localize('extensions', "Extensions");
|
||||
export const ExtensionsChannelId = 'extensions';
|
||||
export const PreferencesLabel = localize('preferences', "Preferences");
|
||||
|
||||
@@ -26,7 +26,7 @@ import { localizeManifest } from '../common/extensionNls';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { Limiter, createCancelablePromise, CancelablePromise, Queue } from 'vs/base/common/async';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import * as semver from 'semver';
|
||||
import * as semver from 'semver-umd';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import { isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
@@ -138,7 +138,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
||||
) {
|
||||
super();
|
||||
this.systemExtensionsPath = environmentService.builtinExtensionsPath;
|
||||
this.extensionsPath = environmentService.extensionsPath;
|
||||
this.extensionsPath = environmentService.extensionsPath!;
|
||||
this.uninstalledPath = path.join(this.extensionsPath, '.obsolete');
|
||||
this.uninstalledFileLimiter = new Queue();
|
||||
this.manifestCache = this._register(new ExtensionsManifestCache(environmentService, this));
|
||||
|
||||
@@ -228,7 +228,8 @@ export class LaunchService implements ILaunchService {
|
||||
diffMode: args.diff,
|
||||
addMode: args.add,
|
||||
noRecentEntry: !!args['skip-add-to-recently-opened'],
|
||||
waitMarkerFileURI
|
||||
waitMarkerFileURI,
|
||||
gotoLineMode: args.goto
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -487,7 +487,8 @@ export class Menubar {
|
||||
context: OpenContext.MENU,
|
||||
cli: this.environmentService.args,
|
||||
urisToOpen: [uriToOpen],
|
||||
forceNewWindow: openInNewWindow
|
||||
forceNewWindow: openInNewWindow,
|
||||
gotoLineMode: false
|
||||
}).length > 0;
|
||||
|
||||
if (!success) {
|
||||
|
||||
@@ -21,7 +21,7 @@ export class ProductService implements IProductService {
|
||||
|
||||
get vscodeVersion(): string { return '1.35.0'; } // {{SQL CARBON EDIT}} add vscodeversion
|
||||
|
||||
get commit(): string | undefined { return undefined; }
|
||||
get commit(): string | undefined { return this.productConfiguration ? this.productConfiguration.commit : undefined; }
|
||||
|
||||
get nameLong(): string { return ''; }
|
||||
|
||||
@@ -46,4 +46,6 @@ export class ProductService implements IProductService {
|
||||
get extensionKeywords(): { [extension: string]: readonly string[]; } | undefined { return this.productConfiguration ? this.productConfiguration.extensionKeywords : undefined; }
|
||||
|
||||
get extensionAllowedBadgeProviders(): readonly string[] | undefined { return this.productConfiguration ? this.productConfiguration.extensionAllowedBadgeProviders : undefined; }
|
||||
|
||||
get aiConfig() { return this.productConfiguration ? this.productConfiguration.aiConfig : undefined; }
|
||||
}
|
||||
@@ -38,6 +38,10 @@ export interface IProductService {
|
||||
readonly experimentsUrl?: string;
|
||||
readonly extensionKeywords?: { [extension: string]: readonly string[]; };
|
||||
readonly extensionAllowedBadgeProviders?: readonly string[];
|
||||
|
||||
readonly aiConfig?: {
|
||||
readonly asimovKey: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IProductConfiguration {
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
|
||||
export const instanceStorageKey = 'telemetry.instanceId';
|
||||
export const currentSessionDateStorageKey = 'telemetry.currentSessionDate';
|
||||
export const firstSessionDateStorageKey = 'telemetry.firstSessionDate';
|
||||
export const lastSessionDateStorageKey = 'telemetry.lastSessionDate';
|
||||
|
||||
import * as Platform from 'vs/base/common/platform';
|
||||
import * as uuid from 'vs/base/common/uuid';
|
||||
|
||||
export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, remoteAuthority?: string): Promise<{ [name: string]: string | undefined }> {
|
||||
const result: { [name: string]: string | undefined; } = Object.create(null);
|
||||
const instanceId = storageService.get(instanceStorageKey, StorageScope.GLOBAL)!;
|
||||
const firstSessionDate = storageService.get(firstSessionDateStorageKey, StorageScope.GLOBAL)!;
|
||||
const lastSessionDate = storageService.get(lastSessionDateStorageKey, StorageScope.GLOBAL)!;
|
||||
|
||||
// __GDPR__COMMON__ "common.firstSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
result['common.firstSessionDate'] = firstSessionDate;
|
||||
// __GDPR__COMMON__ "common.lastSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
result['common.lastSessionDate'] = lastSessionDate || '';
|
||||
// __GDPR__COMMON__ "common.isNewSession" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
result['common.isNewSession'] = !lastSessionDate ? '1' : '0';
|
||||
// __GDPR__COMMON__ "common.instanceId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
result['common.instanceId'] = instanceId;
|
||||
// __GDPR__COMMON__ "common.remoteAuthority" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
|
||||
result['common.remoteAuthority'] = cleanRemoteAuthority(remoteAuthority);
|
||||
|
||||
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
|
||||
result['common.machineId'] = machineId;
|
||||
// __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
result['sessionID'] = uuid.generateUuid() + Date.now();
|
||||
// __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
|
||||
result['commitHash'] = commit;
|
||||
// __GDPR__COMMON__ "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
result['version'] = version;
|
||||
// __GDPR__COMMON__ "common.platform" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
result['common.platform'] = Platform.PlatformToString(Platform.platform);
|
||||
// __GDPR__COMMON__ "common.product" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
|
||||
result['common.product'] = 'web';
|
||||
// __GDPR__COMMON__ "common.userAgent" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
result['common.userAgent'] = Platform.userAgent;
|
||||
|
||||
// dynamic properties which value differs on each call
|
||||
let seq = 0;
|
||||
const startTime = Date.now();
|
||||
Object.defineProperties(result, {
|
||||
// __GDPR__COMMON__ "timestamp" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
'timestamp': {
|
||||
get: () => new Date(),
|
||||
enumerable: true
|
||||
},
|
||||
// __GDPR__COMMON__ "common.timesincesessionstart" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
'common.timesincesessionstart': {
|
||||
get: () => Date.now() - startTime,
|
||||
enumerable: true
|
||||
},
|
||||
// __GDPR__COMMON__ "common.sequence" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
'common.sequence': {
|
||||
get: () => seq++,
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function cleanRemoteAuthority(remoteAuthority?: string): string {
|
||||
if (!remoteAuthority) {
|
||||
return 'none';
|
||||
}
|
||||
|
||||
let ret = 'other';
|
||||
// Whitelisted remote authorities
|
||||
['ssh-remote', 'dev-container', 'wsl'].forEach((res: string) => {
|
||||
if (remoteAuthority!.indexOf(`${res}+`) === 0) {
|
||||
ret = res;
|
||||
}
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import { IKeybindingService, KeybindingSource } from 'vs/platform/keybinding/com
|
||||
import { ITelemetryService, ITelemetryInfo, ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/platform/telemetry/common/gdprTypings';
|
||||
import { safeStringify } from 'vs/base/common/objects';
|
||||
import { isObject } from 'vs/base/common/types';
|
||||
|
||||
export const NullTelemetryService = new class implements ITelemetryService {
|
||||
_serviceBrand: undefined;
|
||||
@@ -243,6 +245,77 @@ export function keybindingsTelemetry(telemetryService: ITelemetryService, keybin
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export interface Properties {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export interface Measurements {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
export function validateTelemetryData(data?: any): { properties: Properties, measurements: Measurements } {
|
||||
|
||||
const properties: Properties = Object.create(null);
|
||||
const measurements: Measurements = Object.create(null);
|
||||
|
||||
const flat = Object.create(null);
|
||||
flatten(data, flat);
|
||||
|
||||
for (let prop in flat) {
|
||||
// enforce property names less than 150 char, take the last 150 char
|
||||
prop = prop.length > 150 ? prop.substr(prop.length - 149) : prop;
|
||||
const value = flat[prop];
|
||||
|
||||
if (typeof value === 'number') {
|
||||
measurements[prop] = value;
|
||||
|
||||
} else if (typeof value === 'boolean') {
|
||||
measurements[prop] = value ? 1 : 0;
|
||||
|
||||
} else if (typeof value === 'string') {
|
||||
//enforce property value to be less than 1024 char, take the first 1024 char
|
||||
properties[prop] = value.substring(0, 1023);
|
||||
|
||||
} else if (typeof value !== 'undefined' && value !== null) {
|
||||
properties[prop] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
properties,
|
||||
measurements
|
||||
};
|
||||
}
|
||||
|
||||
function flatten(obj: any, result: { [key: string]: any }, order: number = 0, prefix?: string): void {
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let item of Object.getOwnPropertyNames(obj)) {
|
||||
const value = obj[item];
|
||||
const index = prefix ? prefix + item : item;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
result[index] = safeStringify(value);
|
||||
|
||||
} else if (value instanceof Date) {
|
||||
// TODO unsure why this is here and not in _getData
|
||||
result[index] = value.toISOString();
|
||||
|
||||
} else if (isObject(value)) {
|
||||
if (order < 2) {
|
||||
flatten(value, result, order + 1, index + '.');
|
||||
} else {
|
||||
result[index] = safeStringify(value);
|
||||
}
|
||||
} else {
|
||||
result[index] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flattenKeys(value: Object | undefined): string[] {
|
||||
if (!value) {
|
||||
return [];
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as appInsights from 'applicationinsights';
|
||||
import { isObject } from 'vs/base/common/types';
|
||||
import { safeStringify, mixin } from 'vs/base/common/objects';
|
||||
import { ITelemetryAppender } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { ITelemetryAppender, validateTelemetryData } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
function getClient(aiKey: string): appInsights.TelemetryClient {
|
||||
@@ -35,13 +34,6 @@ function getClient(aiKey: string): appInsights.TelemetryClient {
|
||||
return client;
|
||||
}
|
||||
|
||||
interface Properties {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
interface Measurements {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
export class AppInsightsAppender implements ITelemetryAppender {
|
||||
|
||||
@@ -64,74 +56,12 @@ export class AppInsightsAppender implements ITelemetryAppender {
|
||||
}
|
||||
}
|
||||
|
||||
private static _getData(data?: any): { properties: Properties, measurements: Measurements } {
|
||||
|
||||
const properties: Properties = Object.create(null);
|
||||
const measurements: Measurements = Object.create(null);
|
||||
|
||||
const flat = Object.create(null);
|
||||
AppInsightsAppender._flaten(data, flat);
|
||||
|
||||
for (let prop in flat) {
|
||||
// enforce property names less than 150 char, take the last 150 char
|
||||
prop = prop.length > 150 ? prop.substr(prop.length - 149) : prop;
|
||||
const value = flat[prop];
|
||||
|
||||
if (typeof value === 'number') {
|
||||
measurements[prop] = value;
|
||||
|
||||
} else if (typeof value === 'boolean') {
|
||||
measurements[prop] = value ? 1 : 0;
|
||||
|
||||
} else if (typeof value === 'string') {
|
||||
//enforce property value to be less than 1024 char, take the first 1024 char
|
||||
properties[prop] = value.substring(0, 1023);
|
||||
|
||||
} else if (typeof value !== 'undefined' && value !== null) {
|
||||
properties[prop] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
properties,
|
||||
measurements
|
||||
};
|
||||
}
|
||||
|
||||
private static _flaten(obj: any, result: { [key: string]: any }, order: number = 0, prefix?: string): void {
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let item of Object.getOwnPropertyNames(obj)) {
|
||||
const value = obj[item];
|
||||
const index = prefix ? prefix + item : item;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
result[index] = safeStringify(value);
|
||||
|
||||
} else if (value instanceof Date) {
|
||||
// TODO unsure why this is here and not in _getData
|
||||
result[index] = value.toISOString();
|
||||
|
||||
} else if (isObject(value)) {
|
||||
if (order < 2) {
|
||||
AppInsightsAppender._flaten(value, result, order + 1, index + '.');
|
||||
} else {
|
||||
result[index] = safeStringify(value);
|
||||
}
|
||||
} else {
|
||||
result[index] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log(eventName: string, data?: any): void {
|
||||
if (!this._aiClient) {
|
||||
return;
|
||||
}
|
||||
data = mixin(data, this._defaultData);
|
||||
data = AppInsightsAppender._getData(data);
|
||||
data = validateTelemetryData(data);
|
||||
|
||||
if (this._logService) {
|
||||
this._logService.trace(`telemetry/${eventName}`, data);
|
||||
|
||||
@@ -8,34 +8,36 @@ import { readdirSync } from 'vs/base/node/pfs';
|
||||
import { statSync, readFileSync } from 'fs';
|
||||
import { join } from 'vs/base/common/path';
|
||||
|
||||
export function buildTelemetryMessage(appRoot: string, extensionsPath: string): string {
|
||||
// Gets all the directories inside the extension directory
|
||||
const dirs = readdirSync(extensionsPath).filter(files => {
|
||||
// This handles case where broken symbolic links can cause statSync to throw and error
|
||||
try {
|
||||
return statSync(join(extensionsPath, files)).isDirectory();
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
const telemetryJsonFolders: string[] = [];
|
||||
dirs.forEach((dir) => {
|
||||
const files = readdirSync(join(extensionsPath, dir)).filter(file => file === 'telemetry.json');
|
||||
// We know it contains a telemetry.json file so we add it to the list of folders which have one
|
||||
if (files.length === 1) {
|
||||
telemetryJsonFolders.push(dir);
|
||||
}
|
||||
});
|
||||
export function buildTelemetryMessage(appRoot: string, extensionsPath?: string): string {
|
||||
const mergedTelemetry = Object.create(null);
|
||||
// Simple function to merge the telemetry into one json object
|
||||
const mergeTelemetry = (contents: string, dirName: string) => {
|
||||
const telemetryData = JSON.parse(contents);
|
||||
mergedTelemetry[dirName] = telemetryData;
|
||||
};
|
||||
telemetryJsonFolders.forEach((folder) => {
|
||||
const contents = readFileSync(join(extensionsPath, folder, 'telemetry.json')).toString();
|
||||
mergeTelemetry(contents, folder);
|
||||
});
|
||||
if (extensionsPath) {
|
||||
// Gets all the directories inside the extension directory
|
||||
const dirs = readdirSync(extensionsPath).filter(files => {
|
||||
// This handles case where broken symbolic links can cause statSync to throw and error
|
||||
try {
|
||||
return statSync(join(extensionsPath, files)).isDirectory();
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
const telemetryJsonFolders: string[] = [];
|
||||
dirs.forEach((dir) => {
|
||||
const files = readdirSync(join(extensionsPath, dir)).filter(file => file === 'telemetry.json');
|
||||
// We know it contains a telemetry.json file so we add it to the list of folders which have one
|
||||
if (files.length === 1) {
|
||||
telemetryJsonFolders.push(dir);
|
||||
}
|
||||
});
|
||||
telemetryJsonFolders.forEach((folder) => {
|
||||
const contents = readFileSync(join(extensionsPath, folder, 'telemetry.json')).toString();
|
||||
mergeTelemetry(contents, folder);
|
||||
});
|
||||
}
|
||||
let contents = readFileSync(join(appRoot, 'telemetry-core.json')).toString();
|
||||
mergeTelemetry(contents, 'vscode-core');
|
||||
contents = readFileSync(join(appRoot, 'telemetry-extensions.json')).toString();
|
||||
|
||||
@@ -273,8 +273,8 @@ export const editorErrorBorder = registerColor('editorError.border', { dark: nul
|
||||
export const editorWarningForeground = registerColor('editorWarning.foreground', { dark: '#CCA700', light: '#E9A700', hc: null }, nls.localize('editorWarning.foreground', 'Foreground color of warning squigglies in the editor.'));
|
||||
export const editorWarningBorder = registerColor('editorWarning.border', { dark: null, light: null, hc: Color.fromHex('#FFCC00').transparent(0.8) }, nls.localize('warningBorder', 'Border color of warning boxes in the editor.'));
|
||||
|
||||
export const editorInfoForeground = registerColor('editorInfo.foreground', { dark: '#008000', light: '#008000', hc: null }, nls.localize('editorInfo.foreground', 'Foreground color of info squigglies in the editor.'));
|
||||
export const editorInfoBorder = registerColor('editorInfo.border', { dark: null, light: null, hc: Color.fromHex('#71B771').transparent(0.8) }, nls.localize('infoBorder', 'Border color of info boxes in the editor.'));
|
||||
export const editorInfoForeground = registerColor('editorInfo.foreground', { dark: '#75BEFF', light: '#75BEFF', hc: null }, nls.localize('editorInfo.foreground', 'Foreground color of info squigglies in the editor.'));
|
||||
export const editorInfoBorder = registerColor('editorInfo.border', { dark: null, light: null, hc: Color.fromHex('#75BEFF').transparent(0.8) }, nls.localize('infoBorder', 'Border color of info boxes in the editor.'));
|
||||
|
||||
export const editorHintForeground = registerColor('editorHint.foreground', { dark: Color.fromHex('#eeeeee').transparent(0.7), light: '#6c6c6c', hc: null }, nls.localize('editorHint.foreground', 'Foreground color of hint squigglies in the editor.'));
|
||||
export const editorHintBorder = registerColor('editorHint.border', { dark: null, light: null, hc: Color.fromHex('#eeeeee').transparent(0.8) }, nls.localize('hintBorder', 'Border color of hint boxes in the editor.'));
|
||||
|
||||
@@ -18,6 +18,10 @@ export function createUpdateURL(platform: string, quality: string): string {
|
||||
return `${product.updateUrl}/api/update/${platform}/${quality}/${product.commit}`;
|
||||
}
|
||||
|
||||
export type UpdateNotAvailableClassification = {
|
||||
explicit: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
|
||||
};
|
||||
|
||||
export abstract class AbstractUpdateService implements IUpdateService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
@@ -13,7 +13,7 @@ import { State, IUpdate, StateType, UpdateType } from 'vs/platform/update/common
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { AbstractUpdateService, createUpdateURL } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
import { AbstractUpdateService, createUpdateURL, UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
import { IRequestService } from 'vs/platform/request/common/request';
|
||||
|
||||
export class DarwinUpdateService extends AbstractUpdateService {
|
||||
@@ -81,12 +81,10 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
||||
return;
|
||||
}
|
||||
|
||||
/* __GDPR__
|
||||
"update:downloaded" : {
|
||||
"version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('update:downloaded', { version: update.version });
|
||||
type UpdateDownloadedClassification = {
|
||||
version: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
};
|
||||
this.telemetryService.publicLog2<{ version: String }, UpdateDownloadedClassification>('update:downloaded', { version: update.version });
|
||||
|
||||
this.setState(State.Ready(update));
|
||||
}
|
||||
@@ -95,13 +93,7 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
||||
if (this.state.type !== StateType.CheckingForUpdates) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* __GDPR__
|
||||
"update:notAvailable" : {
|
||||
"explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('update:notAvailable', { explicit: !!this.state.context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!this.state.context });
|
||||
|
||||
this.setState(State.Idle(UpdateType.Archive));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { State, IUpdate, AvailableForDownload, UpdateType } from 'vs/platform/up
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { createUpdateURL, AbstractUpdateService } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
import { createUpdateURL, AbstractUpdateService, UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
import { IRequestService, asJson } from 'vs/platform/request/common/request';
|
||||
import { shell } from 'electron';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
@@ -40,17 +40,11 @@ export class LinuxUpdateService extends AbstractUpdateService {
|
||||
}
|
||||
|
||||
this.setState(State.CheckingForUpdates(context));
|
||||
|
||||
this.requestService.request({ url: this.url }, CancellationToken.None)
|
||||
.then<IUpdate>(asJson)
|
||||
.then(update => {
|
||||
if (!update || !update.url || !update.version || !update.productVersion) {
|
||||
/* __GDPR__
|
||||
"update:notAvailable" : {
|
||||
"explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('update:notAvailable', { explicit: !!context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!context });
|
||||
|
||||
this.setState(State.Idle(UpdateType.Archive));
|
||||
} else {
|
||||
@@ -59,14 +53,7 @@ export class LinuxUpdateService extends AbstractUpdateService {
|
||||
})
|
||||
.then(undefined, err => {
|
||||
this.logService.error(err);
|
||||
|
||||
/* __GDPR__
|
||||
"update:notAvailable" : {
|
||||
"explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('update:notAvailable', { explicit: !!context });
|
||||
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!context });
|
||||
// only show message when explicitly checking for updates
|
||||
const message: string | undefined = !!context ? (err.message || err) : undefined;
|
||||
this.setState(State.Idle(UpdateType.Archive, message));
|
||||
|
||||
@@ -13,6 +13,7 @@ import * as path from 'vs/base/common/path';
|
||||
import { realpath, watch } from 'fs';
|
||||
import { spawn } from 'child_process';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
|
||||
abstract class AbstractUpdateService2 implements IUpdateService {
|
||||
|
||||
@@ -159,29 +160,17 @@ export class SnapUpdateService extends AbstractUpdateService2 {
|
||||
|
||||
protected doCheckForUpdates(context: any): void {
|
||||
this.setState(State.CheckingForUpdates(context));
|
||||
|
||||
this.isUpdateAvailable().then(result => {
|
||||
if (result) {
|
||||
this.setState(State.Ready({ version: 'something', productVersion: 'something' }));
|
||||
} else {
|
||||
/* __GDPR__
|
||||
"update:notAvailable" : {
|
||||
"explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('update:notAvailable', { explicit: !!context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!context });
|
||||
|
||||
this.setState(State.Idle(UpdateType.Snap));
|
||||
}
|
||||
}, err => {
|
||||
this.logService.error(err);
|
||||
|
||||
/* __GDPR__
|
||||
"update:notAvailable" : {
|
||||
"explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('update:notAvailable', { explicit: !!context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!context });
|
||||
this.setState(State.Idle(UpdateType.Snap, err.message || err));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { State, IUpdate, StateType, AvailableForDownload, UpdateType } from 'vs/
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { createUpdateURL, AbstractUpdateService } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
import { createUpdateURL, AbstractUpdateService, UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
import { IRequestService, asJson } from 'vs/platform/request/common/request';
|
||||
import { checksum } from 'vs/base/node/crypto';
|
||||
import { tmpdir } from 'os';
|
||||
@@ -169,12 +169,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
})
|
||||
.then(undefined, err => {
|
||||
this.logService.error(err);
|
||||
/* __GDPR__
|
||||
"update:notAvailable" : {
|
||||
"explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('update:notAvailable', { explicit: !!context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!context });
|
||||
|
||||
// only show message when explicitly checking for updates
|
||||
const message: string | undefined = !!context ? (err.message || err) : undefined;
|
||||
|
||||
@@ -183,6 +183,7 @@ export interface IOpenSettings {
|
||||
forceReuseWindow?: boolean;
|
||||
diffMode?: boolean;
|
||||
addMode?: boolean;
|
||||
gotoLineMode?: boolean;
|
||||
noRecentEntry?: boolean;
|
||||
waitMarkerFileURI?: URI;
|
||||
args?: ParsedArgs;
|
||||
|
||||
@@ -132,6 +132,7 @@ export interface IOpenConfiguration {
|
||||
readonly forceEmpty?: boolean;
|
||||
readonly diffMode?: boolean;
|
||||
addMode?: boolean;
|
||||
readonly gotoLineMode?: boolean;
|
||||
readonly initialStartup?: boolean;
|
||||
readonly noRecentEntry?: boolean;
|
||||
}
|
||||
|
||||
@@ -295,6 +295,7 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
|
||||
forceReuseWindow: options.forceReuseWindow,
|
||||
diffMode: options.diffMode,
|
||||
addMode: options.addMode,
|
||||
gotoLineMode: options.gotoLineMode,
|
||||
noRecentEntry: options.noRecentEntry,
|
||||
waitMarkerFileURI: options.waitMarkerFileURI
|
||||
});
|
||||
@@ -461,10 +462,10 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
|
||||
}
|
||||
|
||||
private openFileForURI(uri: IURIToOpen): void {
|
||||
const cli = assign(Object.create(null), this.environmentService.args, { goto: true });
|
||||
const cli = assign(Object.create(null), this.environmentService.args);
|
||||
const urisToOpen = [uri];
|
||||
|
||||
this.windowsMainService.open({ context: OpenContext.API, cli, urisToOpen });
|
||||
this.windowsMainService.open({ context: OpenContext.API, cli, urisToOpen, gotoLineMode: true });
|
||||
}
|
||||
|
||||
async resolveProxy(windowId: number, url: string): Promise<string | undefined> {
|
||||
|
||||
Vendored
-48
@@ -713,54 +713,6 @@ declare module 'vscode' {
|
||||
|
||||
//#endregion
|
||||
|
||||
/**
|
||||
* Comment Reactions
|
||||
* Stay in proposed.
|
||||
*/
|
||||
interface CommentReaction {
|
||||
readonly hasReacted?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stay in proposed
|
||||
*/
|
||||
export interface CommentReactionProvider {
|
||||
availableReactions: CommentReaction[];
|
||||
toggleReaction?(document: TextDocument, comment: Comment, reaction: CommentReaction): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
export interface CommentController {
|
||||
/**
|
||||
* Optional reaction provider
|
||||
* Stay in proposed.
|
||||
*/
|
||||
reactionProvider?: CommentReactionProvider;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A comment is displayed within the editor or the Comments Panel, depending on how it is provided.
|
||||
*/
|
||||
export interface Comment {
|
||||
/**
|
||||
* The id of the comment
|
||||
*/
|
||||
commentId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A comment controller is able to provide [comments](#CommentThread) support to the editor and
|
||||
* provide users various ways to interact with comments.
|
||||
*/
|
||||
export interface CommentController {
|
||||
/**
|
||||
* Optional reaction provider
|
||||
*/
|
||||
reactionProvider?: CommentReactionProvider;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Terminal
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as modes from 'vs/editor/common/modes';
|
||||
import { MainContext, MainThreadEditorInsetsShape, IExtHostContext, ExtHostEditorInsetsShape, ExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { extHostNamedCustomer } from '../common/extHostCustomers';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { IWebviewService, Webview } from 'vs/workbench/contrib/webview/common/webview';
|
||||
import { IWebviewService, WebviewElement } from 'vs/workbench/contrib/webview/common/webview';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IActiveCodeEditor, IViewZone } from 'vs/editor/browser/editorBrowser';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
@@ -33,7 +33,7 @@ class EditorWebviewZone implements IViewZone {
|
||||
readonly editor: IActiveCodeEditor,
|
||||
readonly line: number,
|
||||
readonly height: number,
|
||||
readonly webview: Webview,
|
||||
readonly webview: WebviewElement,
|
||||
) {
|
||||
this.domNode = document.createElement('div');
|
||||
this.domNode.style.zIndex = '10'; // without this, the webview is not interactive
|
||||
@@ -124,12 +124,11 @@ export class MainThreadEditorInsets implements MainThreadEditorInsetsShape {
|
||||
$setHtml(handle: number, value: string): void {
|
||||
const inset = this.getInset(handle);
|
||||
inset.webview.html = value;
|
||||
|
||||
}
|
||||
|
||||
$setOptions(handle: number, options: modes.IWebviewOptions): void {
|
||||
const inset = this.getInset(handle);
|
||||
inset.webview.options = options;
|
||||
inset.webview.contentOptions = options;
|
||||
}
|
||||
|
||||
async $postMessage(handle: number, value: any): Promise<boolean> {
|
||||
|
||||
@@ -308,10 +308,6 @@ export class MainThreadCommentController {
|
||||
return commentingRanges || [];
|
||||
}
|
||||
|
||||
getReactionGroup(): modes.CommentReaction[] | undefined {
|
||||
return this._features.reactionGroup;
|
||||
}
|
||||
|
||||
async toggleReaction(uri: URI, thread: modes.CommentThread, comment: modes.Comment, reaction: modes.CommentReaction, token: CancellationToken): Promise<void> {
|
||||
return this._proxy.$toggleReaction(this._handle, thread.commentThreadHandle, uri, comment, reaction);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
|
||||
import { IRemoteConsoleLog, log, parse } from 'vs/base/common/console';
|
||||
import { parseExtensionDevOptions } from 'vs/workbench/services/extensions/common/extensionDevOptions';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { IExtensionHostDebugService } from 'vs/workbench/services/extensions/common/extensionHostDebug';
|
||||
import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug';
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadConsole)
|
||||
export class MainThreadConsole implements MainThreadConsoleShape {
|
||||
|
||||
@@ -12,11 +12,12 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { localize } from 'vs/nls';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { EnablementState } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, EnablementState } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IExtensionsWorkbenchService, IExtension } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadExtensionService)
|
||||
export class MainThreadExtensionService implements MainThreadExtensionServiceShape {
|
||||
@@ -25,18 +26,21 @@ export class MainThreadExtensionService implements MainThreadExtensionServiceSha
|
||||
private readonly _notificationService: INotificationService;
|
||||
private readonly _extensionsWorkbenchService: IExtensionsWorkbenchService;
|
||||
private readonly _windowService: IWindowService;
|
||||
private readonly _extensionEnablementService: IExtensionEnablementService;
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@INotificationService notificationService: INotificationService,
|
||||
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IWindowService windowService: IWindowService
|
||||
@IWindowService windowService: IWindowService,
|
||||
@IExtensionEnablementService extensionEnablementService: IExtensionEnablementService
|
||||
) {
|
||||
this._extensionService = extensionService;
|
||||
this._notificationService = notificationService;
|
||||
this._extensionsWorkbenchService = extensionsWorkbenchService;
|
||||
this._windowService = windowService;
|
||||
this._extensionEnablementService = extensionEnablementService;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
@@ -74,30 +78,31 @@ export class MainThreadExtensionService implements MainThreadExtensionServiceSha
|
||||
const local = await this._extensionsWorkbenchService.queryLocal();
|
||||
const installedDependency = local.filter(i => areSameExtensions(i.identifier, { id: missingDependency }))[0];
|
||||
if (installedDependency) {
|
||||
await this._handleMissingInstalledDependency(extension, installedDependency);
|
||||
await this._handleMissingInstalledDependency(extension, installedDependency.local!);
|
||||
} else {
|
||||
await this._handleMissingNotInstalledDependency(extension, missingDependency);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async _handleMissingInstalledDependency(extension: IExtensionDescription, missingInstalledDependency: IExtension): Promise<void> {
|
||||
private async _handleMissingInstalledDependency(extension: IExtensionDescription, missingInstalledDependency: ILocalExtension): Promise<void> {
|
||||
const extName = extension.displayName || extension.name;
|
||||
if (missingInstalledDependency.enablementState === EnablementState.Enabled || missingInstalledDependency.enablementState === EnablementState.WorkspaceEnabled) {
|
||||
if (this._extensionEnablementService.isEnabled(missingInstalledDependency)) {
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: localize('reload window', "Cannot activate the '{0}' extension because it depends on the '{1}' extension, which is not loaded. Would you like to reload the window to load the extension?", extName, missingInstalledDependency.displayName),
|
||||
message: localize('reload window', "Cannot activate the '{0}' extension because it depends on the '{1}' extension, which is not loaded. Would you like to reload the window to load the extension?", extName, missingInstalledDependency.manifest.displayName || missingInstalledDependency.manifest.name),
|
||||
actions: {
|
||||
primary: [new Action('reload', localize('reload', "Reload Window"), '', true, () => this._windowService.reloadWindow())]
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const enablementState = this._extensionEnablementService.getEnablementState(missingInstalledDependency);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: localize('disabledDep', "Cannot activate the '{0}' extension because it depends on the '{1}' extension, which is disabled. Would you like to enable the extension and reload the window?", extName, missingInstalledDependency.displayName),
|
||||
message: localize('disabledDep', "Cannot activate the '{0}' extension because it depends on the '{1}' extension, which is disabled. Would you like to enable the extension and reload the window?", extName, missingInstalledDependency.manifest.displayName || missingInstalledDependency.manifest.name),
|
||||
actions: {
|
||||
primary: [new Action('enable', localize('enable dep', "Enable and Reload"), '', true,
|
||||
() => this._extensionsWorkbenchService.setEnablement([missingInstalledDependency], missingInstalledDependency.enablementState === EnablementState.Disabled ? EnablementState.Enabled : EnablementState.WorkspaceEnabled)
|
||||
() => this._extensionEnablementService.setEnablement([missingInstalledDependency], enablementState === EnablementState.DisabledGlobally ? EnablementState.EnabledGlobally : EnablementState.EnabledWorkspace)
|
||||
.then(() => this._windowService.reloadWindow(), e => this._notificationService.error(e)))]
|
||||
}
|
||||
});
|
||||
|
||||
@@ -14,7 +14,6 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ExtHostContext, ExtHostWebviewsShape, IExtHostContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelShowOptions } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { editorGroupToViewColumn, EditorViewColumn, viewColumnToEditorGroup } from 'vs/workbench/api/common/shared/editor';
|
||||
import { WebviewEditor } from 'vs/workbench/contrib/webview/browser/webviewEditor';
|
||||
import { WebviewEditorInput } from 'vs/workbench/contrib/webview/browser/webviewEditorInput';
|
||||
import { ICreateWebViewShowOptions, IWebviewEditorService, WebviewInputOptions } from 'vs/workbench/contrib/webview/browser/webviewEditorService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
@@ -22,8 +21,9 @@ import { ACTIVE_GROUP, IEditorService } from 'vs/workbench/services/editor/commo
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { extHostNamedCustomer } from '../common/extHostCustomers';
|
||||
import { IProductService } from 'vs/platform/product/common/product';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
|
||||
interface MainThreadWebviewState {
|
||||
interface OldMainThreadWebviewState {
|
||||
readonly viewType: string;
|
||||
state: any;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
|
||||
|
||||
private readonly _proxy: ExtHostWebviewsShape;
|
||||
private readonly _webviews = new Map<WebviewPanelHandle, WebviewEditorInput<MainThreadWebviewState>>();
|
||||
private readonly _webviews = new Map<WebviewPanelHandle, WebviewEditorInput>();
|
||||
private readonly _revivers = new Map<string, IDisposable>();
|
||||
|
||||
private _activeWebview: WebviewPanelHandle | undefined = undefined;
|
||||
@@ -67,8 +67,12 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
// This reviver's only job is to activate webview extensions
|
||||
// This should trigger the real reviver to be registered from the extension host side.
|
||||
this._register(_webviewEditorService.registerReviver({
|
||||
canRevive: (webview: WebviewEditorInput<any>) => {
|
||||
const viewType = webview.state && webview.state.viewType;
|
||||
canRevive: (webview: WebviewEditorInput) => {
|
||||
if (!webview.webview.state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const viewType = this.fromInternalWebviewViewType(webview.viewType);
|
||||
if (typeof viewType === 'string') {
|
||||
extensionService.activateByEvent(`onWebviewPanel:${viewType}`);
|
||||
}
|
||||
@@ -96,11 +100,8 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
const webview = this._webviewEditorService.createWebview(handle, this.getInternalWebviewViewType(viewType), title, mainThreadShowOptions, reviveWebviewOptions(options), {
|
||||
location: URI.revive(extensionLocation),
|
||||
id: extensionId
|
||||
}, this.createWebviewEventDelegate(handle)) as WebviewEditorInput<MainThreadWebviewState>;
|
||||
webview.state = {
|
||||
viewType: viewType,
|
||||
state: undefined
|
||||
};
|
||||
});
|
||||
this.hookupWebviewEventDelegate(handle, webview);
|
||||
|
||||
this._webviews.set(handle, webview);
|
||||
|
||||
@@ -129,12 +130,12 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
|
||||
public $setHtml(handle: WebviewPanelHandle, value: string): void {
|
||||
const webview = this.getWebview(handle);
|
||||
webview.html = value;
|
||||
webview.webview.html = value;
|
||||
}
|
||||
|
||||
public $setOptions(handle: WebviewPanelHandle, options: modes.IWebviewOptions): void {
|
||||
const webview = this.getWebview(handle);
|
||||
webview.setOptions(reviveWebviewOptions(options as any /*todo@mat */));
|
||||
webview.webview.contentOptions = reviveWebviewOptions(options as any /*todo@mat */);
|
||||
}
|
||||
|
||||
public $reveal(handle: WebviewPanelHandle, showOptions: WebviewPanelShowOptions): void {
|
||||
@@ -151,22 +152,8 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
|
||||
public async $postMessage(handle: WebviewPanelHandle, message: any): Promise<boolean> {
|
||||
const webview = this.getWebview(handle);
|
||||
const editors = this._editorService.visibleControls
|
||||
.filter(e => e instanceof WebviewEditor)
|
||||
.map(e => e as WebviewEditor)
|
||||
.filter(e => e.input!.matches(webview));
|
||||
|
||||
if (editors.length > 0) {
|
||||
editors[0].sendMessage(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (webview.webview) {
|
||||
webview.webview.sendMessage(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
webview.webview.sendMessage(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
public $registerSerializer(viewType: string): void {
|
||||
@@ -175,28 +162,42 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
}
|
||||
|
||||
this._revivers.set(viewType, this._webviewEditorService.registerReviver({
|
||||
canRevive: (webview) => {
|
||||
return webview.state && webview.state.viewType === viewType;
|
||||
canRevive: (webviewEditorInput) => {
|
||||
return !!webviewEditorInput.webview.state && webviewEditorInput.viewType === this.getInternalWebviewViewType(viewType);
|
||||
},
|
||||
reviveWebview: async (webview): Promise<void> => {
|
||||
const viewType = webview.state.viewType;
|
||||
const handle = 'revival-' + MainThreadWebviews.revivalPool++;
|
||||
this._webviews.set(handle, webview);
|
||||
webview._events = this.createWebviewEventDelegate(handle);
|
||||
reviveWebview: async (webviewEditorInput): Promise<void> => {
|
||||
const viewType = this.fromInternalWebviewViewType(webviewEditorInput.viewType);
|
||||
if (!viewType) {
|
||||
webviewEditorInput.webview.html = MainThreadWebviews.getDeserializationFailedContents(webviewEditorInput.viewType);
|
||||
return;
|
||||
}
|
||||
|
||||
const handle = `revival-${MainThreadWebviews.revivalPool++}`;
|
||||
this._webviews.set(handle, webviewEditorInput);
|
||||
this.hookupWebviewEventDelegate(handle, webviewEditorInput);
|
||||
let state = undefined;
|
||||
if (webview.state.state) {
|
||||
if (webviewEditorInput.webview.state) {
|
||||
try {
|
||||
state = JSON.parse(webview.state.state);
|
||||
// Check for old-style webview state first which stored state inside another state object
|
||||
// TODO: remove this after 1.37 ships.
|
||||
if (
|
||||
typeof (webviewEditorInput.webview.state as unknown as OldMainThreadWebviewState).viewType === 'string' &&
|
||||
'state' in (webviewEditorInput.webview.state as unknown as OldMainThreadWebviewState)
|
||||
) {
|
||||
state = JSON.parse((webviewEditorInput.webview.state as any).state);
|
||||
} else {
|
||||
state = JSON.parse(webviewEditorInput.webview.state);
|
||||
}
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await this._proxy.$deserializeWebviewPanel(handle, viewType, webview.getTitle(), state, editorGroupToViewColumn(this._editorGroupService, webview.group || 0), webview.options);
|
||||
await this._proxy.$deserializeWebviewPanel(handle, viewType, webviewEditorInput.getTitle(), state, editorGroupToViewColumn(this._editorGroupService, webviewEditorInput.group || 0), webviewEditorInput.webview.options);
|
||||
} catch (error) {
|
||||
onUnexpectedError(error);
|
||||
webview.html = MainThreadWebviews.getDeserializationFailedContents(viewType);
|
||||
webviewEditorInput.webview.html = MainThreadWebviews.getDeserializationFailedContents(viewType);
|
||||
}
|
||||
}
|
||||
}));
|
||||
@@ -216,23 +217,28 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
return `mainThreadWebview-${viewType}`;
|
||||
}
|
||||
|
||||
private createWebviewEventDelegate(handle: WebviewPanelHandle) {
|
||||
return {
|
||||
onDidClickLink: (uri: URI) => this.onDidClickLink(handle, uri),
|
||||
onMessage: (message: any) => this._proxy.$onMessage(handle, message),
|
||||
onDispose: () => {
|
||||
this._proxy.$onDidDisposeWebviewPanel(handle).finally(() => {
|
||||
this._webviews.delete(handle);
|
||||
});
|
||||
},
|
||||
onDidUpdateWebviewState: (newState: any) => {
|
||||
const webview = this.tryGetWebview(handle);
|
||||
if (!webview || webview.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
(webview as WebviewEditorInput<MainThreadWebviewState>).state.state = newState;
|
||||
private fromInternalWebviewViewType(viewType: string): string | undefined {
|
||||
if (!startsWith(viewType, 'mainThreadWebview-')) {
|
||||
return undefined;
|
||||
}
|
||||
return viewType.replace(/^mainThreadWebview-/, '');
|
||||
}
|
||||
|
||||
private hookupWebviewEventDelegate(handle: WebviewPanelHandle, input: WebviewEditorInput) {
|
||||
input.webview.onDidClickLink((uri: URI) => this.onDidClickLink(handle, uri));
|
||||
input.webview.onMessage((message: any) => this._proxy.$onMessage(handle, message));
|
||||
input.onDispose(() => {
|
||||
this._proxy.$onDidDisposeWebviewPanel(handle).finally(() => {
|
||||
this._webviews.delete(handle);
|
||||
});
|
||||
});
|
||||
input.webview.onDidUpdateState((newState: any) => {
|
||||
const webview = this.tryGetWebview(handle);
|
||||
if (!webview || webview.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
webview.webview.state = newState;
|
||||
});
|
||||
}
|
||||
|
||||
private onActiveEditorChanged() {
|
||||
@@ -319,7 +325,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
if (this._productService.urlProtocol === link.scheme) {
|
||||
return true;
|
||||
}
|
||||
return !!webview.options.enableCommandUris && link.scheme === 'command';
|
||||
return !!webview.webview.contentOptions.enableCommandUris && link.scheme === 'command';
|
||||
}
|
||||
|
||||
private getWebview(handle: WebviewPanelHandle): WebviewEditorInput {
|
||||
@@ -347,13 +353,15 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
}
|
||||
}
|
||||
|
||||
function reviveWebviewOptions(options: WebviewInputOptions): WebviewInputOptions {
|
||||
function reviveWebviewOptions(options: modes.IWebviewOptions): WebviewInputOptions {
|
||||
return {
|
||||
...options,
|
||||
allowScripts: options.enableScripts,
|
||||
localResourceRoots: Array.isArray(options.localResourceRoots) ? options.localResourceRoots.map(r => URI.revive(r)) : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function reviveWebviewIcon(
|
||||
value: { light: UriComponents, dark: UriComponents } | undefined
|
||||
): { light: URI, dark: URI } | undefined {
|
||||
|
||||
@@ -1287,7 +1287,6 @@ export interface ExtHostCommentsShape {
|
||||
$updateCommentThreadTemplate(commentControllerHandle: number, threadHandle: number, range: IRange): Promise<void>;
|
||||
$deleteCommentThread(commentControllerHandle: number, commentThreadHandle: number): void;
|
||||
$provideCommentingRanges(commentControllerHandle: number, uriComponents: UriComponents, token: CancellationToken): Promise<IRange[] | undefined>;
|
||||
$provideReactionGroup(commentControllerHandle: number): Promise<modes.CommentReaction[] | undefined>;
|
||||
$toggleReaction(commentControllerHandle: number, threadHandle: number, uri: UriComponents, comment: modes.Comment, reaction: modes.CommentReaction): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,47 +187,28 @@ export class ExtHostComments implements ExtHostCommentsShape, IDisposable {
|
||||
}).then(ranges => ranges ? ranges.map(x => extHostTypeConverter.Range.from(x)) : undefined);
|
||||
}
|
||||
|
||||
$provideReactionGroup(commentControllerHandle: number): Promise<modes.CommentReaction[] | undefined> {
|
||||
const commentController = this._commentControllers.get(commentControllerHandle);
|
||||
|
||||
if (!commentController || !commentController.reactionProvider) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
return asPromise(() => {
|
||||
return commentController!.reactionProvider!.availableReactions;
|
||||
}).then(reactions => reactions.map(reaction => convertToReaction(commentController.reactionProvider, reaction)));
|
||||
}
|
||||
|
||||
$toggleReaction(commentControllerHandle: number, threadHandle: number, uri: UriComponents, comment: modes.Comment, reaction: modes.CommentReaction): Promise<void> {
|
||||
const document = this._documents.getDocument(URI.revive(uri));
|
||||
const commentController = this._commentControllers.get(commentControllerHandle);
|
||||
|
||||
if (!commentController || !((commentController.reactionProvider && commentController.reactionProvider.toggleReaction) || commentController.reactionHandler)) {
|
||||
if (!commentController || !commentController.reactionHandler) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
return asPromise(() => {
|
||||
const commentThread = commentController.getCommentThread(threadHandle);
|
||||
if (commentThread) {
|
||||
const vscodeComment = commentThread.getComment(comment.commentId);
|
||||
const vscodeComment = commentThread.getCommentByUniqueId(comment.uniqueIdInThread);
|
||||
|
||||
if (commentController !== undefined && vscodeComment) {
|
||||
if (commentController.reactionHandler) {
|
||||
return commentController.reactionHandler(vscodeComment, convertFromReaction(reaction));
|
||||
}
|
||||
|
||||
if (commentController.reactionProvider && commentController.reactionProvider.toggleReaction) {
|
||||
return commentController.reactionProvider.toggleReaction(document, vscodeComment, convertFromReaction(reaction));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
dispose() {
|
||||
|
||||
}
|
||||
@@ -391,16 +372,6 @@ export class ExtHostCommentThread implements vscode.CommentThread {
|
||||
);
|
||||
}
|
||||
|
||||
getComment(commentId: string): vscode.Comment | undefined {
|
||||
const comments = this._comments.filter(comment => comment.commentId === commentId);
|
||||
|
||||
if (comments && comments.length) {
|
||||
return comments[0];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
getCommentByUniqueId(uniqueId: number): vscode.Comment | undefined {
|
||||
for (let key of this._commentsMap) {
|
||||
let comment = key[0];
|
||||
@@ -442,19 +413,6 @@ class ExtHostCommentController implements vscode.CommentController {
|
||||
private _threads: Map<number, ExtHostCommentThread> = new Map<number, ExtHostCommentThread>();
|
||||
commentingRangeProvider?: vscode.CommentingRangeProvider;
|
||||
|
||||
private _commentReactionProvider?: vscode.CommentReactionProvider;
|
||||
|
||||
get reactionProvider(): vscode.CommentReactionProvider | undefined {
|
||||
return this._commentReactionProvider;
|
||||
}
|
||||
|
||||
set reactionProvider(provider: vscode.CommentReactionProvider | undefined) {
|
||||
this._commentReactionProvider = provider;
|
||||
if (provider) {
|
||||
this._proxy.$updateCommentControllerFeatures(this.handle, { reactionGroup: provider.availableReactions.map(reaction => convertToReaction(provider, reaction)) });
|
||||
}
|
||||
}
|
||||
|
||||
private _reactionHandler?: ReactionHandler;
|
||||
|
||||
get reactionHandler(): ReactionHandler | undefined {
|
||||
@@ -537,7 +495,6 @@ function convertToModeComment(thread: ExtHostCommentThread, commentController: E
|
||||
const iconPath = vscodeComment.author && vscodeComment.author.iconPath ? vscodeComment.author.iconPath.toString() : undefined;
|
||||
|
||||
return {
|
||||
commentId: vscodeComment.commentId,
|
||||
mode: vscodeComment.mode,
|
||||
contextValue: vscodeComment.contextValue,
|
||||
uniqueIdInThread: commentUniqueId,
|
||||
@@ -545,17 +502,16 @@ function convertToModeComment(thread: ExtHostCommentThread, commentController: E
|
||||
userName: vscodeComment.author.name,
|
||||
userIconPath: iconPath,
|
||||
label: vscodeComment.label,
|
||||
commentReactions: vscodeComment.reactions ? vscodeComment.reactions.map(reaction => convertToReaction(commentController.reactionProvider, reaction)) : undefined
|
||||
commentReactions: vscodeComment.reactions ? vscodeComment.reactions.map(reaction => convertToReaction(reaction)) : undefined
|
||||
};
|
||||
}
|
||||
|
||||
function convertToReaction(provider: vscode.CommentReactionProvider | undefined, reaction: vscode.CommentReaction): modes.CommentReaction {
|
||||
function convertToReaction(reaction: vscode.CommentReaction): modes.CommentReaction {
|
||||
return {
|
||||
label: reaction.label,
|
||||
iconPath: reaction.iconPath ? extHostTypeConverter.pathOrURIToURI(reaction.iconPath) : undefined,
|
||||
count: reaction.count,
|
||||
hasReacted: reaction.hasReacted,
|
||||
canEdit: provider !== undefined ? !!provider.toggleReaction : false
|
||||
hasReacted: reaction.authorHasReacted,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -564,7 +520,6 @@ function convertFromReaction(reaction: modes.CommentReaction): vscode.CommentRea
|
||||
label: reaction.label || '',
|
||||
count: reaction.count || 0,
|
||||
iconPath: reaction.iconPath ? URI.revive(reaction.iconPath) : '',
|
||||
hasReacted: reaction.hasReacted,
|
||||
authorHasReacted: reaction.hasReacted || false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ export interface OpenCommandPipeArgs {
|
||||
forceNewWindow?: boolean;
|
||||
diffMode?: boolean;
|
||||
addMode?: boolean;
|
||||
gotoLineMode?: boolean;
|
||||
forceReuseWindow?: boolean;
|
||||
waitMarkerFilePath?: string;
|
||||
}
|
||||
@@ -93,7 +94,7 @@ export class CLIServer {
|
||||
}
|
||||
|
||||
private open(data: OpenCommandPipeArgs, res: http.ServerResponse) {
|
||||
let { fileURIs, folderURIs, forceNewWindow, diffMode, addMode, forceReuseWindow, waitMarkerFilePath } = data;
|
||||
let { fileURIs, folderURIs, forceNewWindow, diffMode, addMode, forceReuseWindow, gotoLineMode, waitMarkerFilePath } = data;
|
||||
const urisToOpen: IURIToOpen[] = [];
|
||||
if (Array.isArray(folderURIs)) {
|
||||
for (const s of folderURIs) {
|
||||
@@ -125,7 +126,7 @@ export class CLIServer {
|
||||
}
|
||||
if (urisToOpen.length) {
|
||||
const waitMarkerFileURI = waitMarkerFilePath ? URI.file(waitMarkerFilePath) : undefined;
|
||||
const windowOpenArgs: IOpenSettings = { forceNewWindow, diffMode, addMode, forceReuseWindow, waitMarkerFileURI };
|
||||
const windowOpenArgs: IOpenSettings = { forceNewWindow, diffMode, addMode, gotoLineMode, forceReuseWindow, waitMarkerFileURI };
|
||||
this._commands.executeCommand('_files.windowOpen', urisToOpen, windowOpenArgs);
|
||||
}
|
||||
res.writeHead(200);
|
||||
|
||||
@@ -231,23 +231,19 @@ export class OpenNodeModuleFactory implements INodeModuleFactory {
|
||||
if (!this._extensionId) {
|
||||
return;
|
||||
}
|
||||
/* __GDPR__
|
||||
"shimming.open" : {
|
||||
"extension": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this._mainThreadTelemerty.$publicLog('shimming.open', { extension: this._extensionId });
|
||||
type ShimmingOpenClassification = {
|
||||
extension: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
};
|
||||
this._mainThreadTelemerty.$publicLog2<{ extension: string }, ShimmingOpenClassification>('shimming.open', { extension: this._extensionId });
|
||||
}
|
||||
|
||||
private sendNoForwardTelemetry(): void {
|
||||
if (!this._extensionId) {
|
||||
return;
|
||||
}
|
||||
/* __GDPR__
|
||||
"shimming.open.call.noForward" : {
|
||||
"extension": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this._mainThreadTelemerty.$publicLog('shimming.open.call.noForward', { extension: this._extensionId });
|
||||
type ShimmingOpenCallNoForwardClassification = {
|
||||
extension: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
};
|
||||
this._mainThreadTelemerty.$publicLog2<{ extension: string }, ShimmingOpenCallNoForwardClassification>('shimming.open.call.noForward', { extension: this._extensionId });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
.monaco-workbench .part.statusbar > .items-container > .statusbar-item.has-beak:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 11px;
|
||||
left: calc(50% - 8px); /* 3px (margin) + 5px (padding) = 8px */
|
||||
top: -5px;
|
||||
border-bottom-width: 5px;
|
||||
border-bottom-style: solid;
|
||||
|
||||
@@ -11,10 +11,10 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
|
||||
// tslint:disable-next-line: import-patterns no-standalone-editor
|
||||
import { IDownloadService } from 'vs/platform/download/common/download';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IGalleryExtension, IExtensionIdentifier, IReportedExtension, IExtensionManagementService, ILocalExtension, IGalleryMetadata, IExtensionTipsService, ExtensionRecommendationReason, IExtensionRecommendation, IExtensionEnablementService, EnablementState } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionType, ExtensionIdentifier, IExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { IGalleryExtension, IExtensionIdentifier, IReportedExtension, IExtensionManagementService, ILocalExtension, IGalleryMetadata } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionTipsService, ExtensionRecommendationReason, IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionType, ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { IURLHandler, IURLService } from 'vs/platform/url/common/url';
|
||||
import { ITelemetryService, ITelemetryData, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ConsoleLogService, ILogService } from 'vs/platform/log/common/log';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
@@ -25,10 +25,8 @@ import { IRecentlyOpened, IRecent, isRecentFile, isRecentFolder } from 'vs/platf
|
||||
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
|
||||
import { ITunnelService } from 'vs/platform/remote/common/tunnel';
|
||||
import { IReloadSessionEvent, IExtensionHostDebugService, ICloseSessionEvent, IAttachSessionEvent, ILogToSessionEvent, ITerminateSessionEvent } from 'vs/workbench/services/extensions/common/extensionHostDebug';
|
||||
import { IRemoteConsoleLog } from 'vs/base/common/console';
|
||||
import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug';
|
||||
// tslint:disable-next-line: import-patterns
|
||||
import { IExtensionsWorkbenchService, IExtension as IExtension2 } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { addDisposableListener, EventType } from 'vs/base/browser/dom';
|
||||
import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -36,11 +34,12 @@ import { pathsToEditors } from 'vs/workbench/common/editor';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/platform/telemetry/common/gdprTypings';
|
||||
import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { toStoreData, restoreRecentlyOpened } from 'vs/platform/history/common/historyStorage';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
// tslint:disable-next-line: import-patterns
|
||||
import { IExperimentService, IExperiment, ExperimentActionType, ExperimentState } from 'vs/workbench/contrib/experiments/common/experimentService';
|
||||
import { ExtensionHostDebugChannelClient, ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc';
|
||||
|
||||
//#region Download
|
||||
|
||||
@@ -58,62 +57,6 @@ registerSingleton(IDownloadService, SimpleDownloadService, true);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#endregion IExtensionsWorkbenchService
|
||||
export class SimpleExtensionsWorkbenchService implements IExtensionsWorkbenchService {
|
||||
_serviceBrand: any;
|
||||
onChange: Event<IExtension2 | undefined>;
|
||||
local: IExtension2[];
|
||||
installed: IExtension2[];
|
||||
outdated: IExtension2[];
|
||||
queryLocal: any;
|
||||
queryGallery: any;
|
||||
canInstall: any;
|
||||
install: any;
|
||||
uninstall: any;
|
||||
installVersion: any;
|
||||
reinstall: any;
|
||||
setEnablement: any;
|
||||
open: any;
|
||||
checkForUpdates: any;
|
||||
allowedBadgeProviders: string[];
|
||||
}
|
||||
registerSingleton(IExtensionsWorkbenchService, SimpleExtensionsWorkbenchService, true);
|
||||
//#endregion
|
||||
|
||||
//#region Extension Management
|
||||
|
||||
//#region Extension Enablement
|
||||
|
||||
export class SimpleExtensionEnablementService implements IExtensionEnablementService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
readonly onEnablementChanged = Event.None;
|
||||
|
||||
readonly allUserExtensionsDisabled = false;
|
||||
|
||||
getEnablementState(extension: IExtension): EnablementState {
|
||||
return EnablementState.Enabled;
|
||||
}
|
||||
|
||||
canChangeEnablement(extension: IExtension): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
setEnablement(extensions: IExtension[], newState: EnablementState): Promise<boolean[]> {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
|
||||
isEnabled(extension: IExtension): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
registerSingleton(IExtensionEnablementService, SimpleExtensionEnablementService, true);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Extension Tips
|
||||
|
||||
export class SimpleExtensionTipsService implements IExtensionTipsService {
|
||||
@@ -145,7 +88,7 @@ export class SimpleExtensionTipsService implements IExtensionTipsService {
|
||||
}
|
||||
|
||||
getAllIgnoredRecommendations(): { global: string[]; workspace: string[]; } {
|
||||
return Object.create(null);
|
||||
return { global: [], workspace: [] };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,38 +239,6 @@ export class SimpleMultiExtensionsManagementService implements IExtensionManagem
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Telemetry
|
||||
|
||||
export class SimpleTelemetryService implements ITelemetryService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
isOptedIn: true;
|
||||
|
||||
publicLog(eventName: string, data?: ITelemetryData) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
publicLog2<E extends ClassifiedEvent<T> = never, T extends GDPRClassification<T> = never>(eventName: string, data?: StrictPropertyCheck<T, E>) {
|
||||
return this.publicLog(eventName, data as ITelemetryData);
|
||||
}
|
||||
|
||||
setEnabled(value: boolean): void {
|
||||
}
|
||||
|
||||
getTelemetryInfo(): Promise<ITelemetryInfo> {
|
||||
return Promise.resolve({
|
||||
instanceId: 'someValue.instanceId',
|
||||
sessionId: 'someValue.sessionId',
|
||||
machineId: 'someValue.machineId'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(ITelemetryService, SimpleTelemetryService);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Update
|
||||
|
||||
export class SimpleUpdateService implements IUpdateService {
|
||||
@@ -669,23 +580,19 @@ registerSingleton(IWindowService, SimpleWindowService);
|
||||
|
||||
//#region ExtensionHostDebugService
|
||||
|
||||
export class SimpleExtensionHostDebugService implements IExtensionHostDebugService {
|
||||
_serviceBrand: any;
|
||||
export class SimpleExtensionHostDebugService extends ExtensionHostDebugChannelClient {
|
||||
|
||||
reload(sessionId: string): void { }
|
||||
onReload: Event<IReloadSessionEvent> = Event.None;
|
||||
constructor(
|
||||
@IRemoteAgentService remoteAgentService: IRemoteAgentService
|
||||
) {
|
||||
const connection = remoteAgentService.getConnection();
|
||||
|
||||
close(sessionId: string): void { }
|
||||
onClose: Event<ICloseSessionEvent> = Event.None;
|
||||
if (!connection) {
|
||||
throw new Error('Missing agent connection');
|
||||
}
|
||||
|
||||
attachSession(sessionId: string, port: number, subId?: string): void { }
|
||||
onAttachSession: Event<IAttachSessionEvent> = Event.None;
|
||||
|
||||
logToSession(sessionId: string, log: IRemoteConsoleLog): void { }
|
||||
onLogToSession: Event<ILogToSessionEvent> = Event.None;
|
||||
|
||||
terminateSession(sessionId: string, subId?: string): void { }
|
||||
onTerminateSession: Event<ITerminateSessionEvent> = Event.None;
|
||||
super(connection.getChannel(ExtensionHostDebugBroadcastChannel.ChannelName));
|
||||
}
|
||||
}
|
||||
registerSingleton(IExtensionHostDebugService, SimpleExtensionHostDebugService);
|
||||
|
||||
@@ -830,6 +737,53 @@ export class SimpleWindowsService implements IWindowsService {
|
||||
}
|
||||
|
||||
openExtensionDevelopmentHostWindow(args: ParsedArgs, env: IProcessEnvironment): Promise<void> {
|
||||
|
||||
// we pass the "ParsedArgs" as query parameters of the URL
|
||||
|
||||
let newAddress = `${document.location.origin}/?`;
|
||||
|
||||
const f = args['folder-uri'];
|
||||
if (f) {
|
||||
let u: URI | undefined;
|
||||
if (Array.isArray(f)) {
|
||||
if (f.length > 0) {
|
||||
u = URI.parse(f[0]);
|
||||
}
|
||||
} else {
|
||||
u = URI.parse(f);
|
||||
}
|
||||
if (u) {
|
||||
newAddress += `folder=${encodeURIComponent(u.path)}`;
|
||||
}
|
||||
}
|
||||
|
||||
const ep = args['extensionDevelopmentPath'];
|
||||
if (ep) {
|
||||
let u: string | undefined;
|
||||
if (Array.isArray(ep)) {
|
||||
if (ep.length > 0) {
|
||||
u = ep[0];
|
||||
}
|
||||
} else {
|
||||
u = ep;
|
||||
}
|
||||
if (u) {
|
||||
newAddress += `&edp=${encodeURIComponent(u)}`;
|
||||
}
|
||||
}
|
||||
|
||||
const di = args['debugId'];
|
||||
if (di) {
|
||||
newAddress += `&di=${encodeURIComponent(di)}`;
|
||||
}
|
||||
|
||||
const ibe = args['inspect-brk-extensions'];
|
||||
if (ibe) {
|
||||
newAddress += `&ibe=${encodeURIComponent(ibe)}`;
|
||||
}
|
||||
|
||||
window.open(newAddress);
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ export class CommentNode extends Disposable {
|
||||
secondaryActions.push(...secondary);
|
||||
}
|
||||
|
||||
if (actions.length) {
|
||||
if (actions.length || secondaryActions.length) {
|
||||
this.toolbar = new ToolBar(this._actionsToolbarContainer, this.contextMenuService, {
|
||||
actionViewItemProvider: action => {
|
||||
if (action.id === ToggleReactionsAction.ID) {
|
||||
@@ -318,18 +318,18 @@ export class CommentNode extends Disposable {
|
||||
let toggleReactionAction = this.createReactionPicker2(this.comment.commentReactions || []);
|
||||
this._reactionsActionBar.push(toggleReactionAction, { label: false, icon: true });
|
||||
} else {
|
||||
let reactionGroup = this.commentService.getReactionGroup(this.owner);
|
||||
if (reactionGroup && reactionGroup.length) {
|
||||
let toggleReactionAction = this.createReactionPicker2(reactionGroup || []);
|
||||
this._reactionsActionBar.push(toggleReactionAction, { label: false, icon: true });
|
||||
}
|
||||
// let reactionGroup = this.commentService.getReactionGroup(this.owner);
|
||||
// if (reactionGroup && reactionGroup.length) {
|
||||
// let toggleReactionAction = this.createReactionPicker2(reactionGroup || []);
|
||||
// this._reactionsActionBar.push(toggleReactionAction, { label: false, icon: true });
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
private createCommentEditor(): void {
|
||||
const container = dom.append(this._commentEditContainer, dom.$('.edit-textarea'));
|
||||
this._commentEditor = this.instantiationService.createInstance(SimpleCommentEditor, container, SimpleCommentEditor.getEditorOptions(), this.parentEditor, this.parentThread);
|
||||
const resource = URI.parse(`comment:commentinput-${this.comment.commentId}-${Date.now()}.md`);
|
||||
const resource = URI.parse(`comment:commentinput-${this.comment.uniqueIdInThread}-${Date.now()}.md`);
|
||||
this._commentEditorModel = this.modelService.createModel('', this.modeService.createByFilepathOrFirstLine(resource), resource, false);
|
||||
|
||||
this._commentEditor.setModel(this._commentEditorModel);
|
||||
|
||||
@@ -54,7 +54,6 @@ export interface ICommentService {
|
||||
disposeCommentThread(ownerId: string, threadId: string): void;
|
||||
getComments(resource: URI): Promise<(ICommentInfo | null)[]>;
|
||||
getCommentingRanges(resource: URI): Promise<IRange[]>;
|
||||
getReactionGroup(owner: string): CommentReaction[] | undefined;
|
||||
hasReactionHandler(owner: string): boolean;
|
||||
toggleReaction(owner: string, resource: URI, thread: CommentThread, comment: Comment, reaction: CommentReaction): Promise<void>;
|
||||
setActiveCommentThread(commentThread: CommentThread | null): void;
|
||||
@@ -183,22 +182,6 @@ export class CommentService extends Disposable implements ICommentService {
|
||||
}
|
||||
}
|
||||
|
||||
getReactionGroup(owner: string): CommentReaction[] | undefined {
|
||||
const commentProvider = this._commentControls.get(owner);
|
||||
|
||||
if (commentProvider) {
|
||||
return commentProvider.getReactionGroup();
|
||||
}
|
||||
|
||||
const commentController = this._commentControls.get(owner);
|
||||
|
||||
if (commentController) {
|
||||
return commentController.getReactionGroup();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
hasReactionHandler(owner: string): boolean {
|
||||
const commentProvider = this._commentControls.get(owner);
|
||||
|
||||
|
||||
@@ -161,14 +161,14 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
||||
// we don't do anything here as we always do the reveal ourselves.
|
||||
}
|
||||
|
||||
public reveal(commentId?: string) {
|
||||
public reveal(commentUniqueId?: number) {
|
||||
if (!this._isExpanded) {
|
||||
this.show({ lineNumber: this._commentThread.range.startLineNumber, column: 1 }, 2);
|
||||
}
|
||||
|
||||
if (commentId) {
|
||||
if (commentUniqueId !== undefined) {
|
||||
let height = this.editor.getLayoutInfo().height;
|
||||
let matchedNode = this._commentElements.filter(commentNode => commentNode.comment.commentId === commentId);
|
||||
let matchedNode = this._commentElements.filter(commentNode => commentNode.comment.uniqueIdInThread === commentUniqueId);
|
||||
if (matchedNode && matchedNode.length) {
|
||||
const commentThreadCoords = dom.getDomNodePagePosition(this._commentElements[0].domNode);
|
||||
const commentCoords = dom.getDomNodePagePosition(matchedNode[0].domNode);
|
||||
@@ -247,9 +247,14 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
||||
this._actionbarWidget.push([...groups, this._collapseAction], { label: false, icon: true });
|
||||
}
|
||||
|
||||
private deleteCommentThread(): void {
|
||||
this.dispose();
|
||||
this.commentService.disposeCommentThread(this.owner, this._commentThread.threadId);
|
||||
}
|
||||
|
||||
public collapse(): Promise<void> {
|
||||
if (this._commentThread.comments && this._commentThread.comments.length === 0) {
|
||||
this.dispose();
|
||||
this.deleteCommentThread();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@@ -268,7 +273,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
||||
if (this._isExpanded) {
|
||||
this.hide();
|
||||
if (!this._commentThread.comments || !this._commentThread.comments.length) {
|
||||
this.dispose();
|
||||
this.deleteCommentThread();
|
||||
}
|
||||
} else {
|
||||
this.show({ lineNumber: lineNumber, column: 1 }, 2);
|
||||
@@ -284,7 +289,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
||||
let commentElementsToDelIndex: number[] = [];
|
||||
for (let i = 0; i < oldCommentsLen; i++) {
|
||||
let comment = this._commentElements[i].comment;
|
||||
let newComment = commentThread.comments ? commentThread.comments.filter(c => c.commentId === comment.commentId) : [];
|
||||
let newComment = commentThread.comments ? commentThread.comments.filter(c => c.uniqueIdInThread === comment.uniqueIdInThread) : [];
|
||||
|
||||
if (newComment.length) {
|
||||
this._commentElements[i].update(newComment[0]);
|
||||
@@ -304,7 +309,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
||||
let newCommentNodeList: CommentNode[] = [];
|
||||
for (let i = newCommentsLen - 1; i >= 0; i--) {
|
||||
let currentComment = commentThread.comments![i];
|
||||
let oldCommentNode = this._commentElements.filter(commentNode => commentNode.comment.commentId === currentComment.commentId);
|
||||
let oldCommentNode = this._commentElements.filter(commentNode => commentNode.comment.uniqueIdInThread === currentComment.uniqueIdInThread);
|
||||
if (oldCommentNode.length) {
|
||||
oldCommentNode[0].update(currentComment);
|
||||
lastCommentElement = oldCommentNode[0].domNode;
|
||||
@@ -601,13 +606,13 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
||||
|
||||
this._disposables.add(newCommentNode);
|
||||
this._disposables.add(newCommentNode.onDidDelete(deletedNode => {
|
||||
const deletedNodeId = deletedNode.comment.commentId;
|
||||
const deletedElementIndex = arrays.firstIndex(this._commentElements, commentNode => commentNode.comment.commentId === deletedNodeId);
|
||||
const deletedNodeId = deletedNode.comment.uniqueIdInThread;
|
||||
const deletedElementIndex = arrays.firstIndex(this._commentElements, commentNode => commentNode.comment.uniqueIdInThread === deletedNodeId);
|
||||
if (deletedElementIndex > -1) {
|
||||
this._commentElements.splice(deletedElementIndex, 1);
|
||||
}
|
||||
|
||||
const deletedCommentIndex = arrays.firstIndex(this._commentThread.comments!, comment => comment.commentId === deletedNodeId);
|
||||
const deletedCommentIndex = arrays.firstIndex(this._commentThread.comments!, comment => comment.uniqueIdInThread === deletedNodeId);
|
||||
if (deletedCommentIndex > -1) {
|
||||
this._commentThread.comments!.splice(deletedCommentIndex, 1);
|
||||
}
|
||||
|
||||
@@ -247,18 +247,18 @@ export class ReviewController implements IEditorContribution {
|
||||
return editor.getContribution<ReviewController>(ID);
|
||||
}
|
||||
|
||||
public revealCommentThread(threadId: string, commentId: string, fetchOnceIfNotExist: boolean): void {
|
||||
public revealCommentThread(threadId: string, commentUniqueId: number, fetchOnceIfNotExist: boolean): void {
|
||||
const commentThreadWidget = this._commentWidgets.filter(widget => widget.commentThread.threadId === threadId);
|
||||
if (commentThreadWidget.length === 1) {
|
||||
commentThreadWidget[0].reveal(commentId);
|
||||
commentThreadWidget[0].reveal(commentUniqueId);
|
||||
} else if (fetchOnceIfNotExist) {
|
||||
if (this._computePromise) {
|
||||
this._computePromise.then(_ => {
|
||||
this.revealCommentThread(threadId, commentId, false);
|
||||
this.revealCommentThread(threadId, commentUniqueId, false);
|
||||
});
|
||||
} else {
|
||||
this.beginCompute().then(_ => {
|
||||
this.revealCommentThread(threadId, commentId, false);
|
||||
this.revealCommentThread(threadId, commentUniqueId, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ export class CommentsPanel extends Panel {
|
||||
let currentActiveResource = activeEditor ? activeEditor.getResource() : undefined;
|
||||
if (currentActiveResource && currentActiveResource.toString() === element.resource.toString()) {
|
||||
const threadToReveal = element instanceof ResourceWithCommentThreads ? element.commentThreads[0].threadId : element.threadId;
|
||||
const commentToReveal = element instanceof ResourceWithCommentThreads ? element.commentThreads[0].comment.commentId : element.comment.commentId;
|
||||
const commentToReveal = element instanceof ResourceWithCommentThreads ? element.commentThreads[0].comment.uniqueIdInThread : element.comment.uniqueIdInThread;
|
||||
const control = this.editorService.activeTextEditorWidget;
|
||||
if (threadToReveal && isCodeEditor(control)) {
|
||||
const controller = ReviewController.get(control);
|
||||
@@ -200,7 +200,7 @@ export class CommentsPanel extends Panel {
|
||||
const control = editor.getControl();
|
||||
if (threadToReveal && isCodeEditor(control)) {
|
||||
const controller = ReviewController.get(control);
|
||||
controller.revealCommentThread(threadToReveal, commentToReveal.commentId, true);
|
||||
controller.revealCommentThread(threadToReveal, commentToReveal.uniqueIdInThread, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ export class CommentsDataSource implements IDataSource {
|
||||
return element.id;
|
||||
}
|
||||
if (element instanceof CommentNode) {
|
||||
return `${element.resource.toString()}-${element.comment.commentId}`;
|
||||
return `${element.resource.toString()}-${element.comment.uniqueIdInThread}`;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 8.70714L11.6464 12.3536L12.3536 11.6465L8.70711 8.00004L12.3536 4.35359L11.6464 3.64648L8 7.29293L4.35355 3.64648L3.64645 4.35359L7.29289 8.00004L3.64645 11.6465L4.35355 12.3536L8 8.70714Z" fill="#C5C5C5"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 362 B |
@@ -1,3 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 8.70714L11.6464 12.3536L12.3536 11.6465L8.70711 8.00004L12.3536 4.35359L11.6464 3.64648L8 7.29293L4.35355 3.64648L3.64645 4.35359L7.29289 8.00004L3.64645 11.6465L4.35355 12.3536L8 8.70714Z" fill="#C5C5C5"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 362 B |
@@ -1,3 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 8.70714L11.6464 12.3536L12.3536 11.6465L8.70711 8.00004L12.3536 4.35359L11.6464 3.64648L8 7.29293L4.35355 3.64648L3.64645 4.35359L7.29289 8.00004L3.64645 11.6465L4.35355 12.3536L8 8.70714Z" fill="#424242"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 362 B |
@@ -1,4 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40706 15L1 13.5929L3.35721 9.46781L3.52339 9.25025L11.7736 1L13.2321 1L15 2.76791V4.22636L6.74975 12.4766L6.53219 12.6428L2.40706 15ZM2.40706 13.5929L6.02053 11.7474L14.2708 3.49714L12.5029 1.72923L4.25262 9.97947L2.40706 13.5929Z" fill="#C5C5C5"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.64645 12.3536L3.64645 10.3536L4.35355 9.64648L6.35355 11.6465L5.64645 12.3536Z" fill="#C5C5C5"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 553 B |
@@ -1,4 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40706 15L1 13.5929L3.35721 9.46781L3.52339 9.25025L11.7736 1L13.2321 1L15 2.76791V4.22636L6.74975 12.4766L6.53219 12.6428L2.40706 15ZM2.40706 13.5929L6.02053 11.7474L14.2708 3.49714L12.5029 1.72923L4.25262 9.97947L2.40706 13.5929Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.64645 12.3536L3.64645 10.3536L4.35355 9.64648L6.35355 11.6465L5.64645 12.3536Z" fill="white"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 549 B |
@@ -1,4 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40706 15L1 13.5929L3.35721 9.46781L3.52339 9.25025L11.7736 1L13.2321 1L15 2.76791V4.22636L6.74975 12.4766L6.53219 12.6428L2.40706 15ZM2.40706 13.5929L6.02053 11.7474L14.2708 3.49714L12.5029 1.72923L4.25262 9.97947L2.40706 13.5929Z" fill="#424242"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.64645 12.3536L3.64645 10.3536L4.35355 9.64648L6.35355 11.6465L5.64645 12.3536Z" fill="#424242"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 553 B |
@@ -29,10 +29,6 @@
|
||||
height: 21px;
|
||||
}
|
||||
|
||||
.monaco-editor .review-widget .body .review-comment .comment-actions .action-item {
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
.monaco-editor .review-widget .body .review-comment .comment-title {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
@@ -148,10 +144,6 @@
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.monaco-editor .review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.monaco-editor .review-widget .head .review-actions > .monaco-action-bar .icon.expand-review-action {
|
||||
background-image: url("./close-light.svg");
|
||||
background-size: 16px;
|
||||
@@ -165,32 +157,6 @@
|
||||
background-image: url("./close-hc.svg");
|
||||
}
|
||||
|
||||
.monaco-editor .review-widget .body .review-comment .comment-title .icon.edit {
|
||||
background-image: url("./edit-light.svg");
|
||||
background-size: 16px;
|
||||
}
|
||||
|
||||
.monaco-editor.vs-dark .review-widget .body .review-comment .comment-title .icon.edit {
|
||||
background-image: url("./edit-dark.svg");
|
||||
}
|
||||
|
||||
.monaco-editor.hc-black .review-widget .body .review-comment .comment-title .icon.edit {
|
||||
background-image: url("./edit-hc.svg");
|
||||
}
|
||||
|
||||
.monaco-editor .review-widget .body .review-comment .comment-title .icon.delete {
|
||||
background-image: url("./delete-light.svg");
|
||||
background-size: 16px;
|
||||
}
|
||||
|
||||
.monaco-editor.vs-dark .review-widget .body .review-comment .comment-title .icon.delete {
|
||||
background-image: url("./delete-dark.svg");
|
||||
}
|
||||
|
||||
.monaco-editor.hc-black .review-widget .body .review-comment .comment-title .icon.delete {
|
||||
background-image: url("./delete-hc.svg");
|
||||
}
|
||||
|
||||
.monaco-editor .review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label.toolbar-toggle-pickReactions {
|
||||
display: none;
|
||||
background-image: url("./reaction-light.svg");
|
||||
@@ -220,7 +186,6 @@
|
||||
display: block;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
min-width: 28px;
|
||||
background-size: 16px;
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
@@ -433,7 +398,8 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.monaco-editor .review-widget .head .review-actions > .monaco-action-bar .action-item {
|
||||
.monaco-editor .review-widget .action-item {
|
||||
min-width: 16px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ import { IDebugService, State, IDebugSession, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_
|
||||
import { isExtensionHostDebugging } from 'vs/workbench/contrib/debug/common/debugUtils';
|
||||
import { isErrorWithActions, createErrorWithActions } from 'vs/base/common/errorsWithActions';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { IExtensionHostDebugService } from 'vs/workbench/services/extensions/common/extensionHostDebug';
|
||||
import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug';
|
||||
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
|
||||
const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
|
||||
|
||||
@@ -220,12 +220,10 @@ export class ExperimentService extends Disposable implements IExperimentService
|
||||
|
||||
});
|
||||
return Promise.all(promises).then(() => {
|
||||
/* __GDPR__
|
||||
"experiments" : {
|
||||
"experiments" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('experiments', { experiments: this._experiments });
|
||||
type ExperimentsClassification = {
|
||||
experiments: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
};
|
||||
this.telemetryService.publicLog2<{ experiments: IExperiment[] }, ExperimentsClassification>('experiments', { experiments: this._experiments });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,9 +10,9 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { TestLifecycleService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import {
|
||||
IExtensionManagementService, DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier,
|
||||
IExtensionEnablementService, ILocalExtension
|
||||
IExtensionManagementService, DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier, ILocalExtension
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { TestExtensionEnablementService } from 'vs/workbench/services/extensionManagement/test/electron-browser/extensionEnablementService.test';
|
||||
|
||||
@@ -20,7 +20,7 @@ import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionTipsService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManifest, IKeyBinding, IView, IViewContainer, ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { ResolvedKeybinding, KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { ExtensionsInput } from 'vs/workbench/contrib/extensions/common/extensionsInput';
|
||||
@@ -498,6 +498,13 @@ export class ExtensionEditor extends BaseEditor {
|
||||
}));
|
||||
}
|
||||
|
||||
clearInput(): void {
|
||||
this.contentDisposables.clear();
|
||||
this.transientDisposables.clear();
|
||||
|
||||
super.clearInput();
|
||||
}
|
||||
|
||||
focus(): void {
|
||||
if (this.activeElement) {
|
||||
this.activeElement.focus();
|
||||
@@ -621,8 +628,7 @@ export class ExtensionEditor extends BaseEditor {
|
||||
this.renderViewContainers(content, manifest, layout),
|
||||
this.renderViews(content, manifest, layout),
|
||||
this.renderLocalizations(content, manifest, layout),
|
||||
// {{SQL CARBON EDIT}}
|
||||
renderDashboardContributions(content, manifest, layout)
|
||||
renderDashboardContributions(content, manifest, layout) // {{SQL CARBON EDIT}}
|
||||
];
|
||||
|
||||
scrollableContent.scanDomNode();
|
||||
@@ -860,7 +866,7 @@ export class ExtensionEditor extends BaseEditor {
|
||||
const contributes = manifest.contributes;
|
||||
const colors = contributes && contributes.colors;
|
||||
|
||||
if (!colors || !colors.length) {
|
||||
if (!(colors && colors.length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -943,12 +949,12 @@ export class ExtensionEditor extends BaseEditor {
|
||||
menus[context].forEach(menu => {
|
||||
let command = byId[menu.command];
|
||||
|
||||
if (!command) {
|
||||
if (command) {
|
||||
command.menus.push(context);
|
||||
} else {
|
||||
command = { id: menu.command, title: '', keybindings: [], menus: [context] };
|
||||
byId[command.id] = command;
|
||||
commands.push(command);
|
||||
} else {
|
||||
command.menus.push(context);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -964,12 +970,12 @@ export class ExtensionEditor extends BaseEditor {
|
||||
|
||||
let command = byId[rawKeybinding.command];
|
||||
|
||||
if (!command) {
|
||||
if (command) {
|
||||
command.keybindings.push(keybinding);
|
||||
} else {
|
||||
command = { id: rawKeybinding.command, title: '', keybindings: [keybinding], menus: [] };
|
||||
byId[command.id] = command;
|
||||
commands.push(command);
|
||||
} else {
|
||||
command.keybindings.push(keybinding);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1023,12 +1029,12 @@ export class ExtensionEditor extends BaseEditor {
|
||||
grammars.forEach(grammar => {
|
||||
let language = byId[grammar.language];
|
||||
|
||||
if (!language) {
|
||||
if (language) {
|
||||
language.hasGrammar = true;
|
||||
} else {
|
||||
language = { id: grammar.language, name: grammar.language, extensions: [], hasGrammar: true, hasSnippets: false };
|
||||
byId[language.id] = language;
|
||||
languages.push(language);
|
||||
} else {
|
||||
language.hasGrammar = true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1037,12 +1043,12 @@ export class ExtensionEditor extends BaseEditor {
|
||||
snippets.forEach(snippet => {
|
||||
let language = byId[snippet.language];
|
||||
|
||||
if (!language) {
|
||||
if (language) {
|
||||
language.hasSnippets = true;
|
||||
} else {
|
||||
language = { id: snippet.language, name: snippet.language, extensions: [], hasGrammar: false, hasSnippets: true };
|
||||
byId[language.id] = language;
|
||||
languages.push(language);
|
||||
} else {
|
||||
language.hasSnippets = true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1084,11 +1090,11 @@ export class ExtensionEditor extends BaseEditor {
|
||||
}
|
||||
|
||||
const keyBinding = KeybindingParser.parseKeybinding(key || rawKeyBinding.key, OS);
|
||||
if (!keyBinding) {
|
||||
return null;
|
||||
}
|
||||
if (keyBinding) {
|
||||
return this.keybindingService.resolveKeybinding(keyBinding)[0];
|
||||
|
||||
return this.keybindingService.resolveKeybinding(keyBinding)[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private loadContents<T>(loadingTask: () => CacheResult<T>): Promise<T> {
|
||||
|
||||
@@ -0,0 +1,373 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/extensions';
|
||||
import { localize } from 'vs/nls';
|
||||
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { ExtensionsLabel, ExtensionsChannelId, PreferencesLabel, IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/contrib/output/common/output';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { VIEWLET_ID, IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService';
|
||||
import {
|
||||
OpenExtensionsViewletAction, InstallExtensionsAction, ShowOutdatedExtensionsAction, ShowRecommendedExtensionsAction, ShowRecommendedKeymapExtensionsAction, ShowPopularExtensionsAction,
|
||||
ShowEnabledExtensionsAction, ShowInstalledExtensionsAction, ShowDisabledExtensionsAction, ShowBuiltInExtensionsAction, UpdateAllAction,
|
||||
EnableAllAction, EnableAllWorkpsaceAction, DisableAllAction, DisableAllWorkpsaceAction, CheckForUpdatesAction, ShowLanguageExtensionsAction, ShowAzureExtensionsAction, EnableAutoUpdateAction, DisableAutoUpdateAction, ConfigureRecommendedExtensionsCommandsContributor, OpenExtensionsFolderAction, InstallVSIXAction, ReinstallAction, InstallSpecificVersionOfExtensionAction
|
||||
} from 'vs/workbench/contrib/extensions/browser/extensionsActions';
|
||||
import { ExtensionsInput } from 'vs/workbench/contrib/extensions/common/extensionsInput';
|
||||
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
import { ExtensionEditor } from 'vs/workbench/contrib/extensions/browser/extensionEditor';
|
||||
import { StatusUpdater, ExtensionsViewlet, MaliciousExtensionChecker, ExtensionsViewletViewsContribution } from 'vs/workbench/contrib/extensions/browser/extensionsViewlet';
|
||||
import { IQuickOpenRegistry, Extensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen';
|
||||
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import * as jsonContributionRegistry from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { ExtensionsConfigurationSchema, ExtensionsConfigurationSchemaId } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { KeymapExtensions } from 'vs/workbench/contrib/extensions/common/extensionsUtils';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { GalleryExtensionsHandler, ExtensionsHandler } from 'vs/workbench/contrib/extensions/browser/extensionsQuickOpen';
|
||||
import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { ExtensionActivationProgress } from 'vs/workbench/contrib/extensions/browser/extensionsActivationProgress';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ExtensionDependencyChecker } from 'vs/workbench/contrib/extensions/browser/extensionsDependencyChecker';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
|
||||
// Singletons
|
||||
registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService);
|
||||
|
||||
Registry.as<IOutputChannelRegistry>(OutputExtensions.OutputChannels)
|
||||
.registerChannel({ id: ExtensionsChannelId, label: ExtensionsLabel, log: false });
|
||||
|
||||
// Quickopen
|
||||
Registry.as<IQuickOpenRegistry>(Extensions.Quickopen).registerQuickOpenHandler(
|
||||
new QuickOpenHandlerDescriptor(
|
||||
ExtensionsHandler,
|
||||
ExtensionsHandler.ID,
|
||||
'ext ',
|
||||
undefined,
|
||||
localize('extensionsCommands', "Manage Extensions"),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
// Editor
|
||||
const editorDescriptor = new EditorDescriptor(
|
||||
ExtensionEditor,
|
||||
ExtensionEditor.ID,
|
||||
localize('extension', "Extension")
|
||||
);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(editorDescriptor, [new SyncDescriptor(ExtensionsInput)]);
|
||||
|
||||
// Viewlet
|
||||
const viewletDescriptor = new ViewletDescriptor(
|
||||
ExtensionsViewlet,
|
||||
VIEWLET_ID,
|
||||
localize('extensions', "Extensions"),
|
||||
'extensions',
|
||||
4
|
||||
);
|
||||
|
||||
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets)
|
||||
.registerViewlet(viewletDescriptor);
|
||||
|
||||
// Global actions
|
||||
const actionRegistry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions);
|
||||
|
||||
const openViewletActionDescriptor = new SyncActionDescriptor(OpenExtensionsViewletAction, OpenExtensionsViewletAction.ID, OpenExtensionsViewletAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_X });
|
||||
actionRegistry.registerWorkbenchAction(openViewletActionDescriptor, 'View: Show Extensions', localize('view', "View"));
|
||||
|
||||
const installActionDescriptor = new SyncActionDescriptor(InstallExtensionsAction, InstallExtensionsAction.ID, InstallExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(installActionDescriptor, 'Extensions: Install Extensions', ExtensionsLabel);
|
||||
|
||||
const listOutdatedActionDescriptor = new SyncActionDescriptor(ShowOutdatedExtensionsAction, ShowOutdatedExtensionsAction.ID, ShowOutdatedExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(listOutdatedActionDescriptor, 'Extensions: Show Outdated Extensions', ExtensionsLabel);
|
||||
|
||||
const recommendationsActionDescriptor = new SyncActionDescriptor(ShowRecommendedExtensionsAction, ShowRecommendedExtensionsAction.ID, ShowRecommendedExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(recommendationsActionDescriptor, 'Extensions: Show Recommended Extensions', ExtensionsLabel);
|
||||
|
||||
const keymapRecommendationsActionDescriptor = new SyncActionDescriptor(ShowRecommendedKeymapExtensionsAction, ShowRecommendedKeymapExtensionsAction.ID, ShowRecommendedKeymapExtensionsAction.SHORT_LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_M) });
|
||||
actionRegistry.registerWorkbenchAction(keymapRecommendationsActionDescriptor, 'Preferences: Keymaps', PreferencesLabel);
|
||||
|
||||
const languageExtensionsActionDescriptor = new SyncActionDescriptor(ShowLanguageExtensionsAction, ShowLanguageExtensionsAction.ID, ShowLanguageExtensionsAction.SHORT_LABEL);
|
||||
actionRegistry.registerWorkbenchAction(languageExtensionsActionDescriptor, 'Preferences: Language Extensions', PreferencesLabel);
|
||||
|
||||
const azureExtensionsActionDescriptor = new SyncActionDescriptor(ShowAzureExtensionsAction, ShowAzureExtensionsAction.ID, ShowAzureExtensionsAction.SHORT_LABEL);
|
||||
actionRegistry.registerWorkbenchAction(azureExtensionsActionDescriptor, 'Preferences: Azure Extensions', PreferencesLabel);
|
||||
|
||||
const popularActionDescriptor = new SyncActionDescriptor(ShowPopularExtensionsAction, ShowPopularExtensionsAction.ID, ShowPopularExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(popularActionDescriptor, 'Extensions: Show Popular Extensions', ExtensionsLabel);
|
||||
|
||||
const enabledActionDescriptor = new SyncActionDescriptor(ShowEnabledExtensionsAction, ShowEnabledExtensionsAction.ID, ShowEnabledExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(enabledActionDescriptor, 'Extensions: Show Enabled Extensions', ExtensionsLabel);
|
||||
|
||||
const installedActionDescriptor = new SyncActionDescriptor(ShowInstalledExtensionsAction, ShowInstalledExtensionsAction.ID, ShowInstalledExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(installedActionDescriptor, 'Extensions: Show Installed Extensions', ExtensionsLabel);
|
||||
|
||||
const disabledActionDescriptor = new SyncActionDescriptor(ShowDisabledExtensionsAction, ShowDisabledExtensionsAction.ID, ShowDisabledExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(disabledActionDescriptor, 'Extensions: Show Disabled Extensions', ExtensionsLabel);
|
||||
|
||||
const builtinActionDescriptor = new SyncActionDescriptor(ShowBuiltInExtensionsAction, ShowBuiltInExtensionsAction.ID, ShowBuiltInExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(builtinActionDescriptor, 'Extensions: Show Built-in Extensions', ExtensionsLabel);
|
||||
|
||||
const updateAllActionDescriptor = new SyncActionDescriptor(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, 'Extensions: Update All Extensions', ExtensionsLabel);
|
||||
|
||||
const installVSIXActionDescriptor = new SyncActionDescriptor(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(installVSIXActionDescriptor, 'Extensions: Install from VSIX...', ExtensionsLabel);
|
||||
|
||||
const disableAllAction = new SyncActionDescriptor(DisableAllAction, DisableAllAction.ID, DisableAllAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(disableAllAction, 'Extensions: Disable All Installed Extensions', ExtensionsLabel);
|
||||
|
||||
const disableAllWorkspaceAction = new SyncActionDescriptor(DisableAllWorkpsaceAction, DisableAllWorkpsaceAction.ID, DisableAllWorkpsaceAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(disableAllWorkspaceAction, 'Extensions: Disable All Installed Extensions for this Workspace', ExtensionsLabel);
|
||||
|
||||
const enableAllAction = new SyncActionDescriptor(EnableAllAction, EnableAllAction.ID, EnableAllAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(enableAllAction, 'Extensions: Enable All Extensions', ExtensionsLabel);
|
||||
|
||||
const enableAllWorkspaceAction = new SyncActionDescriptor(EnableAllWorkpsaceAction, EnableAllWorkpsaceAction.ID, EnableAllWorkpsaceAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(enableAllWorkspaceAction, 'Extensions: Enable All Extensions for this Workspace', ExtensionsLabel);
|
||||
|
||||
const checkForUpdatesAction = new SyncActionDescriptor(CheckForUpdatesAction, CheckForUpdatesAction.ID, CheckForUpdatesAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(checkForUpdatesAction, `Extensions: Check for Extension Updates`, ExtensionsLabel);
|
||||
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(EnableAutoUpdateAction, EnableAutoUpdateAction.ID, EnableAutoUpdateAction.LABEL), `Extensions: Enable Auto Updating Extensions`, ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(DisableAutoUpdateAction, DisableAutoUpdateAction.ID, DisableAutoUpdateAction.LABEL), `Extensions: Disable Auto Updating Extensions`, ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(InstallSpecificVersionOfExtensionAction, InstallSpecificVersionOfExtensionAction.ID, InstallSpecificVersionOfExtensionAction.LABEL), 'Install Specific Version of Extension...', ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ReinstallAction, ReinstallAction.ID, ReinstallAction.LABEL), 'Reinstall Extension...', localize('developer', "Developer"));
|
||||
|
||||
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
||||
.registerConfiguration({
|
||||
id: 'extensions',
|
||||
order: 30,
|
||||
title: localize('extensionsConfigurationTitle', "Extensions"),
|
||||
type: 'object',
|
||||
properties: {
|
||||
'extensions.autoUpdate': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsAutoUpdate', "When enabled, automatically installs updates for extensions. The updates are fetched from a Microsoft online service."),
|
||||
default: true,
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
tags: ['usesOnlineServices']
|
||||
},
|
||||
'extensions.autoCheckUpdates': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsCheckUpdates', "When enabled, automatically checks extensions for updates. If an extension has an update, it is marked as outdated in the Extensions view. The updates are fetched from a Microsoft online service."),
|
||||
default: true,
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
tags: ['usesOnlineServices']
|
||||
},
|
||||
'extensions.ignoreRecommendations': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsIgnoreRecommendations', "When enabled, the notifications for extension recommendations will not be shown."),
|
||||
default: false
|
||||
},
|
||||
'extensions.showRecommendationsOnlyOnDemand': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsShowRecommendationsOnlyOnDemand', "When enabled, recommendations will not be fetched or shown unless specifically requested by the user. Some recommendations are fetched from a Microsoft online service."),
|
||||
default: false,
|
||||
tags: ['usesOnlineServices']
|
||||
},
|
||||
'extensions.closeExtensionDetailsOnViewChange': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsCloseExtensionDetailsOnViewChange', "When enabled, editors with extension details will be automatically closed upon navigating away from the Extensions View."),
|
||||
default: false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>Registry.as(jsonContributionRegistry.Extensions.JSONContribution);
|
||||
jsonRegistry.registerSchema(ExtensionsConfigurationSchemaId, ExtensionsConfigurationSchema);
|
||||
|
||||
// Register Commands
|
||||
CommandsRegistry.registerCommand('_extensions.manage', (accessor: ServicesAccessor, extensionId: string) => {
|
||||
const extensionService = accessor.get(IExtensionsWorkbenchService);
|
||||
const extension = extensionService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }));
|
||||
if (extension.length === 1) {
|
||||
extensionService.open(extension[0]);
|
||||
}
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand('extension.open', (accessor: ServicesAccessor, extensionId: string) => {
|
||||
const extensionService = accessor.get(IExtensionsWorkbenchService);
|
||||
|
||||
return extensionService.queryGallery({ names: [extensionId], pageSize: 1 }, CancellationToken.None).then(pager => {
|
||||
if (pager.total !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
extensionService.open(pager.firstPage[0]);
|
||||
});
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'workbench.extensions.installExtension',
|
||||
description: {
|
||||
description: localize('workbench.extensions.installExtension.description', "Install the given extension"),
|
||||
args: [
|
||||
{
|
||||
name: localize('workbench.extensions.installExtension.arg.name', "Extension id or VSIX resource uri"),
|
||||
schema: {
|
||||
'type': ['object', 'string']
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
handler: async (accessor, arg: string | UriComponents) => {
|
||||
const extensionManagementService = accessor.get(IExtensionManagementService);
|
||||
const extensionGalleryService = accessor.get(IExtensionGalleryService);
|
||||
try {
|
||||
if (typeof arg === 'string') {
|
||||
const extension = await extensionGalleryService.getCompatibleExtension({ id: arg });
|
||||
if (extension) {
|
||||
await extensionManagementService.installFromGallery(extension);
|
||||
} else {
|
||||
throw new Error(localize('notFound', "Extension '{0}' not found.", arg));
|
||||
}
|
||||
} else {
|
||||
const vsix = URI.revive(arg);
|
||||
await extensionManagementService.install(vsix);
|
||||
}
|
||||
} catch (e) {
|
||||
onUnexpectedError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'workbench.extensions.uninstallExtension',
|
||||
description: {
|
||||
description: localize('workbench.extensions.uninstallExtension.description', "Uninstall the given extension"),
|
||||
args: [
|
||||
{
|
||||
name: localize('workbench.extensions.uninstallExtension.arg.name', "Id of the extension to uninstall"),
|
||||
schema: {
|
||||
'type': 'string'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
handler: async (accessor, id: string) => {
|
||||
if (!id) {
|
||||
throw new Error(localize('id required', "Extension id required."));
|
||||
}
|
||||
const extensionManagementService = accessor.get(IExtensionManagementService);
|
||||
try {
|
||||
const installed = await extensionManagementService.getInstalled(ExtensionType.User);
|
||||
const [extensionToUninstall] = installed.filter(e => areSameExtensions(e.identifier, { id }));
|
||||
if (!extensionToUninstall) {
|
||||
return Promise.reject(new Error(localize('notInstalled', "Extension '{0}' is not installed. Make sure you use the full extension ID, including the publisher, e.g.: ms-vscode.csharp.", id)));
|
||||
}
|
||||
await extensionManagementService.uninstall(extensionToUninstall, true);
|
||||
} catch (e) {
|
||||
onUnexpectedError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// File menu registration
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
||||
group: '2_keybindings',
|
||||
command: {
|
||||
id: ShowRecommendedKeymapExtensionsAction.ID,
|
||||
title: localize({ key: 'miOpenKeymapExtensions', comment: ['&& denotes a mnemonic'] }, "&&Keymaps")
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
||||
group: '2_keybindings',
|
||||
command: {
|
||||
id: ShowRecommendedKeymapExtensionsAction.ID,
|
||||
title: localize('miOpenKeymapExtensions2', "Keymaps")
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
||||
group: '1_settings',
|
||||
command: {
|
||||
id: VIEWLET_ID,
|
||||
title: localize({ key: 'miPreferencesExtensions', comment: ['&& denotes a mnemonic'] }, "&&Extensions")
|
||||
},
|
||||
order: 3
|
||||
});
|
||||
|
||||
// View menu
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
||||
group: '3_views',
|
||||
command: {
|
||||
id: VIEWLET_ID,
|
||||
title: localize({ key: 'miViewExtensions', comment: ['&& denotes a mnemonic'] }, "E&&xtensions")
|
||||
},
|
||||
order: 5
|
||||
});
|
||||
|
||||
// Global Activity Menu
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
||||
group: '2_configuration',
|
||||
command: {
|
||||
id: VIEWLET_ID,
|
||||
title: localize('showExtensions', "Extensions")
|
||||
},
|
||||
order: 3
|
||||
});
|
||||
|
||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||
|
||||
class ExtensionsContributions implements IWorkbenchContribution {
|
||||
|
||||
constructor(
|
||||
@IWorkbenchEnvironmentService workbenchEnvironmentService: IWorkbenchEnvironmentService,
|
||||
@IExtensionManagementServerService extensionManagementServerService: IExtensionManagementServerService
|
||||
) {
|
||||
|
||||
const canManageExtensions = extensionManagementServerService.localExtensionManagementServer || extensionManagementServerService.remoteExtensionManagementServer;
|
||||
|
||||
if (canManageExtensions) {
|
||||
Registry.as<IQuickOpenRegistry>(Extensions.Quickopen).registerQuickOpenHandler(
|
||||
new QuickOpenHandlerDescriptor(
|
||||
GalleryExtensionsHandler,
|
||||
GalleryExtensionsHandler.ID,
|
||||
'ext install ',
|
||||
undefined,
|
||||
localize('galleryExtensionsCommands', "Install Gallery Extensions"),
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (workbenchEnvironmentService.extensionsPath) {
|
||||
const openExtensionsFolderActionDescriptor = new SyncActionDescriptor(OpenExtensionsFolderAction, OpenExtensionsFolderAction.ID, OpenExtensionsFolderAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(openExtensionsFolderActionDescriptor, 'Extensions: Open Extensions Folder', ExtensionsLabel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
workbenchRegistry.registerWorkbenchContribution(ExtensionsContributions, LifecyclePhase.Starting);
|
||||
workbenchRegistry.registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Restored);
|
||||
workbenchRegistry.registerWorkbenchContribution(MaliciousExtensionChecker, LifecyclePhase.Eventually);
|
||||
workbenchRegistry.registerWorkbenchContribution(ConfigureRecommendedExtensionsCommandsContributor, LifecyclePhase.Eventually);
|
||||
workbenchRegistry.registerWorkbenchContribution(KeymapExtensions, LifecyclePhase.Restored);
|
||||
workbenchRegistry.registerWorkbenchContribution(ExtensionsViewletViewsContribution, LifecyclePhase.Starting);
|
||||
workbenchRegistry.registerWorkbenchContribution(ExtensionActivationProgress, LifecyclePhase.Eventually);
|
||||
workbenchRegistry.registerWorkbenchContribution(ExtensionDependencyChecker, LifecyclePhase.Eventually);
|
||||
@@ -16,7 +16,8 @@ import { dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewlet, AutoUpdateConfigurationKey, IExtensionContainer, EXTENSIONS_CONFIG, ExtensionsPolicy, ExtensionsPolicyKey } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { ExtensionsConfigurationInitialContent } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate';
|
||||
import { IExtensionEnablementService, IExtensionTipsService, EnablementState, ExtensionsLabel, IExtensionRecommendation, IGalleryExtension, IExtensionsConfigContent, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension, IExtensionManagementServerService, IExtensionManagementServer } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionsLabel, IGalleryExtension, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionTipsService, IExtensionRecommendation, IExtensionsConfigContent } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ExtensionType, ExtensionIdentifier, IExtensionDescription, IExtensionManifest, isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -55,9 +56,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { IWorkbenchThemeService, COLOR_THEME_SETTING, ICON_THEME_SETTING, IFileIconTheme, IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
|
||||
import { isUIExtension } from 'vs/workbench/services/extensions/common/extensionsUtil';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IProductService } from 'vs/platform/product/common/product';
|
||||
@@ -166,10 +165,10 @@ export class InstallAction extends ExtensionAction {
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IExtensionService private readonly runtimeExtensionService: IExtensionService,
|
||||
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService,
|
||||
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@ILabelService private readonly labelService: ILabelService
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService
|
||||
) {
|
||||
super(`extensions.install`, InstallAction.INSTALL_LABEL, InstallAction.Class, false);
|
||||
this.update();
|
||||
@@ -197,12 +196,12 @@ export class InstallAction extends ExtensionAction {
|
||||
this.label = InstallAction.INSTALLING_LABEL;
|
||||
this.tooltip = InstallAction.INSTALLING_LABEL;
|
||||
} else {
|
||||
if (this._manifest && this.workbenchEnvironmentService.configuration.remoteAuthority) {
|
||||
if (this._manifest && this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
if (isUIExtension(this._manifest, this.productService, this.configurationService)) {
|
||||
this.label = `${InstallAction.INSTALL_LABEL} ${localize('locally', "Locally")}`;
|
||||
this.tooltip = `${InstallAction.INSTALL_LABEL} ${localize('locally', "Locally")}`;
|
||||
} else {
|
||||
const host = this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.workbenchEnvironmentService.configuration.remoteAuthority) || localize('remote', "Remote");
|
||||
const host = this.extensionManagementServerService.remoteExtensionManagementServer.label;
|
||||
this.label = `${InstallAction.INSTALL_LABEL} on ${host}`;
|
||||
this.tooltip = `${InstallAction.INSTALL_LABEL} on ${host}`;
|
||||
}
|
||||
@@ -298,7 +297,6 @@ export class RemoteInstallAction extends ExtensionAction {
|
||||
constructor(
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@@ -315,10 +313,9 @@ export class RemoteInstallAction extends ExtensionAction {
|
||||
this.tooltip = this.label;
|
||||
return;
|
||||
}
|
||||
const remoteAuthority = this.environmentService.configuration.remoteAuthority;
|
||||
if (remoteAuthority) {
|
||||
const host = this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.environmentService.configuration.remoteAuthority) || localize('remote', "Remote");
|
||||
this.label = `${RemoteInstallAction.INSTALL_LABEL} on ${host}`;
|
||||
const remoteServer = this.extensionManagementServerService.remoteExtensionManagementServer;
|
||||
if (remoteServer) {
|
||||
this.label = `${RemoteInstallAction.INSTALL_LABEL} on ${remoteServer.label}`;
|
||||
this.tooltip = this.label;
|
||||
return;
|
||||
}
|
||||
@@ -333,7 +330,7 @@ export class RemoteInstallAction extends ExtensionAction {
|
||||
this.updateLabel();
|
||||
return;
|
||||
}
|
||||
if (this.environmentService.configuration.remoteAuthority
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer
|
||||
// Installed User Extension
|
||||
&& this.extension && this.extension.local && this.extension.type === ExtensionType.User && this.extension.state === ExtensionState.Installed
|
||||
// Local Workspace Extension
|
||||
@@ -377,7 +374,6 @@ export class LocalInstallAction extends ExtensionAction {
|
||||
constructor(
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@@ -407,7 +403,7 @@ export class LocalInstallAction extends ExtensionAction {
|
||||
this.updateLabel();
|
||||
return;
|
||||
}
|
||||
if (this.environmentService.configuration.remoteAuthority
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer
|
||||
// Installed User Extension
|
||||
&& this.extension && this.extension.local && this.extension.type === ExtensionType.User && this.extension.state === ExtensionState.Installed
|
||||
// Remote UI or Language pack Extension
|
||||
@@ -423,7 +419,7 @@ export class LocalInstallAction extends ExtensionAction {
|
||||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
if (!this.installing) {
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer && !this.installing) {
|
||||
this.installing = true;
|
||||
this.update();
|
||||
this.extensionsWorkbenchService.open(this.extension);
|
||||
@@ -918,13 +914,15 @@ export class EnableForWorkspaceAction extends ExtensionAction {
|
||||
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
if (this.extension) {
|
||||
this.enabled = this.extension.state === ExtensionState.Installed && (this.extension.enablementState === EnablementState.Disabled || this.extension.enablementState === EnablementState.WorkspaceDisabled) && !!this.extension.local && this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
if (this.extension && this.extension.local) {
|
||||
this.enabled = this.extension.state === ExtensionState.Installed
|
||||
&& !this.extensionEnablementService.isEnabled(this.extension.local)
|
||||
&& this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.WorkspaceEnabled);
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.EnabledWorkspace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -944,12 +942,14 @@ export class EnableGloballyAction extends ExtensionAction {
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
if (this.extension && this.extension.local) {
|
||||
this.enabled = this.extension.state === ExtensionState.Installed && this.extension.enablementState === EnablementState.Disabled && this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
this.enabled = this.extension.state === ExtensionState.Installed
|
||||
&& this.extension.enablementState === EnablementState.DisabledGlobally
|
||||
&& this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.Enabled);
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.EnabledGlobally);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,13 +969,15 @@ export class DisableForWorkspaceAction extends ExtensionAction {
|
||||
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
if (this.extension && this.runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier) && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY)) {
|
||||
this.enabled = this.extension.state === ExtensionState.Installed && (this.extension.enablementState === EnablementState.Enabled || this.extension.enablementState === EnablementState.WorkspaceEnabled) && !!this.extension.local && this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
if (this.extension && this.extension.local && this.runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier) && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY)) {
|
||||
this.enabled = this.extension.state === ExtensionState.Installed
|
||||
&& (this.extension.enablementState === EnablementState.EnabledGlobally || this.extension.enablementState === EnablementState.EnabledWorkspace)
|
||||
&& this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.WorkspaceDisabled);
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.DisabledWorkspace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -994,13 +996,15 @@ export class DisableGloballyAction extends ExtensionAction {
|
||||
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
if (this.extension && this.runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier))) {
|
||||
this.enabled = this.extension.state === ExtensionState.Installed && (this.extension.enablementState === EnablementState.Enabled || this.extension.enablementState === EnablementState.WorkspaceEnabled) && !!this.extension.local && this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
if (this.extension && this.extension.local && this.runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier))) {
|
||||
this.enabled = this.extension.state === ExtensionState.Installed
|
||||
&& (this.extension.enablementState === EnablementState.EnabledGlobally || this.extension.enablementState === EnablementState.EnabledWorkspace)
|
||||
&& this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.Disabled);
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.DisabledGlobally);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1082,6 +1086,7 @@ export class CheckForUpdatesAction extends Action {
|
||||
id = CheckForUpdatesAction.ID,
|
||||
label = CheckForUpdatesAction.LABEL,
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService,
|
||||
@IViewletService private readonly viewletService: IViewletService,
|
||||
@INotificationService private readonly notificationService: INotificationService
|
||||
) {
|
||||
@@ -1097,7 +1102,7 @@ export class CheckForUpdatesAction extends Action {
|
||||
|
||||
let msgAvailableExtensions = outdated.length === 1 ? localize('singleUpdateAvailable', "An extension update is available.") : localize('updatesAvailable', "{0} extension updates are available.", outdated.length);
|
||||
|
||||
const disabledExtensionsCount = outdated.filter(ext => ext.enablementState === EnablementState.Disabled || ext.enablementState === EnablementState.WorkspaceDisabled).length;
|
||||
const disabledExtensionsCount = outdated.filter(ext => ext.local && !this.extensionEnablementService.isEnabled(ext.local)).length;
|
||||
if (disabledExtensionsCount) {
|
||||
if (outdated.length === 1) {
|
||||
msgAvailableExtensions = localize('singleDisabledUpdateAvailable', "An update to an extension which is disabled is available.");
|
||||
@@ -1227,7 +1232,6 @@ export class ReloadAction extends ExtensionAction {
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
) {
|
||||
@@ -1312,7 +1316,7 @@ export class ReloadAction extends ExtensionAction {
|
||||
this.tooltip = localize('postEnableTooltip', "Please reload Azure Data Studio to enable this extension."); // {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
return;
|
||||
}
|
||||
if (this.workbenchEnvironmentService.configuration.remoteAuthority) {
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
const uiExtension = isUIExtension(this.extension.local.manifest, this.productService, this.configurationService);
|
||||
// Local Workspace Extension
|
||||
if (!uiExtension && this.extension.server === this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
@@ -1741,8 +1745,10 @@ export class InstallWorkspaceRecommendedExtensionsAction extends Action {
|
||||
try {
|
||||
if (extension.local && extension.gallery) {
|
||||
if (isUIExtension(extension.local.manifest, this.productService, this.configurationService)) {
|
||||
await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.installFromGallery(extension.gallery);
|
||||
return;
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.installFromGallery(extension.gallery);
|
||||
return;
|
||||
}
|
||||
} else if (this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromGallery(extension.gallery);
|
||||
return;
|
||||
@@ -2547,8 +2553,8 @@ export class StatusLabelAction extends Action implements IExtensionContainer {
|
||||
}
|
||||
|
||||
if (currentEnablementState !== null) {
|
||||
const currentlyEnabled = currentEnablementState === EnablementState.Enabled || currentEnablementState === EnablementState.WorkspaceEnabled;
|
||||
const enabled = this.enablementState === EnablementState.Enabled || this.enablementState === EnablementState.WorkspaceEnabled;
|
||||
const currentlyEnabled = currentEnablementState === EnablementState.EnabledGlobally || currentEnablementState === EnablementState.EnabledWorkspace;
|
||||
const enabled = this.enablementState === EnablementState.EnabledGlobally || this.enablementState === EnablementState.EnabledWorkspace;
|
||||
if (!currentlyEnabled && enabled) {
|
||||
return canAddExtension() ? localize('enabled', "Enabled") : null;
|
||||
}
|
||||
@@ -2654,7 +2660,6 @@ export class SystemDisabledWarningAction extends ExtensionAction {
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
) {
|
||||
@@ -2677,8 +2682,7 @@ export class SystemDisabledWarningAction extends ExtensionAction {
|
||||
!this.extension.local ||
|
||||
!this.extension.server ||
|
||||
!this._runningExtensions ||
|
||||
!this.workbenchEnvironmentService.configuration.remoteAuthority ||
|
||||
!this.extensionManagementServerService.remoteExtensionManagementServer ||
|
||||
!(this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) ||
|
||||
this.extension.state !== ExtensionState.Installed
|
||||
) {
|
||||
return;
|
||||
@@ -2687,7 +2691,7 @@ export class SystemDisabledWarningAction extends ExtensionAction {
|
||||
if (!this.extensionsWorkbenchService.installed.some(e => areSameExtensions(e.identifier, this.extension.identifier) && e.server !== this.extension.server)) {
|
||||
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
|
||||
this.tooltip = this.extension.server === this.extensionManagementServerService.localExtensionManagementServer
|
||||
? localize('Install language pack also in remote server', "Install the language pack extension on '{0}' to enable it also there.", this.getServerLabel(this.extensionManagementServerService.remoteExtensionManagementServer))
|
||||
? localize('Install language pack also in remote server', "Install the language pack extension on '{0}' to enable it also there.", this.extensionManagementServerService.remoteExtensionManagementServer.label)
|
||||
: localize('Install language pack also locally', "Install the language pack extension locally to enable it also there.");
|
||||
}
|
||||
return;
|
||||
@@ -2699,19 +2703,19 @@ export class SystemDisabledWarningAction extends ExtensionAction {
|
||||
if (this.extension.server === this.extensionManagementServerService.localExtensionManagementServer && !isUIExtension(this.extension.local.manifest, this.productService, this.configurationService)) {
|
||||
if (runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
|
||||
this.tooltip = localize('disabled locally', "Extension is enabled on '{0}' and disabled locally.", this.getServerLabel(this.extensionManagementServerService.remoteExtensionManagementServer));
|
||||
this.tooltip = localize('disabled locally', "Extension is enabled on '{0}' and disabled locally.", this.extensionManagementServerService.remoteExtensionManagementServer.label);
|
||||
return;
|
||||
}
|
||||
if (localExtensionServer !== this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
this.class = `${SystemDisabledWarningAction.WARNING_CLASS}`;
|
||||
this.tooltip = localize('Install in remote server', "Install the extension on '{0}' to enable.", this.getServerLabel(this.extensionManagementServerService.remoteExtensionManagementServer));
|
||||
this.tooltip = localize('Install in remote server', "Install the extension on '{0}' to enable.", this.extensionManagementServerService.remoteExtensionManagementServer.label);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this.extension.server === this.extensionManagementServerService.remoteExtensionManagementServer && isUIExtension(this.extension.local.manifest, this.productService, this.configurationService)) {
|
||||
if (runningExtensionServer === this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
|
||||
this.tooltip = localize('disabled remotely', "Extension is enabled locally and disabled on '{0}'.", this.getServerLabel(this.extensionManagementServerService.remoteExtensionManagementServer));
|
||||
this.tooltip = localize('disabled remotely', "Extension is enabled locally and disabled on '{0}'.", this.extensionManagementServerService.remoteExtensionManagementServer.label);
|
||||
return;
|
||||
}
|
||||
if (localExtensionServer !== this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
@@ -2722,12 +2726,6 @@ export class SystemDisabledWarningAction extends ExtensionAction {
|
||||
}
|
||||
}
|
||||
|
||||
private getServerLabel(server: IExtensionManagementServer): string {
|
||||
if (server === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
return this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.workbenchEnvironmentService.configuration.remoteAuthority) || localize('remote', "Remote");
|
||||
}
|
||||
return server.label;
|
||||
}
|
||||
run(): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
@@ -2750,11 +2748,11 @@ export class DisableAllAction extends Action {
|
||||
}
|
||||
|
||||
private update(): void {
|
||||
this.enabled = this.extensionsWorkbenchService.local.some(e => e.type === ExtensionType.User && (e.enablementState === EnablementState.Enabled || e.enablementState === EnablementState.WorkspaceEnabled) && !!e.local && this.extensionEnablementService.canChangeEnablement(e.local));
|
||||
this.enabled = this.extensionsWorkbenchService.local.some(e => e.type === ExtensionType.User && !!e.local && this.extensionEnablementService.isEnabled(e.local) && this.extensionEnablementService.canChangeEnablement(e.local));
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extensionsWorkbenchService.local.filter(e => e.type === ExtensionType.User), EnablementState.Disabled);
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extensionsWorkbenchService.local.filter(e => e.type === ExtensionType.User), EnablementState.DisabledGlobally);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2767,7 +2765,8 @@ export class DisableAllWorkpsaceAction extends Action {
|
||||
constructor(
|
||||
id: string = DisableAllWorkpsaceAction.ID, label: string = DisableAllWorkpsaceAction.LABEL,
|
||||
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService
|
||||
) {
|
||||
super(id, label);
|
||||
this.update();
|
||||
@@ -2776,11 +2775,11 @@ export class DisableAllWorkpsaceAction extends Action {
|
||||
}
|
||||
|
||||
private update(): void {
|
||||
this.enabled = this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.extensionsWorkbenchService.local.some(e => e.type === ExtensionType.User && (e.enablementState === EnablementState.Enabled || e.enablementState === EnablementState.WorkspaceEnabled));
|
||||
this.enabled = this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.extensionsWorkbenchService.local.some(e => e.type === ExtensionType.User && !!e.local && this.extensionEnablementService.isEnabled(e.local) && this.extensionEnablementService.canChangeEnablement(e.local));
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extensionsWorkbenchService.local.filter(e => e.type === ExtensionType.User), EnablementState.WorkspaceDisabled);
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extensionsWorkbenchService.local.filter(e => e.type === ExtensionType.User), EnablementState.DisabledWorkspace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2801,11 +2800,11 @@ export class EnableAllAction extends Action {
|
||||
}
|
||||
|
||||
private update(): void {
|
||||
this.enabled = this.extensionsWorkbenchService.local.some(e => !!e.local && this.extensionEnablementService.canChangeEnablement(e.local) && (e.enablementState === EnablementState.Disabled || e.enablementState === EnablementState.WorkspaceDisabled));
|
||||
this.enabled = this.extensionsWorkbenchService.local.some(e => !!e.local && this.extensionEnablementService.canChangeEnablement(e.local) && !this.extensionEnablementService.isEnabled(e.local));
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extensionsWorkbenchService.local, EnablementState.Enabled);
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extensionsWorkbenchService.local, EnablementState.EnabledGlobally);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2828,11 +2827,11 @@ export class EnableAllWorkpsaceAction extends Action {
|
||||
}
|
||||
|
||||
private update(): void {
|
||||
this.enabled = this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.extensionsWorkbenchService.local.some(e => !!e.local && this.extensionEnablementService.canChangeEnablement(e.local) && (e.enablementState === EnablementState.Disabled || e.enablementState === EnablementState.WorkspaceDisabled));
|
||||
this.enabled = this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.extensionsWorkbenchService.local.some(e => !!e.local && this.extensionEnablementService.canChangeEnablement(e.local) && !this.extensionEnablementService.isEnabled(e.local));
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extensionsWorkbenchService.local, EnablementState.WorkspaceEnabled);
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extensionsWorkbenchService.local, EnablementState.EnabledWorkspace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2852,18 +2851,22 @@ export class OpenExtensionsFolderAction extends Action {
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
const extensionsHome = URI.file(this.environmentService.extensionsPath);
|
||||
if (this.environmentService.extensionsPath) {
|
||||
|
||||
return Promise.resolve(this.fileService.resolve(extensionsHome)).then(file => {
|
||||
let itemToShow: URI;
|
||||
if (file.children && file.children.length > 0) {
|
||||
itemToShow = file.children[0].resource;
|
||||
} else {
|
||||
itemToShow = extensionsHome;
|
||||
}
|
||||
const extensionsHome = URI.file(this.environmentService.extensionsPath);
|
||||
|
||||
return this.windowsService.showItemInFolder(itemToShow);
|
||||
});
|
||||
return Promise.resolve(this.fileService.resolve(extensionsHome)).then(file => {
|
||||
let itemToShow: URI;
|
||||
if (file.children && file.children.length > 0) {
|
||||
itemToShow = file.children[0].resource;
|
||||
} else {
|
||||
itemToShow = extensionsHome;
|
||||
}
|
||||
|
||||
return this.windowsService.showItemInFolder(itemToShow);
|
||||
});
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2909,7 +2912,7 @@ export class InstallVSIXAction extends Action {
|
||||
{
|
||||
label: localize('thirdPartExt.yes', 'Yes'),
|
||||
run: () => {
|
||||
this.extensionsWorkbenchService.install(vsix).then(extension => {
|
||||
this.extensionsWorkbenchService.install(URI.file(vsix)).then(extension => {
|
||||
const requireReload = !(extension.local && this.extensionService.canAddExtension(toExtensionDescription(extension.local)));
|
||||
const message = requireReload ? localize('InstallVSIXAction.successReload', "Please reload Azure Data Studio to complete installing the extension {0}.", extension.identifier.id)
|
||||
: localize('InstallVSIXAction.success', "Completed installing the extension {0}.", extension.identifier.id);
|
||||
@@ -2942,7 +2945,7 @@ export class InstallVSIXAction extends Action {
|
||||
{ sticky: true }
|
||||
);
|
||||
} else {
|
||||
this.extensionsWorkbenchService.install(vsix).then(extension => {
|
||||
this.extensionsWorkbenchService.install(URI.file(vsix)).then(extension => {
|
||||
const requireReload = !(extension.local && this.extensionService.canAddExtension(toExtensionDescription(extension.local)));
|
||||
const message = requireReload ? localize('InstallVSIXAction.successReload', "Please reload Azure Data Studio to complete installing the extension {0}.", extension.identifier.id)
|
||||
: localize('InstallVSIXAction.success', "Completed installing the extension {0}.", extension.identifier.id);
|
||||
@@ -3048,7 +3051,8 @@ export class InstallSpecificVersionOfExtensionAction extends Action {
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IWindowService private readonly windowService: IWindowService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService,
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
@@ -3070,7 +3074,7 @@ export class InstallSpecificVersionOfExtensionAction extends Action {
|
||||
}
|
||||
|
||||
private isEnabled(extension: IExtension): boolean {
|
||||
return !!extension.gallery && (extension.enablementState === EnablementState.Enabled || extension.enablementState === EnablementState.WorkspaceEnabled);
|
||||
return !!extension.gallery && !!extension.local && this.extensionEnablementService.isEnabled(extension.local);
|
||||
}
|
||||
|
||||
private async getExtensionEntries(): Promise<(IQuickPickItem & { extension: IExtension, versions: IGalleryExtensionVersion[] })[]> {
|
||||
|
||||
@@ -17,7 +17,7 @@ import { InstallAction, UpdateAction, ManageExtensionAction, ReloadAction, Malic
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { Label, RatingsWidget, InstallCountWidget, RecommendationWidget, RemoteBadgeWidget, TooltipWidget } from 'vs/workbench/contrib/extensions/browser/extensionsWidgets';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IExtensionManagementServerService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ import {
|
||||
ShowOutdatedExtensionsAction, ClearExtensionsInputAction, ChangeSortAction, UpdateAllAction, CheckForUpdatesAction, DisableAllAction, EnableAllAction,
|
||||
EnableAutoUpdateAction, DisableAutoUpdateAction, ShowBuiltInExtensionsAction, InstallVSIXAction
|
||||
} from 'vs/workbench/contrib/extensions/browser/extensionsActions';
|
||||
import { IExtensionManagementService, IExtensionManagementServerService, IExtensionManagementServer, IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, IExtensionManagementServerService, IExtensionManagementServer } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionsInput } from 'vs/workbench/contrib/extensions/common/extensionsInput';
|
||||
import { ExtensionsListView, EnabledExtensionsView, DisabledExtensionsView, RecommendedExtensionsView, WorkspaceRecommendedExtensionsView, BuiltInExtensionsView, BuiltInThemesExtensionsView, BuiltInBasicsExtensionsView, ServerExtensionsView, DefaultRecommendedExtensionsView } from 'vs/workbench/contrib/extensions/browser/extensionsViews';
|
||||
import { OpenGlobalSettingsAction } from 'vs/workbench/contrib/preferences/browser/preferencesActions';
|
||||
@@ -55,8 +56,6 @@ import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { RemoteAuthorityContext } from 'vs/workbench/browser/contextkeys';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { MementoObject } from 'vs/workbench/common/memento';
|
||||
|
||||
@@ -97,7 +96,6 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
constructor(
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService
|
||||
) {
|
||||
this.registerViews();
|
||||
}
|
||||
@@ -118,7 +116,9 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
viewDescriptors.push(this.createOtherRecommendedExtensionsListViewDescriptor());
|
||||
viewDescriptors.push(this.createWorkspaceRecommendedExtensionsListViewDescriptor());
|
||||
|
||||
viewDescriptors.push(...this.createExtensionsViewDescriptorsForServer(this.extensionManagementServerService.localExtensionManagementServer));
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
viewDescriptors.push(...this.createExtensionsViewDescriptorsForServer(this.extensionManagementServerService.localExtensionManagementServer));
|
||||
}
|
||||
if (this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
viewDescriptors.push(...this.createExtensionsViewDescriptorsForServer(this.extensionManagementServerService.remoteExtensionManagementServer));
|
||||
}
|
||||
@@ -187,15 +187,15 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
|
||||
private createExtensionsViewDescriptorsForServer(server: IExtensionManagementServer): IViewDescriptor[] {
|
||||
const getViewName = (viewTitle: string, server: IExtensionManagementServer): string => {
|
||||
const serverLabel = this.workbenchEnvironmentService.configuration.remoteAuthority === server.authority ? this.labelService.getHostLabel(REMOTE_HOST_SCHEME, server.authority) || server.label : server.label;
|
||||
if (viewTitle && this.workbenchEnvironmentService.configuration.remoteAuthority) {
|
||||
const serverLabel = server.label;
|
||||
if (viewTitle && this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
return `${serverLabel} - ${viewTitle}`;
|
||||
}
|
||||
return viewTitle ? viewTitle : serverLabel;
|
||||
};
|
||||
const getInstalledViewName = (): string => getViewName(localize('installed', "Installed"), server);
|
||||
const getOutdatedViewName = (): string => getViewName(localize('outdated', "Outdated"), server);
|
||||
const onDidChangeServerLabel: EventOf<void> = this.workbenchEnvironmentService.configuration.remoteAuthority ? EventOf.map(this.labelService.onDidChangeFormatters, () => undefined) : EventOf.None;
|
||||
const onDidChangeServerLabel: EventOf<void> = EventOf.map(this.labelService.onDidChangeFormatters, () => undefined);
|
||||
return [{
|
||||
id: `extensions.${server.authority}.installed`,
|
||||
get name() { return getInstalledViewName(); },
|
||||
|
||||
@@ -9,7 +9,8 @@ import { assign } from 'vs/base/common/objects';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { isPromiseCanceledError, getErrorMessage } from 'vs/base/common/errors';
|
||||
import { PagedModel, IPagedModel, IPager, DelayedPagedModel } from 'vs/base/common/paging';
|
||||
import { SortBy, SortOrder, IQueryOptions, IExtensionTipsService, IExtensionRecommendation, IExtensionManagementServer, IExtensionManagementServerService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { SortBy, SortOrder, IQueryOptions } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementServer, IExtensionManagementServerService, IExtensionTipsService, IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
|
||||
@@ -9,13 +9,11 @@ import { IExtension, IExtensionsWorkbenchService, IExtensionContainer, Extension
|
||||
import { append, $, addClass } from 'vs/base/browser/dom';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IExtensionManagementServerService, IExtensionTipsService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionTipsService, IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { extensionButtonProminentBackground, extensionButtonProminentForeground, DisabledLabelAction, ReloadAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions';
|
||||
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { EXTENSION_BADGE_REMOTE_BACKGROUND, EXTENSION_BADGE_REMOTE_FOREGROUND } from 'vs/workbench/common/theme';
|
||||
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -151,8 +149,7 @@ export class TooltipWidget extends ExtensionWidget {
|
||||
private readonly recommendationWidget: RecommendationWidget,
|
||||
private readonly reloadAction: ReloadAction,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService
|
||||
@ILabelService private readonly labelService: ILabelService
|
||||
) {
|
||||
super();
|
||||
this._register(Event.any<any>(
|
||||
@@ -184,7 +181,7 @@ export class TooltipWidget extends ExtensionWidget {
|
||||
}
|
||||
if (this.extension.local && this.extension.state === ExtensionState.Installed) {
|
||||
if (this.extension.server === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
return localize('extension enabled on remote', "Extension is enabled on '{0}'", this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.workbenchEnvironmentService.configuration.remoteAuthority));
|
||||
return localize('extension enabled on remote', "Extension is enabled on '{0}'", this.extension.server.label);
|
||||
}
|
||||
return localize('extension enabled locally', "Extension is enabled locally.");
|
||||
}
|
||||
@@ -281,13 +278,11 @@ export class RemoteBadgeWidget extends ExtensionWidget {
|
||||
|
||||
render(): void {
|
||||
this.clear();
|
||||
if (!this.extension || !this.extension.local || !this.extension.server) {
|
||||
if (!this.extension || !this.extension.local || !this.extension.server || !(this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) || this.extension.server !== this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
return;
|
||||
}
|
||||
if (this.extension.server === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
this.remoteBadge.value = this.instantiationService.createInstance(RemoteBadge, this.tooltip);
|
||||
append(this.element, this.remoteBadge.value.element);
|
||||
}
|
||||
this.remoteBadge.value = this.instantiationService.createInstance(RemoteBadge, this.tooltip);
|
||||
append(this.element, this.remoteBadge.value.element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +294,7 @@ class RemoteBadge extends Disposable {
|
||||
private readonly tooltip: boolean,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IThemeService private readonly themeService: IThemeService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService
|
||||
) {
|
||||
super();
|
||||
this.element = $('div.extension-remote-badge');
|
||||
@@ -323,8 +318,8 @@ class RemoteBadge extends Disposable {
|
||||
|
||||
if (this.tooltip) {
|
||||
const updateTitle = () => {
|
||||
if (this.element) {
|
||||
this.element.title = localize('remote extension title', "Extension in {0}", this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.environmentService.configuration.remoteAuthority));
|
||||
if (this.element && this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
this.element.title = localize('remote extension title', "Extension in {0}", this.extensionManagementServerService.remoteExtensionManagementServer.label);
|
||||
}
|
||||
};
|
||||
this._register(this.labelService.onDidChangeFormatters(() => updateTitle()));
|
||||
|
||||
+57
-37
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import * as semver from 'semver';
|
||||
import * as semver from 'semver-umd';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { index, distinct } from 'vs/base/common/arrays';
|
||||
import { ThrottledDelayer } from 'vs/base/common/async';
|
||||
@@ -15,8 +15,9 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
// {{SQL CARBON EDIT}}
|
||||
import {
|
||||
IExtensionManagementService, IExtensionGalleryService, ILocalExtension, IGalleryExtension, IQueryOptions,
|
||||
InstallExtensionEvent, DidInstallExtensionEvent, DidUninstallExtensionEvent, IExtensionEnablementService, IExtensionIdentifier, EnablementState, IExtensionManagementServerService, IExtensionManagementServer, INSTALL_ERROR_INCOMPATIBLE
|
||||
InstallExtensionEvent, DidInstallExtensionEvent, DidUninstallExtensionEvent, IExtensionIdentifier, INSTALL_ERROR_INCOMPATIBLE
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionManagementServer } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData, areSameExtensions, getMaliciousExtensionsSet, groupByExtension, ExtensionIdentifierWithVersion } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
@@ -36,6 +37,7 @@ import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IExtensionManifest, ExtensionType, IExtension as IPlatformExtension, isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IProductService } from 'vs/platform/product/common/product';
|
||||
import { asDomUri } from 'vs/base/browser/dom';
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { ExtensionManagementError } from 'vs/platform/extensionManagement/node/extensionManagementService';
|
||||
@@ -48,7 +50,7 @@ interface IExtensionStateProvider<T> {
|
||||
|
||||
class Extension implements IExtension {
|
||||
|
||||
public enablementState: EnablementState = EnablementState.Enabled;
|
||||
public enablementState: EnablementState = EnablementState.EnabledGlobally;
|
||||
|
||||
constructor(
|
||||
private stateProvider: IExtensionStateProvider<ExtensionState>,
|
||||
@@ -145,7 +147,7 @@ class Extension implements IExtension {
|
||||
|
||||
private get localIconUrl(): string | null {
|
||||
if (this.local && this.local.manifest.icon) {
|
||||
return resources.joinPath(this.local.location, this.local.manifest.icon).toString();
|
||||
return asDomUri(resources.joinPath(this.local.location, this.local.manifest.icon)).toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -162,14 +164,14 @@ class Extension implements IExtension {
|
||||
if (this.type === ExtensionType.System && this.local) {
|
||||
if (this.local.manifest && this.local.manifest.contributes) {
|
||||
if (Array.isArray(this.local.manifest.contributes.themes) && this.local.manifest.contributes.themes.length) {
|
||||
return require.toUrl('../browser/media/theme-icon.png');
|
||||
return require.toUrl('./media/theme-icon.png');
|
||||
}
|
||||
if (Array.isArray(this.local.manifest.contributes.grammars) && this.local.manifest.contributes.grammars.length) {
|
||||
return require.toUrl('../browser/media/language-icon.svg');
|
||||
return require.toUrl('./media/language-icon.svg');
|
||||
}
|
||||
}
|
||||
}
|
||||
return require.toUrl('../browser/media/defaultIcon.png');
|
||||
return require.toUrl('./media/defaultIcon.png');
|
||||
}
|
||||
|
||||
get repository(): string | undefined {
|
||||
@@ -490,8 +492,8 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
private static readonly SyncPeriod = 1000 * 60 * 60 * 12; // 12 hours
|
||||
_serviceBrand: any;
|
||||
|
||||
private readonly localExtensions: Extensions;
|
||||
private readonly remoteExtensions: Extensions | null;
|
||||
private readonly localExtensions: Extensions | null = null;
|
||||
private readonly remoteExtensions: Extensions | null = null;
|
||||
private syncDelayer: ThrottledDelayer<void>;
|
||||
private autoUpdateDelayer: ThrottledDelayer<void>;
|
||||
|
||||
@@ -519,13 +521,13 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
@IProductService private readonly productService: IProductService
|
||||
) {
|
||||
super();
|
||||
this.localExtensions = this._register(instantiationService.createInstance(Extensions, extensionManagementServerService.localExtensionManagementServer, ext => this.getExtensionState(ext)));
|
||||
this._register(this.localExtensions.onChange(e => this._onChange.fire(e)));
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
this.localExtensions = this._register(instantiationService.createInstance(Extensions, extensionManagementServerService.localExtensionManagementServer, ext => this.getExtensionState(ext)));
|
||||
this._register(this.localExtensions.onChange(e => this._onChange.fire(e)));
|
||||
}
|
||||
if (this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
this.remoteExtensions = this._register(instantiationService.createInstance(Extensions, extensionManagementServerService.remoteExtensionManagementServer, ext => this.getExtensionState(ext)));
|
||||
this._register(this.remoteExtensions.onChange(e => this._onChange.fire(e)));
|
||||
} else {
|
||||
this.remoteExtensions = null;
|
||||
}
|
||||
|
||||
this.syncDelayer = new ThrottledDelayer<void>(ExtensionsWorkbenchService.SyncPeriod);
|
||||
@@ -560,7 +562,10 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
}
|
||||
|
||||
get installed(): IExtension[] {
|
||||
const result = [...this.localExtensions.local];
|
||||
const result = [];
|
||||
if (this.localExtensions) {
|
||||
result.push(...this.localExtensions.local);
|
||||
}
|
||||
if (this.remoteExtensions) {
|
||||
result.push(...this.remoteExtensions.local);
|
||||
}
|
||||
@@ -568,7 +573,10 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
}
|
||||
|
||||
get outdated(): IExtension[] {
|
||||
const allLocal = [...this.localExtensions.local];
|
||||
const allLocal = [];
|
||||
if (this.localExtensions) {
|
||||
allLocal.push(...this.localExtensions.local);
|
||||
}
|
||||
if (this.remoteExtensions) {
|
||||
allLocal.push(...this.remoteExtensions.local);
|
||||
}
|
||||
@@ -577,7 +585,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
|
||||
async queryLocal(server?: IExtensionManagementServer): Promise<IExtension[]> {
|
||||
if (server) {
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer === server) {
|
||||
if (this.localExtensions && this.extensionManagementServerService.localExtensionManagementServer === server) {
|
||||
return this.localExtensions.queryInstalled();
|
||||
}
|
||||
if (this.remoteExtensions && this.extensionManagementServerService.remoteExtensionManagementServer === server) {
|
||||
@@ -585,12 +593,12 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
}
|
||||
}
|
||||
|
||||
await this.localExtensions.queryInstalled();
|
||||
if (this.remoteExtensions) {
|
||||
await Promise.all([this.localExtensions.queryInstalled(), this.remoteExtensions.queryInstalled()]);
|
||||
} else {
|
||||
if (this.localExtensions) {
|
||||
await this.localExtensions.queryInstalled();
|
||||
}
|
||||
if (this.remoteExtensions) {
|
||||
await this.remoteExtensions.queryInstalled();
|
||||
}
|
||||
return this.local;
|
||||
}
|
||||
|
||||
@@ -654,7 +662,10 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
}
|
||||
|
||||
private fromGallery(gallery: IGalleryExtension, maliciousExtensionSet: Set<string>): IExtension {
|
||||
Promise.all([this.localExtensions.syncLocalWithGalleryExtension(gallery, maliciousExtensionSet), this.remoteExtensions ? this.remoteExtensions.syncLocalWithGalleryExtension(gallery, maliciousExtensionSet) : Promise.resolve(false)])
|
||||
Promise.all([
|
||||
this.localExtensions ? this.localExtensions.syncLocalWithGalleryExtension(gallery, maliciousExtensionSet) : Promise.resolve(false),
|
||||
this.remoteExtensions ? this.remoteExtensions.syncLocalWithGalleryExtension(gallery, maliciousExtensionSet) : Promise.resolve(false)
|
||||
])
|
||||
.then(result => {
|
||||
if (result[0] || result[1]) {
|
||||
this.eventuallyAutoUpdateExtensions();
|
||||
@@ -690,7 +701,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
private getExtensionState(extension: Extension): ExtensionState {
|
||||
const isInstalling = this.installing.some(i => areSameExtensions(i.identifier, extension.identifier));
|
||||
if (extension.server) {
|
||||
const state = (extension.server === this.extensionManagementServerService.localExtensionManagementServer ? this.localExtensions : this.remoteExtensions!).getExtensionState(extension);
|
||||
const state = (extension.server === this.extensionManagementServerService.localExtensionManagementServer ? this.localExtensions! : this.remoteExtensions!).getExtensionState(extension);
|
||||
return state === ExtensionState.Uninstalled && isInstalling ? ExtensionState.Installing : state;
|
||||
} else if (isInstalling) {
|
||||
return ExtensionState.Installing;
|
||||
@@ -701,7 +712,10 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
return state;
|
||||
}
|
||||
}
|
||||
return this.localExtensions.getExtensionState(extension);
|
||||
if (this.localExtensions) {
|
||||
return this.localExtensions.getExtensionState(extension);
|
||||
}
|
||||
return ExtensionState.Uninstalled;
|
||||
}
|
||||
|
||||
checkForUpdates(): Promise<void> {
|
||||
@@ -772,20 +786,26 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!(extension as Extension).gallery;
|
||||
if (!extension.gallery) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer || this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
install(extension: string | IExtension): Promise<IExtension> {
|
||||
// {{SQL CARBON EDIT}}
|
||||
let extensionPolicy = this.configurationService.getValue<string>(ExtensionsPolicyKey);
|
||||
|
||||
if (typeof extension === 'string') {
|
||||
install(extension: URI | IExtension): Promise<IExtension> {
|
||||
let extensionPolicy = this.configurationService.getValue<string>(ExtensionsPolicyKey); // {{SQL CARBON EDIT}} add line
|
||||
if (extension instanceof URI) {
|
||||
return this.installWithProgress(async () => {
|
||||
// {{SQL CARBON EDIT}} - Wrap async call in try/catch.
|
||||
// This is the error handler when installing local VSIX file.
|
||||
// Prompt the user about the error detail.
|
||||
try {
|
||||
const { identifier } = await this.extensionService.install(URI.file(extension));
|
||||
const { identifier } = await this.extensionService.install(extension);
|
||||
this.checkAndEnableDisabledDependencies(identifier);
|
||||
return this.local.filter(local => areSameExtensions(local.identifier, identifier))[0];
|
||||
} catch (error) {
|
||||
@@ -924,16 +944,16 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
private checkAndEnableDisabledDependencies(extensionIdentifier: IExtensionIdentifier): Promise<void> {
|
||||
const extension = this.local.filter(e => (e.local || e.gallery) && areSameExtensions(extensionIdentifier, e.identifier))[0];
|
||||
if (extension) {
|
||||
const disabledDepencies = this.getExtensionsRecursively([extension], this.local, EnablementState.Enabled, { dependencies: true, pack: false });
|
||||
const disabledDepencies = this.getExtensionsRecursively([extension], this.local, EnablementState.EnabledGlobally, { dependencies: true, pack: false });
|
||||
if (disabledDepencies.length) {
|
||||
return this.setEnablement(disabledDepencies, EnablementState.Enabled);
|
||||
return this.setEnablement(disabledDepencies, EnablementState.EnabledGlobally);
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
private promptAndSetEnablement(extensions: IExtension[], enablementState: EnablementState): Promise<any> {
|
||||
const enable = enablementState === EnablementState.Enabled || enablementState === EnablementState.WorkspaceEnabled;
|
||||
const enable = enablementState === EnablementState.EnabledGlobally || enablementState === EnablementState.EnabledWorkspace;
|
||||
if (enable) {
|
||||
const allDependenciesAndPackedExtensions = this.getExtensionsRecursively(extensions, this.local, enablementState, { dependencies: true, pack: true });
|
||||
return this.checkAndSetEnablement(extensions, allDependenciesAndPackedExtensions, enablementState);
|
||||
@@ -948,7 +968,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
|
||||
private checkAndSetEnablement(extensions: IExtension[], otherExtensions: IExtension[], enablementState: EnablementState): Promise<any> {
|
||||
const allExtensions = [...extensions, ...otherExtensions];
|
||||
const enable = enablementState === EnablementState.Enabled || enablementState === EnablementState.WorkspaceEnabled;
|
||||
const enable = enablementState === EnablementState.EnabledGlobally || enablementState === EnablementState.EnabledWorkspace;
|
||||
if (!enable) {
|
||||
for (const extension of extensions) {
|
||||
let dependents = this.getDependentsAfterDisablement(extension, allExtensions, this.local);
|
||||
@@ -973,7 +993,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
if (i.enablementState === enablementState) {
|
||||
return false;
|
||||
}
|
||||
const enable = enablementState === EnablementState.Enabled || enablementState === EnablementState.WorkspaceEnabled;
|
||||
const enable = enablementState === EnablementState.EnabledGlobally || enablementState === EnablementState.EnabledWorkspace;
|
||||
return (enable || i.type === ExtensionType.User) // Include all Extensions for enablement and only user extensions for disablement
|
||||
&& (options.dependencies || options.pack)
|
||||
&& extensions.some(extension =>
|
||||
@@ -997,7 +1017,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
if (i === extension) {
|
||||
return false;
|
||||
}
|
||||
if (i.enablementState === EnablementState.WorkspaceDisabled || i.enablementState === EnablementState.Disabled) {
|
||||
if (!(i.enablementState === EnablementState.EnabledWorkspace || i.enablementState === EnablementState.EnabledGlobally)) {
|
||||
return false;
|
||||
}
|
||||
if (extensionsToDisable.indexOf(i) !== -1) {
|
||||
@@ -1047,7 +1067,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
]
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog(enablementState === EnablementState.Enabled || enablementState === EnablementState.WorkspaceEnabled ? 'extension:enable' : 'extension:disable', extensions[i].telemetryData);
|
||||
this.telemetryService.publicLog(enablementState === EnablementState.EnabledGlobally || enablementState === EnablementState.EnabledWorkspace ? 'extension:enable' : 'extension:disable', extensions[i].telemetryData);
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
@@ -7,13 +7,15 @@ import { IViewlet } from 'vs/workbench/common/viewlet';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IPager } from 'vs/base/common/paging';
|
||||
import { IQueryOptions, EnablementState, ILocalExtension, IGalleryExtension, IExtensionIdentifier, IExtensionManagementServer } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IQueryOptions, ILocalExtension, IGalleryExtension, IExtensionIdentifier } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { EnablementState, IExtensionManagementServer } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { IExtensionManifest, ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export const VIEWLET_ID = 'workbench.view.extensions';
|
||||
export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID);
|
||||
@@ -83,7 +85,7 @@ export interface IExtensionsWorkbenchService {
|
||||
queryGallery(token: CancellationToken): Promise<IPager<IExtension>>;
|
||||
queryGallery(options: IQueryOptions, token: CancellationToken): Promise<IPager<IExtension>>;
|
||||
canInstall(extension: IExtension): boolean;
|
||||
install(vsix: string): Promise<IExtension>;
|
||||
install(vsix: URI): Promise<IExtension>;
|
||||
install(extension: IExtension, promptToInstallDependencies?: boolean): Promise<IExtension>;
|
||||
uninstall(extension: IExtension): Promise<void>;
|
||||
installVersion(extension: IExtension, version: string): Promise<IExtension>;
|
||||
|
||||
@@ -9,7 +9,8 @@ import { Event } from 'vs/base/common/event';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IExtensionManagementService, ILocalExtension, IExtensionEnablementService, IExtensionTipsService, IExtensionIdentifier, EnablementState, InstallOperation } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementService, ILocalExtension, IExtensionIdentifier, InstallOperation } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, EnablementState, IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -70,7 +71,7 @@ export class KeymapExtensions extends Disposable implements IWorkbenchContributi
|
||||
*/
|
||||
this.telemetryService.publicLog('disableOtherKeymaps', telemetryData);
|
||||
if (confirmed) {
|
||||
this.extensionEnablementService.setEnablement(oldKeymaps.map(keymap => keymap.local), EnablementState.Disabled);
|
||||
this.extensionEnablementService.setEnablement(oldKeymaps.map(keymap => keymap.local), EnablementState.DisabledGlobally);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -9,10 +9,8 @@ import { forEach } from 'vs/base/common/collections';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { match } from 'vs/base/common/glob';
|
||||
import * as json from 'vs/base/common/json';
|
||||
import {
|
||||
IExtensionManagementService, IExtensionGalleryService, IExtensionTipsService, ExtensionRecommendationReason, EXTENSION_IDENTIFIER_PATTERN,
|
||||
IExtensionsConfigContent, RecommendationChangeNotification, IExtensionRecommendation, ExtensionRecommendationSource, InstallOperation, ILocalExtension
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementService, IExtensionGalleryService, EXTENSION_IDENTIFIER_PATTERN, InstallOperation, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionTipsService, ExtensionRecommendationReason, IExtensionsConfigContent, RecommendationChangeNotification, IExtensionRecommendation, ExtensionRecommendationSource } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
|
||||
@@ -3,105 +3,33 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!../browser/media/extensions';
|
||||
import { localize } from 'vs/nls';
|
||||
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IExtensionTipsService, ExtensionsLabel, ExtensionsChannelId, PreferencesLabel, IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
|
||||
import { IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { ExtensionTipsService } from 'vs/workbench/contrib/extensions/electron-browser/extensionTipsService';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/contrib/output/common/output';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { VIEWLET_ID, IExtensionsWorkbenchService, ExtensionsPolicy } from '../common/extensions';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/node/extensionsWorkbenchService';
|
||||
import {
|
||||
OpenExtensionsViewletAction, InstallExtensionsAction, ShowOutdatedExtensionsAction, ShowRecommendedExtensionsAction, ShowRecommendedKeymapExtensionsAction, ShowPopularExtensionsAction,
|
||||
ShowEnabledExtensionsAction, ShowInstalledExtensionsAction, ShowDisabledExtensionsAction, ShowBuiltInExtensionsAction, UpdateAllAction,
|
||||
EnableAllAction, EnableAllWorkpsaceAction, DisableAllAction, DisableAllWorkpsaceAction, CheckForUpdatesAction, ShowLanguageExtensionsAction, ShowAzureExtensionsAction, EnableAutoUpdateAction, DisableAutoUpdateAction, ConfigureRecommendedExtensionsCommandsContributor, OpenExtensionsFolderAction, InstallVSIXAction, ReinstallAction, InstallSpecificVersionOfExtensionAction
|
||||
} from 'vs/workbench/contrib/extensions/browser/extensionsActions';
|
||||
import { ExtensionsInput } from 'vs/workbench/contrib/extensions/common/extensionsInput';
|
||||
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
import { ExtensionEditor } from 'vs/workbench/contrib/extensions/browser/extensionEditor';
|
||||
import { StatusUpdater, ExtensionsViewlet, MaliciousExtensionChecker, ExtensionsViewletViewsContribution } from 'vs/workbench/contrib/extensions/browser/extensionsViewlet';
|
||||
import { IQuickOpenRegistry, Extensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen';
|
||||
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import * as jsonContributionRegistry from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { ExtensionsConfigurationSchema, ExtensionsConfigurationSchemaId } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { KeymapExtensions } from 'vs/workbench/contrib/extensions/common/extensionsUtils';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { GalleryExtensionsHandler, ExtensionsHandler } from 'vs/workbench/contrib/extensions/browser/extensionsQuickOpen';
|
||||
import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { RuntimeExtensionsEditor, ShowRuntimeExtensionsAction, IExtensionHostProfileService, DebugExtensionHostAction, StartExtensionHostProfileAction, StopExtensionHostProfileAction, CONTEXT_PROFILE_SESSION_STATE, SaveExtensionHostProfileAction, CONTEXT_EXTENSION_HOST_PROFILE_RECORDED } from 'vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor';
|
||||
import { EditorInput, IEditorInputFactory, IEditorInputFactoryRegistry, Extensions as EditorInputExtensions, ActiveEditorContext } from 'vs/workbench/common/editor';
|
||||
import { ExtensionHostProfileService } from 'vs/workbench/contrib/extensions/electron-browser/extensionProfileService';
|
||||
import { RuntimeExtensionsInput } from 'vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsInput';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ExtensionActivationProgress } from 'vs/workbench/contrib/extensions/browser/extensionsActivationProgress';
|
||||
import { ExtensionsAutoProfiler } from 'vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ExtensionDependencyChecker } from 'vs/workbench/contrib/extensions/browser/extensionsDependencyChecker';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
// Singletons
|
||||
registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService);
|
||||
registerSingleton(IExtensionTipsService, ExtensionTipsService);
|
||||
registerSingleton(IExtensionHostProfileService, ExtensionHostProfileService, true);
|
||||
|
||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||
workbenchRegistry.registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Restored);
|
||||
workbenchRegistry.registerWorkbenchContribution(MaliciousExtensionChecker, LifecyclePhase.Eventually);
|
||||
workbenchRegistry.registerWorkbenchContribution(ConfigureRecommendedExtensionsCommandsContributor, LifecyclePhase.Eventually);
|
||||
workbenchRegistry.registerWorkbenchContribution(KeymapExtensions, LifecyclePhase.Restored);
|
||||
workbenchRegistry.registerWorkbenchContribution(ExtensionsViewletViewsContribution, LifecyclePhase.Starting);
|
||||
workbenchRegistry.registerWorkbenchContribution(ExtensionActivationProgress, LifecyclePhase.Eventually);
|
||||
workbenchRegistry.registerWorkbenchContribution(ExtensionsAutoProfiler, LifecyclePhase.Eventually);
|
||||
workbenchRegistry.registerWorkbenchContribution(ExtensionDependencyChecker, LifecyclePhase.Eventually);
|
||||
|
||||
Registry.as<IOutputChannelRegistry>(OutputExtensions.OutputChannels)
|
||||
.registerChannel({ id: ExtensionsChannelId, label: ExtensionsLabel, log: false });
|
||||
|
||||
// Quickopen
|
||||
Registry.as<IQuickOpenRegistry>(Extensions.Quickopen).registerQuickOpenHandler(
|
||||
new QuickOpenHandlerDescriptor(
|
||||
ExtensionsHandler,
|
||||
ExtensionsHandler.ID,
|
||||
'ext ',
|
||||
undefined,
|
||||
localize('extensionsCommands', "Manage Extensions"),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
Registry.as<IQuickOpenRegistry>(Extensions.Quickopen).registerQuickOpenHandler(
|
||||
new QuickOpenHandlerDescriptor(
|
||||
GalleryExtensionsHandler,
|
||||
GalleryExtensionsHandler.ID,
|
||||
'ext install ',
|
||||
undefined,
|
||||
localize('galleryExtensionsCommands', "Install Gallery Extensions"),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
// Editor
|
||||
const editorDescriptor = new EditorDescriptor(
|
||||
ExtensionEditor,
|
||||
ExtensionEditor.ID,
|
||||
localize('extension', "Extension")
|
||||
);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(editorDescriptor, [new SyncDescriptor(ExtensionsInput)]);
|
||||
|
||||
// Running Extensions Editor
|
||||
|
||||
@@ -126,159 +54,12 @@ class RuntimeExtensionsInputFactory implements IEditorInputFactory {
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(RuntimeExtensionsInput.ID, RuntimeExtensionsInputFactory);
|
||||
|
||||
|
||||
// Viewlet
|
||||
const viewletDescriptor = new ViewletDescriptor(
|
||||
ExtensionsViewlet,
|
||||
VIEWLET_ID,
|
||||
localize('extensions', "Extensions"),
|
||||
'extensions',
|
||||
// {{SQL CARBON EDIT}}
|
||||
14
|
||||
);
|
||||
|
||||
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets)
|
||||
.registerViewlet(viewletDescriptor);
|
||||
|
||||
// Global actions
|
||||
const actionRegistry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions);
|
||||
|
||||
const openViewletActionDescriptor = new SyncActionDescriptor(OpenExtensionsViewletAction, OpenExtensionsViewletAction.ID, OpenExtensionsViewletAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_X });
|
||||
actionRegistry.registerWorkbenchAction(openViewletActionDescriptor, 'View: Show Extensions', localize('view', "View"));
|
||||
|
||||
const installActionDescriptor = new SyncActionDescriptor(InstallExtensionsAction, InstallExtensionsAction.ID, InstallExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(installActionDescriptor, 'Extensions: Install Extensions', ExtensionsLabel);
|
||||
|
||||
const listOutdatedActionDescriptor = new SyncActionDescriptor(ShowOutdatedExtensionsAction, ShowOutdatedExtensionsAction.ID, ShowOutdatedExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(listOutdatedActionDescriptor, 'Extensions: Show Outdated Extensions', ExtensionsLabel);
|
||||
|
||||
const recommendationsActionDescriptor = new SyncActionDescriptor(ShowRecommendedExtensionsAction, ShowRecommendedExtensionsAction.ID, ShowRecommendedExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(recommendationsActionDescriptor, 'Extensions: Show Recommended Extensions', ExtensionsLabel);
|
||||
|
||||
const keymapRecommendationsActionDescriptor = new SyncActionDescriptor(ShowRecommendedKeymapExtensionsAction, ShowRecommendedKeymapExtensionsAction.ID, ShowRecommendedKeymapExtensionsAction.SHORT_LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_M) });
|
||||
actionRegistry.registerWorkbenchAction(keymapRecommendationsActionDescriptor, 'Preferences: Keymaps', PreferencesLabel);
|
||||
|
||||
const languageExtensionsActionDescriptor = new SyncActionDescriptor(ShowLanguageExtensionsAction, ShowLanguageExtensionsAction.ID, ShowLanguageExtensionsAction.SHORT_LABEL);
|
||||
actionRegistry.registerWorkbenchAction(languageExtensionsActionDescriptor, 'Preferences: Language Extensions', PreferencesLabel);
|
||||
|
||||
const azureExtensionsActionDescriptor = new SyncActionDescriptor(ShowAzureExtensionsAction, ShowAzureExtensionsAction.ID, ShowAzureExtensionsAction.SHORT_LABEL);
|
||||
actionRegistry.registerWorkbenchAction(azureExtensionsActionDescriptor, 'Preferences: Azure Extensions', PreferencesLabel);
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
// const popularActionDescriptor = new SyncActionDescriptor(ShowPopularExtensionsAction, ShowPopularExtensionsAction.ID, ShowPopularExtensionsAction.LABEL);
|
||||
// actionRegistry.registerWorkbenchAction(popularActionDescriptor, 'Extensions: Show Popular Extensions', ExtensionsLabel);
|
||||
|
||||
const enabledActionDescriptor = new SyncActionDescriptor(ShowEnabledExtensionsAction, ShowEnabledExtensionsAction.ID, ShowEnabledExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(enabledActionDescriptor, 'Extensions: Show Enabled Extensions', ExtensionsLabel);
|
||||
|
||||
const installedActionDescriptor = new SyncActionDescriptor(ShowInstalledExtensionsAction, ShowInstalledExtensionsAction.ID, ShowInstalledExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(installedActionDescriptor, 'Extensions: Show Installed Extensions', ExtensionsLabel);
|
||||
|
||||
const disabledActionDescriptor = new SyncActionDescriptor(ShowDisabledExtensionsAction, ShowDisabledExtensionsAction.ID, ShowDisabledExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(disabledActionDescriptor, 'Extensions: Show Disabled Extensions', ExtensionsLabel);
|
||||
|
||||
const builtinActionDescriptor = new SyncActionDescriptor(ShowBuiltInExtensionsAction, ShowBuiltInExtensionsAction.ID, ShowBuiltInExtensionsAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(builtinActionDescriptor, 'Extensions: Show Built-in Extensions', ExtensionsLabel);
|
||||
|
||||
const updateAllActionDescriptor = new SyncActionDescriptor(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, 'Extensions: Update All Extensions', ExtensionsLabel);
|
||||
|
||||
const openExtensionsFolderActionDescriptor = new SyncActionDescriptor(OpenExtensionsFolderAction, OpenExtensionsFolderAction.ID, OpenExtensionsFolderAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(openExtensionsFolderActionDescriptor, 'Extensions: Open Extensions Folder', ExtensionsLabel);
|
||||
|
||||
const installVSIXActionDescriptor = new SyncActionDescriptor(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(installVSIXActionDescriptor, 'Extensions: Install from VSIX...', ExtensionsLabel);
|
||||
|
||||
const disableAllAction = new SyncActionDescriptor(DisableAllAction, DisableAllAction.ID, DisableAllAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(disableAllAction, 'Extensions: Disable All Installed Extensions', ExtensionsLabel);
|
||||
|
||||
const disableAllWorkspaceAction = new SyncActionDescriptor(DisableAllWorkpsaceAction, DisableAllWorkpsaceAction.ID, DisableAllWorkpsaceAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(disableAllWorkspaceAction, 'Extensions: Disable All Installed Extensions for this Workspace', ExtensionsLabel);
|
||||
|
||||
const enableAllAction = new SyncActionDescriptor(EnableAllAction, EnableAllAction.ID, EnableAllAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(enableAllAction, 'Extensions: Enable All Extensions', ExtensionsLabel);
|
||||
|
||||
const enableAllWorkspaceAction = new SyncActionDescriptor(EnableAllWorkpsaceAction, EnableAllWorkpsaceAction.ID, EnableAllWorkpsaceAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(enableAllWorkspaceAction, 'Extensions: Enable All Extensions for this Workspace', ExtensionsLabel);
|
||||
|
||||
const checkForUpdatesAction = new SyncActionDescriptor(CheckForUpdatesAction, CheckForUpdatesAction.ID, CheckForUpdatesAction.LABEL);
|
||||
actionRegistry.registerWorkbenchAction(checkForUpdatesAction, `Extensions: Check for Extension Updates`, ExtensionsLabel);
|
||||
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(EnableAutoUpdateAction, EnableAutoUpdateAction.ID, EnableAutoUpdateAction.LABEL), `Extensions: Enable Auto Updating Extensions`, ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(DisableAutoUpdateAction, DisableAutoUpdateAction.ID, DisableAutoUpdateAction.LABEL), `Extensions: Disable Auto Updating Extensions`, ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(InstallSpecificVersionOfExtensionAction, InstallSpecificVersionOfExtensionAction.ID, InstallSpecificVersionOfExtensionAction.LABEL), 'Install Specific Version of Extension...', ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowRuntimeExtensionsAction, ShowRuntimeExtensionsAction.ID, ShowRuntimeExtensionsAction.LABEL), 'Show Running Extensions', localize('developer', "Developer"));
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ReinstallAction, ReinstallAction.ID, ReinstallAction.LABEL), 'Reinstall Extension...', localize('developer', "Developer"));
|
||||
|
||||
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
||||
.registerConfiguration({
|
||||
id: 'extensions',
|
||||
order: 30,
|
||||
title: localize('extensionsConfigurationTitle', "Extensions"),
|
||||
type: 'object',
|
||||
properties: {
|
||||
'extensions.autoUpdate': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsAutoUpdate', "When enabled, automatically installs updates for extensions. The updates are fetched from a Microsoft online service."),
|
||||
default: true,
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
tags: ['usesOnlineServices']
|
||||
},
|
||||
'extensions.autoCheckUpdates': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsCheckUpdates', "When enabled, automatically checks extensions for updates. If an extension has an update, it is marked as outdated in the Extensions view. The updates are fetched from a Microsoft online service."),
|
||||
default: true,
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
tags: ['usesOnlineServices']
|
||||
},
|
||||
'extensions.ignoreRecommendations': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsIgnoreRecommendations', "When enabled, the notifications for extension recommendations will not be shown."),
|
||||
default: false
|
||||
},
|
||||
'extensions.showRecommendationsOnlyOnDemand': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsShowRecommendationsOnlyOnDemand', "When enabled, recommendations will not be fetched or shown unless specifically requested by the user. Some recommendations are fetched from a Microsoft online service."),
|
||||
default: false,
|
||||
tags: ['usesOnlineServices']
|
||||
},
|
||||
'extensions.closeExtensionDetailsOnViewChange': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsCloseExtensionDetailsOnViewChange', "When enabled, editors with extension details will be automatically closed upon navigating away from the Extensions View."),
|
||||
default: false
|
||||
},
|
||||
// {{SQL CARBON EDIT}}
|
||||
'extensions.extensionsPolicy': {
|
||||
type: 'string',
|
||||
description: localize('extensionsPolicy', "Sets the security policy for downloading extensions."),
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
default: ExtensionsPolicy.allowAll
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
const jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>Registry.as(jsonContributionRegistry.Extensions.JSONContribution);
|
||||
jsonRegistry.registerSchema(ExtensionsConfigurationSchemaId, ExtensionsConfigurationSchema);
|
||||
|
||||
// Register Commands
|
||||
CommandsRegistry.registerCommand('_extensions.manage', (accessor: ServicesAccessor, extensionId: string) => {
|
||||
const extensionService = accessor.get(IExtensionsWorkbenchService);
|
||||
const extension = extensionService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }));
|
||||
if (extension.length === 1) {
|
||||
extensionService.open(extension[0]);
|
||||
}
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand('extension.open', (accessor: ServicesAccessor, extensionId: string) => {
|
||||
const extensionService = accessor.get(IExtensionsWorkbenchService);
|
||||
|
||||
return extensionService.queryGallery({ names: [extensionId], pageSize: 1 }, CancellationToken.None).then(pager => {
|
||||
if (pager.total !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
extensionService.open(pager.firstPage[0]);
|
||||
});
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand(DebugExtensionHostAction.ID, (accessor: ServicesAccessor) => {
|
||||
const instantiationService = accessor.get(IInstantiationService);
|
||||
@@ -300,49 +81,6 @@ CommandsRegistry.registerCommand(SaveExtensionHostProfileAction.ID, (accessor: S
|
||||
instantiationService.createInstance(SaveExtensionHostProfileAction, SaveExtensionHostProfileAction.ID, SaveExtensionHostProfileAction.LABEL).run();
|
||||
});
|
||||
|
||||
// File menu registration
|
||||
|
||||
// {{SQL CARBON EDIT}} - Disable unused menu item
|
||||
// MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
||||
// group: '2_keybindings',
|
||||
// command: {
|
||||
// id: ShowRecommendedKeymapExtensionsAction.ID,
|
||||
// title: localize({ key: 'miOpenKeymapExtensions', comment: ['&& denotes a mnemonic'] }, "&&Keymaps")
|
||||
// },
|
||||
// order: 2
|
||||
// });
|
||||
// {{SQL CARBON EDIT}} - End
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
||||
group: '2_keybindings',
|
||||
command: {
|
||||
id: ShowRecommendedKeymapExtensionsAction.ID,
|
||||
title: localize('miOpenKeymapExtensions2', "Keymaps")
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
||||
group: '1_settings',
|
||||
command: {
|
||||
id: VIEWLET_ID,
|
||||
title: localize({ key: 'miPreferencesExtensions', comment: ['&& denotes a mnemonic'] }, "&&Extensions")
|
||||
},
|
||||
order: 3
|
||||
});
|
||||
|
||||
// View menu
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
||||
group: '3_views',
|
||||
command: {
|
||||
id: VIEWLET_ID,
|
||||
title: localize({ key: 'miViewExtensions', comment: ['&& denotes a mnemonic'] }, "E&&xtensions")
|
||||
},
|
||||
// {{SQL CARBON EDIT}} - Change the order
|
||||
order: 7
|
||||
});
|
||||
|
||||
// Running extensions
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
||||
@@ -396,78 +134,4 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
||||
},
|
||||
group: 'navigation',
|
||||
when: ContextKeyExpr.and(ActiveEditorContext.isEqualTo(RuntimeExtensionsEditor.ID))
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'workbench.extensions.installExtension',
|
||||
description: {
|
||||
description: localize('workbench.extensions.installExtension.description', "Install the given extension"),
|
||||
args: [
|
||||
{
|
||||
name: localize('workbench.extensions.installExtension.arg.name', "Extension id or VSIX resource uri"),
|
||||
schema: {
|
||||
'type': ['object', 'string']
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
handler: async (accessor, arg: string | UriComponents) => {
|
||||
const extensionManagementService = accessor.get(IExtensionManagementService);
|
||||
const extensionGalleryService = accessor.get(IExtensionGalleryService);
|
||||
try {
|
||||
if (typeof arg === 'string') {
|
||||
const extension = await extensionGalleryService.getCompatibleExtension({ id: arg });
|
||||
if (extension) {
|
||||
await extensionManagementService.installFromGallery(extension);
|
||||
} else {
|
||||
throw new Error(localize('notFound', "Extension '{0}' not found.", arg));
|
||||
}
|
||||
} else {
|
||||
const vsix = URI.revive(arg);
|
||||
await extensionManagementService.install(vsix);
|
||||
}
|
||||
} catch (e) {
|
||||
onUnexpectedError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'workbench.extensions.uninstallExtension',
|
||||
description: {
|
||||
description: localize('workbench.extensions.uninstallExtension.description', "Uninstall the given extension"),
|
||||
args: [
|
||||
{
|
||||
name: localize('workbench.extensions.uninstallExtension.arg.name', "Id of the extension to uninstall"),
|
||||
schema: {
|
||||
'type': 'string'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
handler: async (accessor, id: string) => {
|
||||
if (!id) {
|
||||
throw new Error(localize('id required', "Extension id required."));
|
||||
}
|
||||
const extensionManagementService = accessor.get(IExtensionManagementService);
|
||||
try {
|
||||
const installed = await extensionManagementService.getInstalled(ExtensionType.User);
|
||||
const [extensionToUninstall] = installed.filter(e => areSameExtensions(e.identifier, { id }));
|
||||
if (!extensionToUninstall) {
|
||||
return Promise.reject(new Error(localize('notInstalled', "Extension '{0}' is not installed. Make sure you use the full extension ID, including the publisher, e.g.: ms-vscode.csharp.", id)));
|
||||
}
|
||||
await extensionManagementService.uninstall(extensionToUninstall, true);
|
||||
} catch (e) {
|
||||
onUnexpectedError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
||||
group: '2_configuration',
|
||||
command: {
|
||||
id: VIEWLET_ID,
|
||||
title: localize('showExtensions', "Extensions")
|
||||
},
|
||||
order: 3
|
||||
});
|
||||
@@ -23,7 +23,7 @@ import { ActionBar, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { clipboard } from 'electron';
|
||||
import { EnablementState } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { EnablementState } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { writeFile } from 'vs/base/node/pfs';
|
||||
@@ -420,8 +420,8 @@ export class RuntimeExtensionsEditor extends BaseEditor {
|
||||
actions.push(new Separator());
|
||||
|
||||
if (e.element.marketplaceInfo) {
|
||||
actions.push(new Action('runtimeExtensionsEditor.action.disableWorkspace', nls.localize('disable workspace', "Disable (Workspace)"), undefined, true, () => this._extensionsWorkbenchService.setEnablement(e.element!.marketplaceInfo, EnablementState.WorkspaceDisabled)));
|
||||
actions.push(new Action('runtimeExtensionsEditor.action.disable', nls.localize('disable', "Disable"), undefined, true, () => this._extensionsWorkbenchService.setEnablement(e.element!.marketplaceInfo, EnablementState.Disabled)));
|
||||
actions.push(new Action('runtimeExtensionsEditor.action.disableWorkspace', nls.localize('disable workspace', "Disable (Workspace)"), undefined, true, () => this._extensionsWorkbenchService.setEnablement(e.element!.marketplaceInfo, EnablementState.DisabledWorkspace)));
|
||||
actions.push(new Action('runtimeExtensionsEditor.action.disable', nls.localize('disable', "Disable"), undefined, true, () => this._extensionsWorkbenchService.setEnablement(e.element!.marketplaceInfo, EnablementState.DisabledGlobally)));
|
||||
actions.push(new Separator());
|
||||
}
|
||||
const state = this._extensionHostProfileService.state;
|
||||
|
||||
+33
-32
@@ -8,11 +8,12 @@ import { assign } from 'vs/base/common/objects';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IExtensionsWorkbenchService, ExtensionContainers } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import * as ExtensionsActions from 'vs/workbench/contrib/extensions/browser/extensionsActions';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/node/extensionsWorkbenchService';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService';
|
||||
import {
|
||||
IExtensionManagementService, IExtensionGalleryService, IExtensionEnablementService, IExtensionTipsService, ILocalExtension, IGalleryExtension,
|
||||
DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier, EnablementState, InstallOperation, IExtensionManagementServerService, IExtensionManagementServer
|
||||
IExtensionManagementService, IExtensionGalleryService, ILocalExtension, IGalleryExtension,
|
||||
DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier, InstallOperation
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionManagementServer, IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService';
|
||||
import { ExtensionTipsService } from 'vs/workbench/contrib/extensions/electron-browser/extensionTipsService';
|
||||
@@ -39,7 +40,7 @@ import { ExtensionIdentifier, IExtensionContributions, ExtensionType, IExtension
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/electron-browser/extensionManagementServerService';
|
||||
import { ExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService';
|
||||
import { IProductService } from 'vs/platform/product/common/product';
|
||||
|
||||
suite('ExtensionsActions Test', () => {
|
||||
@@ -79,7 +80,7 @@ suite('ExtensionsActions Test', () => {
|
||||
instantiationService.stub(IExtensionManagementServerService, new class extends ExtensionManagementServerService {
|
||||
private _localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', authority: 'vscode-local' };
|
||||
constructor() {
|
||||
super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IConfigurationService), instantiationService.get(IProductService), instantiationService.get(ILogService));
|
||||
super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IConfigurationService), instantiationService.get(IProductService), instantiationService.get(ILogService), instantiationService.get(ILabelService));
|
||||
}
|
||||
get localExtensionManagementServer(): IExtensionManagementServer { return this._localExtensionManagementServer; }
|
||||
set localExtensionManagementServer(server: IExtensionManagementServer) { }
|
||||
@@ -601,7 +602,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test EnableForWorkspaceAction when the extension is disabled globally', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -616,7 +617,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test EnableForWorkspaceAction when extension is disabled for workspace', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.WorkspaceDisabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledWorkspace)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -631,8 +632,8 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test EnableForWorkspaceAction when the extension is disabled globally and workspace', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledWorkspace))
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -665,7 +666,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test EnableGloballyAction when the extension is disabled for workspace', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.WorkspaceDisabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledWorkspace)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -680,7 +681,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test EnableGloballyAction when the extension is disabled globally', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -695,8 +696,8 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test EnableGloballyAction when the extension is disabled in both', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledWorkspace))
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -729,7 +730,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test EnableDropDownAction when extension is installed and disabled globally', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -744,7 +745,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test EnableDropDownAction when extension is installed and disabled for workspace', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.WorkspaceDisabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledWorkspace)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -805,7 +806,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test DisableForWorkspaceAction when the extension is disabled globally', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -820,7 +821,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test DisableForWorkspaceAction when the extension is disabled workspace', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -853,7 +854,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test DisableGloballyAction when the extension is disabled globally', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -868,7 +869,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test DisableGloballyAction when the extension is disabled for workspace', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.WorkspaceDisabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledWorkspace)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -913,7 +914,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test DisableDropDownAction when extension is installed and disabled globally', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -928,7 +929,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test DisableDropDownAction when extension is installed and disabled for workspace', () => {
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.WorkspaceDisabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledWorkspace)
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -1200,7 +1201,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension is updated when not running', () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.b'), extensionLocation: URI.file('pub.b') }]);
|
||||
const local = aLocalExtension('a', { version: '1.0.1' });
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
@@ -1228,7 +1229,7 @@ suite('ExtensionsActions Test', () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
return workbenchService.queryLocal().then(extensions => {
|
||||
testObject.extension = extensions[0];
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.Disabled)
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.DisabledGlobally)
|
||||
.then(() => testObject.update())
|
||||
.then(() => {
|
||||
assert.ok(testObject.enabled);
|
||||
@@ -1248,8 +1249,8 @@ suite('ExtensionsActions Test', () => {
|
||||
return workbenchService.queryLocal().
|
||||
then(extensions => {
|
||||
testObject.extension = extensions[0];
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.Disabled)
|
||||
.then(() => workbenchService.setEnablement(extensions[0], EnablementState.Enabled))
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.DisabledGlobally)
|
||||
.then(() => workbenchService.setEnablement(extensions[0], EnablementState.EnabledGlobally))
|
||||
.then(() => assert.ok(!testObject.enabled));
|
||||
});
|
||||
});
|
||||
@@ -1257,7 +1258,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension is enabled when not running', () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.b'), extensionLocation: URI.file('pub.b') }]);
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
@@ -1266,7 +1267,7 @@ suite('ExtensionsActions Test', () => {
|
||||
return workbenchService.queryLocal()
|
||||
.then(extensions => {
|
||||
testObject.extension = extensions[0];
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.Enabled)
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.EnabledGlobally)
|
||||
.then(() => testObject.update())
|
||||
.then(() => {
|
||||
assert.ok(testObject.enabled);
|
||||
@@ -1280,7 +1281,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension enablement is toggled when not running', () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.b'), extensionLocation: URI.file('pub.b') }]);
|
||||
const local = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
@@ -1289,8 +1290,8 @@ suite('ExtensionsActions Test', () => {
|
||||
return workbenchService.queryLocal()
|
||||
.then(extensions => {
|
||||
testObject.extension = extensions[0];
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.Enabled)
|
||||
.then(() => workbenchService.setEnablement(extensions[0], EnablementState.Disabled))
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.EnabledGlobally)
|
||||
.then(() => workbenchService.setEnablement(extensions[0], EnablementState.DisabledGlobally))
|
||||
.then(() => assert.ok(!testObject.enabled));
|
||||
});
|
||||
});
|
||||
@@ -1299,7 +1300,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension is updated when not running and enabled', () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.b'), extensionLocation: URI.file('pub.b') }]);
|
||||
const local = aLocalExtension('a', { version: '1.0.1' });
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
@@ -1312,7 +1313,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a', { identifier: local.identifier, version: '1.0.2' });
|
||||
installEvent.fire({ identifier: gallery.identifier, gallery });
|
||||
didInstallEvent.fire({ identifier: gallery.identifier, gallery, operation: InstallOperation.Install, local: aLocalExtension('a', gallery, gallery) });
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.Enabled)
|
||||
return workbenchService.setEnablement(extensions[0], EnablementState.EnabledGlobally)
|
||||
.then(() => testObject.update())
|
||||
.then(() => {
|
||||
assert.ok(testObject.enabled);
|
||||
|
||||
+2
-1
@@ -12,8 +12,9 @@ import * as uuid from 'vs/base/common/uuid';
|
||||
import { mkdirp, rimraf, RimRafMode } from 'vs/base/node/pfs';
|
||||
import {
|
||||
IExtensionGalleryService, IGalleryExtensionAssets, IGalleryExtension, IExtensionManagementService,
|
||||
IExtensionEnablementService, DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier
|
||||
DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionTipsService } from 'vs/workbench/contrib/extensions/electron-browser/extensionTipsService';
|
||||
import { ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
|
||||
@@ -9,11 +9,12 @@ import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { ExtensionsListView } from 'vs/workbench/contrib/extensions/browser/extensionsViews';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/node/extensionsWorkbenchService';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService';
|
||||
import {
|
||||
IExtensionManagementService, IExtensionGalleryService, IExtensionEnablementService, IExtensionTipsService, ILocalExtension, IGalleryExtension, IQueryOptions,
|
||||
DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier, IExtensionManagementServerService, EnablementState, ExtensionRecommendationReason, SortBy, IExtensionManagementServer
|
||||
IExtensionManagementService, IExtensionGalleryService, ILocalExtension, IGalleryExtension, IQueryOptions,
|
||||
DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier, SortBy
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionManagementServer, IExtensionTipsService, ExtensionRecommendationReason } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService';
|
||||
import { ExtensionTipsService } from 'vs/workbench/contrib/extensions/electron-browser/extensionTipsService';
|
||||
@@ -40,8 +41,9 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
|
||||
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
|
||||
import { ExtensionIdentifier, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/electron-browser/extensionManagementServerService';
|
||||
import { ExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService';
|
||||
import { IProductService } from 'vs/platform/product/common/product';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
|
||||
|
||||
suite('ExtensionsListView Tests', () => {
|
||||
@@ -95,7 +97,7 @@ suite('ExtensionsListView Tests', () => {
|
||||
instantiationService.stub(IExtensionManagementServerService, new class extends ExtensionManagementServerService {
|
||||
private _localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', authority: 'vscode-local' };
|
||||
constructor() {
|
||||
super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IConfigurationService), instantiationService.get(IProductService), instantiationService.get(ILogService));
|
||||
super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IConfigurationService), instantiationService.get(IProductService), instantiationService.get(ILogService), instantiationService.get(ILabelService));
|
||||
}
|
||||
get localExtensionManagementServer(): IExtensionManagementServer { return this._localExtensionManagementServer; }
|
||||
set localExtensionManagementServer(server: IExtensionManagementServer) { }
|
||||
@@ -143,8 +145,8 @@ suite('ExtensionsListView Tests', () => {
|
||||
]);
|
||||
}
|
||||
});
|
||||
await (<TestExtensionEnablementService>instantiationService.get(IExtensionEnablementService)).setEnablement([localDisabledTheme], EnablementState.Disabled);
|
||||
await (<TestExtensionEnablementService>instantiationService.get(IExtensionEnablementService)).setEnablement([localDisabledLanguage], EnablementState.Disabled);
|
||||
await (<TestExtensionEnablementService>instantiationService.get(IExtensionEnablementService)).setEnablement([localDisabledTheme], EnablementState.DisabledGlobally);
|
||||
await (<TestExtensionEnablementService>instantiationService.get(IExtensionEnablementService)).setEnablement([localDisabledLanguage], EnablementState.DisabledGlobally);
|
||||
|
||||
instantiationService.set(IExtensionsWorkbenchService, instantiationService.createInstance(ExtensionsWorkbenchService));
|
||||
testableView = instantiationService.createInstance(ExtensionsListView, {});
|
||||
|
||||
+126
-125
@@ -9,11 +9,12 @@ import * as fs from 'fs';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IExtensionsWorkbenchService, ExtensionState, AutoCheckUpdatesConfigurationKey, AutoUpdateConfigurationKey } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/node/extensionsWorkbenchService';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService';
|
||||
import {
|
||||
IExtensionManagementService, IExtensionGalleryService, IExtensionEnablementService, IExtensionTipsService, ILocalExtension, IGalleryExtension,
|
||||
DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IGalleryExtensionAssets, IExtensionIdentifier, EnablementState, InstallOperation, IExtensionManagementServerService
|
||||
IExtensionManagementService, IExtensionGalleryService, ILocalExtension, IGalleryExtension,
|
||||
DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IGalleryExtensionAssets, IExtensionIdentifier, InstallOperation
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService';
|
||||
import { ExtensionTipsService } from 'vs/workbench/contrib/extensions/electron-browser/extensionTipsService';
|
||||
@@ -481,86 +482,86 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
});
|
||||
|
||||
test('test uninstalled extensions are always enabled', async () => {
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.DisabledWorkspace))
|
||||
.then(async () => {
|
||||
testObject = await aWorkbenchService();
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a')));
|
||||
return testObject.queryGallery(CancellationToken.None).then(pagedResponse => {
|
||||
const actual = pagedResponse.firstPage[0];
|
||||
assert.equal(actual.enablementState, EnablementState.Enabled);
|
||||
assert.equal(actual.enablementState, EnablementState.EnabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('test enablement state installed enabled extension', async () => {
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.DisabledWorkspace))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [aLocalExtension('a')]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
const actual = testObject.local[0];
|
||||
|
||||
assert.equal(actual.enablementState, EnablementState.Enabled);
|
||||
assert.equal(actual.enablementState, EnablementState.EnabledGlobally);
|
||||
});
|
||||
});
|
||||
|
||||
test('test workspace disabled extension', async () => {
|
||||
const extensionA = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('d')], EnablementState.Disabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.WorkspaceDisabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('e')], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('d')], EnablementState.DisabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.DisabledWorkspace))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('e')], EnablementState.DisabledWorkspace))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
const actual = testObject.local[0];
|
||||
|
||||
assert.equal(actual.enablementState, EnablementState.WorkspaceDisabled);
|
||||
assert.equal(actual.enablementState, EnablementState.DisabledWorkspace);
|
||||
});
|
||||
});
|
||||
|
||||
test('test globally disabled extension', async () => {
|
||||
const localExtension = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([localExtension], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('d')], EnablementState.Disabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([localExtension], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('d')], EnablementState.DisabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.DisabledWorkspace))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [localExtension]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
const actual = testObject.local[0];
|
||||
|
||||
assert.equal(actual.enablementState, EnablementState.Disabled);
|
||||
assert.equal(actual.enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
|
||||
test('test enablement state is updated for user extensions', async () => {
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.DisabledWorkspace))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [aLocalExtension('a')]);
|
||||
testObject = await aWorkbenchService();
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.WorkspaceDisabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledWorkspace)
|
||||
.then(() => {
|
||||
const actual = testObject.local[0];
|
||||
assert.equal(actual.enablementState, EnablementState.WorkspaceDisabled);
|
||||
assert.equal(actual.enablementState, EnablementState.DisabledWorkspace);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('test enable extension globally when extension is disabled for workspace', async () => {
|
||||
const localExtension = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([localExtension], EnablementState.WorkspaceDisabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([localExtension], EnablementState.DisabledWorkspace)
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [localExtension]);
|
||||
testObject = await aWorkbenchService();
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Enabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.EnabledGlobally)
|
||||
.then(() => {
|
||||
const actual = testObject.local[0];
|
||||
assert.equal(actual.enablementState, EnablementState.Enabled);
|
||||
assert.equal(actual.enablementState, EnablementState.EnabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -569,10 +570,10 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [aLocalExtension('a')]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
const actual = testObject.local[0];
|
||||
assert.equal(actual.enablementState, EnablementState.Disabled);
|
||||
assert.equal(actual.enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -580,25 +581,25 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [aLocalExtension('a', {}, { type: ExtensionType.System })]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
const actual = testObject.local[0];
|
||||
assert.equal(actual.enablementState, EnablementState.Disabled);
|
||||
assert.equal(actual.enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
|
||||
test('test enablement state is updated on change from outside', async () => {
|
||||
const localExtension = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.DisabledWorkspace))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [localExtension]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([localExtension], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([localExtension], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
const actual = testObject.local[0];
|
||||
assert.equal(actual.enablementState, EnablementState.Disabled);
|
||||
assert.equal(actual.enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -608,17 +609,17 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.DisabledGlobally);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.EnabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -628,17 +629,17 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.DisabledGlobally);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -648,17 +649,17 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.DisabledGlobally);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -668,13 +669,13 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
return testObject.setEnablement(testObject.local[1], EnablementState.Disabled).then(() => assert.fail('Should fail'), error => assert.ok(true));
|
||||
return testObject.setEnablement(testObject.local[1], EnablementState.DisabledGlobally).then(() => assert.fail('Should fail'), error => assert.ok(true));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -683,15 +684,15 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
return testObject.setEnablement(testObject.local[1], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[1], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -701,19 +702,19 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
const target = sinon.spy();
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement([testObject.local[1], testObject.local[0]], EnablementState.Disabled)
|
||||
return testObject.setEnablement([testObject.local[1], testObject.local[0]], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
assert.ok(!target.called);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.DisabledGlobally);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -723,19 +724,19 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Disabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Disabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.DisabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.DisabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
const target = sinon.spy();
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement([testObject.local[1], testObject.local[0]], EnablementState.Enabled)
|
||||
return testObject.setEnablement([testObject.local[1], testObject.local[0]], EnablementState.EnabledGlobally)
|
||||
.then(() => {
|
||||
assert.ok(!target.called);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.EnabledGlobally);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.EnabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -745,16 +746,16 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c', { extensionDependencies: ['pub.b'] });
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -764,16 +765,16 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c', { extensionDependencies: ['pub.b'] });
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Disabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.DisabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => {
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Disabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.DisabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -783,14 +784,14 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b', { extensionDependencies: ['pub.a'] });
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => assert.fail('An extension with dependent should not be disabled'), () => null);
|
||||
});
|
||||
});
|
||||
@@ -800,16 +801,16 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c', { extensionDependencies: ['pub.b'] });
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Disabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.DisabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
.then(() => assert.equal(testObject.local[0].enablementState, EnablementState.Disabled));
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => assert.equal(testObject.local[0].enablementState, EnablementState.DisabledGlobally));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -818,13 +819,13 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b', { extensionDependencies: ['pub.c'] });
|
||||
const extensionC = aLocalExtension('c', { extensionDependencies: ['pub.a'] });
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Enabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Enabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.EnabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.EnabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => assert.fail('An extension with dependent should not be disabled'), () => null);
|
||||
});
|
||||
});
|
||||
@@ -834,17 +835,17 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Disabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Disabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.DisabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.DisabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Enabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.EnabledGlobally)
|
||||
.then(() => {
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.EnabledGlobally);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.EnabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -854,18 +855,18 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Enabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Disabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.EnabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.DisabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
const target = sinon.spy();
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Enabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.EnabledGlobally)
|
||||
.then(() => {
|
||||
assert.ok(!target.called);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.EnabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -875,19 +876,19 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b');
|
||||
const extensionC = aLocalExtension('c');
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Disabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Disabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.DisabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.DisabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
const target = sinon.spy();
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement([testObject.local[1], testObject.local[0]], EnablementState.Enabled)
|
||||
return testObject.setEnablement([testObject.local[1], testObject.local[0]], EnablementState.EnabledGlobally)
|
||||
.then(() => {
|
||||
assert.ok(!target.called);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.EnabledGlobally);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.EnabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -897,48 +898,48 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
const extensionB = aLocalExtension('b', { extensionDependencies: ['pub.c'] });
|
||||
const extensionC = aLocalExtension('c', { extensionDependencies: ['pub.a'] });
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.Disabled))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.Disabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([extensionA], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionB], EnablementState.DisabledGlobally))
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([extensionC], EnablementState.DisabledGlobally))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [extensionA, extensionB, extensionC]);
|
||||
|
||||
testObject = await aWorkbenchService();
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Enabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.EnabledGlobally)
|
||||
.then(() => {
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[2].enablementState, EnablementState.Enabled);
|
||||
assert.equal(testObject.local[0].enablementState, EnablementState.EnabledGlobally);
|
||||
assert.equal(testObject.local[1].enablementState, EnablementState.EnabledGlobally);
|
||||
assert.equal(testObject.local[2].enablementState, EnablementState.EnabledGlobally);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('test change event is fired when disablement flags are changed', async () => {
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.DisabledWorkspace))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [aLocalExtension('a')]);
|
||||
testObject = await aWorkbenchService();
|
||||
const target = sinon.spy();
|
||||
testObject.onChange(target);
|
||||
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.Disabled)
|
||||
return testObject.setEnablement(testObject.local[0], EnablementState.DisabledGlobally)
|
||||
.then(() => assert.ok(target.calledOnce));
|
||||
});
|
||||
});
|
||||
|
||||
test('test change event is fired when disablement flags are changed from outside', async () => {
|
||||
const localExtension = aLocalExtension('a');
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.Disabled)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.WorkspaceDisabled))
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('c')], EnablementState.DisabledGlobally)
|
||||
.then(() => instantiationService.get(IExtensionEnablementService).setEnablement([aLocalExtension('b')], EnablementState.DisabledWorkspace))
|
||||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [localExtension]);
|
||||
testObject = await aWorkbenchService();
|
||||
const target = sinon.spy();
|
||||
testObject.onChange(target);
|
||||
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([localExtension], EnablementState.Disabled)
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([localExtension], EnablementState.DisabledGlobally)
|
||||
.then(() => assert.ok(target.calledOnce));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ import { ITextModel } from 'vs/editor/common/model';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
|
||||
type FormattingEditProvider = DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider;
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ import { IssueReporterStyles, IIssueService, IssueReporterData, ProcessExplorerD
|
||||
import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { textLinkForeground, inputBackground, inputBorder, inputForeground, buttonBackground, buttonHoverBackground, buttonForeground, inputValidationErrorBorder, foreground, inputActiveOptionBorder, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, editorBackground, editorForeground, listHoverBackground, listHoverForeground, listHighlightForeground, textLinkActiveForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { IExtensionManagementService, IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { webFrame } from 'electron';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { IWorkbenchIssueService } from 'vs/workbench/contrib/issue/electron-browser/issue';
|
||||
|
||||
@@ -15,7 +15,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IPreferencesSearchService, ISearchProvider, IWorkbenchSettingsConfiguration } from 'vs/workbench/contrib/preferences/common/preferences';
|
||||
import { IRequestService, asJson } from 'vs/platform/request/common/request';
|
||||
import { IExtensionManagementService, ILocalExtension, IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementService, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { canceled } from 'vs/base/common/errors';
|
||||
|
||||
@@ -70,6 +70,10 @@ function getExcludeDisplayValue(element: SettingsTreeSettingElement): IListDataI
|
||||
}
|
||||
|
||||
function getListDisplayValue(element: SettingsTreeSettingElement): IListDataItem[] {
|
||||
if (!element.value || !isArray(element.value)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return element.value.map((key: string) => {
|
||||
return {
|
||||
value: key
|
||||
|
||||
@@ -168,8 +168,6 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||
private static readonly IgnoreTask010DonotShowAgain_key = 'workbench.tasks.ignoreTask010Shown';
|
||||
|
||||
private static CustomizationTelemetryEventName: string = 'taskService.customize';
|
||||
public static TemplateTelemetryEventName: string = 'taskService.template';
|
||||
|
||||
public _serviceBrand: any;
|
||||
public static OutputChannelId: string = 'tasks';
|
||||
public static OutputChannelLabel: string = nls.localize('tasks', "Tasks");
|
||||
@@ -2057,14 +2055,16 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||
content = content.replace(/(\n)(\t+)/g, (_, s1, s2) => s1 + strings.repeat(' ', s2.length * editorConfig.editor.tabSize));
|
||||
}
|
||||
configFileCreated = true;
|
||||
/* __GDPR__
|
||||
"taskService.template" : {
|
||||
"templateId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"autoDetect" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
type TaskServiceTemplateClassification = {
|
||||
templateId?: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
autoDetect: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
|
||||
};
|
||||
type TaskServiceEvent = {
|
||||
templateId?: string;
|
||||
autoDetect: boolean;
|
||||
};
|
||||
return this.textFileService.create(resource, content).then((result): URI => {
|
||||
this.telemetryService.publicLog(AbstractTaskService.TemplateTelemetryEventName, {
|
||||
this.telemetryService.publicLog2<TaskServiceEvent, TaskServiceTemplateClassification>('taskService.template', {
|
||||
templateId: selection.id,
|
||||
autoDetect: selection.autoDetect
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user