From 96d7905ca2ed8a428ff7f7ce324fbe5f10398cd9 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 2 Mar 2020 13:38:40 -0800 Subject: [PATCH] Remove unreachable code path --- src/vs/workbench/api/browser/mainThreadWebview.ts | 15 +++++---------- .../contrib/webview/browser/webviewIconManager.ts | 13 +++++-------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadWebview.ts b/src/vs/workbench/api/browser/mainThreadWebview.ts index e7a95744750..773222635a1 100644 --- a/src/vs/workbench/api/browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/browser/mainThreadWebview.ts @@ -22,7 +22,7 @@ import { IEditorInput } from 'vs/workbench/common/editor'; import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput'; import { CustomEditorInput, ModelType } from 'vs/workbench/contrib/customEditor/browser/customEditorInput'; import { ICustomEditorModel, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor'; -import { WebviewExtensionDescription } from 'vs/workbench/contrib/webview/browser/webview'; +import { WebviewExtensionDescription, WebviewIcons } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewInput } from 'vs/workbench/contrib/webview/browser/webviewEditorInput'; import { ICreateWebViewShowOptions, IWebviewWorkbenchService, WebviewInputOptions } from 'vs/workbench/contrib/webview/browser/webviewWorkbenchService'; import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; @@ -510,13 +510,8 @@ function reviveWebviewOptions(options: modes.IWebviewOptions): WebviewInputOptio function reviveWebviewIcon( value: { light: UriComponents, dark: UriComponents; } | undefined -): { light: URI, dark: URI; } | undefined { - if (!value) { - return undefined; - } - - return { - light: URI.revive(value.light), - dark: URI.revive(value.dark) - }; +): WebviewIcons | undefined { + return value + ? { light: URI.revive(value.light), dark: URI.revive(value.dark) } + : undefined; } diff --git a/src/vs/workbench/contrib/webview/browser/webviewIconManager.ts b/src/vs/workbench/contrib/webview/browser/webviewIconManager.ts index c409dd1ea89..3a7dc2cb416 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewIconManager.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewIconManager.ts @@ -5,10 +5,9 @@ import * as dom from 'vs/base/browser/dom'; import { memoize } from 'vs/base/common/decorators'; -import { URI } from 'vs/base/common/uri'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { WebviewIcons } from 'vs/workbench/contrib/webview/browser/webview'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export class WebviewIconManager { @@ -53,12 +52,10 @@ export class WebviewIconManager { if (this._configService.getValue('workbench.iconTheme') !== null) { for (const [key, value] of this._icons) { const webviewSelector = `.show-file-icons .webview-${key}-name-file-icon::before`; - if (URI.isUri(value)) { - cssRules.push(`${webviewSelector} { content: ""; background-image: ${dom.asCSSUrl(value)}; }`); - } else { - cssRules.push(`.vs ${webviewSelector} { content: ""; background-image: ${dom.asCSSUrl(value.light)}; }`); - cssRules.push(`.vs-dark ${webviewSelector} { content: ""; background-image: ${dom.asCSSUrl(value.dark)}; }`); - } + cssRules.push( + `.vs ${webviewSelector} { content: ""; background-image: ${dom.asCSSUrl(value.light)}; }`, + `.vs-dark ${webviewSelector} { content: ""; background-image: ${dom.asCSSUrl(value.dark)}; }` + ); } } this._styleElement.innerHTML = cssRules.join('\n');