提交 513807b0 编写于 作者: B Benjamin Pasero

web - improve window indicator

上级 0ffdb5ac
...@@ -27,7 +27,7 @@ const BUILTIN_MARKETPLACE_EXTENSIONS_ROOT = path.join(APP_ROOT, '.build', 'built ...@@ -27,7 +27,7 @@ const BUILTIN_MARKETPLACE_EXTENSIONS_ROOT = path.join(APP_ROOT, '.build', 'built
const WEB_DEV_EXTENSIONS_ROOT = path.join(APP_ROOT, '.build', 'builtInWebDevExtensions'); const WEB_DEV_EXTENSIONS_ROOT = path.join(APP_ROOT, '.build', 'builtInWebDevExtensions');
const WEB_MAIN = path.join(APP_ROOT, 'src', 'vs', 'code', 'browser', 'workbench', 'workbench-dev.html'); const WEB_MAIN = path.join(APP_ROOT, 'src', 'vs', 'code', 'browser', 'workbench', 'workbench-dev.html');
const WEB_PLAYGROUND_VERSION = '0.0.4'; const WEB_PLAYGROUND_VERSION = '0.0.5';
const args = minimist(process.argv, { const args = minimist(process.argv, {
boolean: [ boolean: [
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { IWorkbenchConstructionOptions, create, ICredentialsProvider, IURLCallbackProvider, IWorkspaceProvider, IWorkspace, IWindowIndicator, ICommand, IHomeIndicator, IProductQualityChangeHandler } from 'vs/workbench/workbench.web.api'; import { IWorkbenchConstructionOptions, create, ICredentialsProvider, IURLCallbackProvider, IWorkspaceProvider, IWorkspace, IWindowIndicator, IHomeIndicator, IProductQualityChangeHandler } from 'vs/workbench/workbench.web.api';
import product from 'vs/platform/product/common/product';
import { URI, UriComponents } from 'vs/base/common/uri'; import { URI, UriComponents } from 'vs/base/common/uri';
import { Event, Emitter } from 'vs/base/common/event'; import { Event, Emitter } from 'vs/base/common/event';
import { generateUuid } from 'vs/base/common/uuid'; import { generateUuid } from 'vs/base/common/uuid';
...@@ -302,8 +301,6 @@ class WindowIndicator implements IWindowIndicator { ...@@ -302,8 +301,6 @@ class WindowIndicator implements IWindowIndicator {
readonly tooltip: string; readonly tooltip: string;
readonly command: string | undefined; readonly command: string | undefined;
readonly commandImpl: ICommand | undefined = undefined;
constructor(workspace: IWorkspace) { constructor(workspace: IWorkspace) {
let repositoryOwner: string | undefined = undefined; let repositoryOwner: string | undefined = undefined;
let repositoryName: string | undefined = undefined; let repositoryName: string | undefined = undefined;
...@@ -321,20 +318,16 @@ class WindowIndicator implements IWindowIndicator { ...@@ -321,20 +318,16 @@ class WindowIndicator implements IWindowIndicator {
} }
} }
// Repo
if (repositoryName && repositoryOwner) { if (repositoryName && repositoryOwner) {
this.label = localize('openInDesktopLabel', "$(remote) Open in Desktop"); this.label = localize('playgroundLabelRepository', "$(remote) VS Code Web Playground: {0}/{1}", repositoryOwner, repositoryName);
this.tooltip = localize('openInDesktopTooltip', "Open in Desktop"); this.tooltip = localize('playgroundRepositoryTooltip', "VS Code Web Playground: {0}/{1}", repositoryOwner, repositoryName);
this.command = '_web.openInDesktop'; }
this.commandImpl = {
id: this.command, // No Repo
handler: () => { else {
const protocol = product.quality === 'stable' ? 'vscode' : 'vscode-insiders'; this.label = localize('playgroundLabel', "$(remote) VS Code Web Playground");
window.open(`${protocol}://vscode.git/clone?url=${encodeURIComponent(`https://github.com/${repositoryOwner}/${repositoryName}.git`)}`); this.tooltip = localize('playgroundTooltip', "VS Code Web Playground");
}
};
} else {
this.label = localize('playgroundLabel', "Web Playground");
this.tooltip = this.label;
} }
} }
} }
...@@ -416,16 +409,10 @@ class WindowIndicator implements IWindowIndicator { ...@@ -416,16 +409,10 @@ class WindowIndicator implements IWindowIndicator {
title: localize('home', "Home") title: localize('home', "Home")
}; };
// Commands
const commands: ICommand[] = [];
// Window indicator (unless connected to a remote) // Window indicator (unless connected to a remote)
let windowIndicator: WindowIndicator | undefined = undefined; let windowIndicator: WindowIndicator | undefined = undefined;
if (!workspaceProvider.hasRemote()) { if (!workspaceProvider.hasRemote()) {
windowIndicator = new WindowIndicator(workspace); windowIndicator = new WindowIndicator(workspace);
if (windowIndicator.commandImpl) {
commands.push(windowIndicator.commandImpl);
}
} }
// Product Quality Change Handler // Product Quality Change Handler
...@@ -447,7 +434,6 @@ class WindowIndicator implements IWindowIndicator { ...@@ -447,7 +434,6 @@ class WindowIndicator implements IWindowIndicator {
create(document.body, { create(document.body, {
...config, ...config,
homeIndicator, homeIndicator,
commands,
windowIndicator, windowIndicator,
productQualityChangeHandler, productQualityChangeHandler,
workspaceProvider, workspaceProvider,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册