Skip to content

Commit db2b044

Browse files
committed
Use codicons from npm package
1 parent c8547e5 commit db2b044

File tree

9 files changed

+31
-15
lines changed

9 files changed

+31
-15
lines changed

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"@microsoft/1ds-post-js": "^3.2.13",
7777
"@parcel/watcher": "parcel-bundler/watcher#1ca032aa8339260a8a3bcf825c3a1a71e3e43542",
7878
"@types/semver": "^7.5.8",
79+
"@vscode/codicons": "^0.0.42",
7980
"@vscode/deviceid": "^0.1.1",
8081
"@vscode/iconv-lite-umd": "0.7.1",
8182
"@vscode/policy-watcher": "^1.3.2",

src/vs/base/browser/ui/codicons/codicon/codicon.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
@font-face {
7-
font-family: "codicon";
8-
font-display: block;
9-
src: url("./codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6") format("truetype");
10-
}
11-
126
.codicon[class*='codicon-'] {
137
font: normal normal normal 16px/1 codicon;
148
display: inline-block;

src/vs/editor/standalone/browser/standaloneThemeService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export class StandaloneThemeService extends Disposable implements IStandaloneThe
246246
this._knownThemes.set(HC_BLACK_THEME_NAME, newBuiltInTheme(HC_BLACK_THEME_NAME));
247247
this._knownThemes.set(HC_LIGHT_THEME_NAME, newBuiltInTheme(HC_LIGHT_THEME_NAME));
248248

249-
const iconsStyleSheet = this._register(getIconsStyleSheet(this));
249+
const iconsStyleSheet = this._register(getIconsStyleSheet(this, this._environment));
250250

251251
this._codiconCSS = iconsStyleSheet.getCSS();
252252
this._themeCSS = '';

src/vs/platform/theme/browser/iconsStyleSheet.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { canASAR } from '../../../amdX.js';
67
import * as css from '../../../base/browser/cssValue.js';
78
import { Emitter, Event } from '../../../base/common/event.js';
89
import { DisposableStore, IDisposable } from '../../../base/common/lifecycle.js';
10+
import { AppResourcePath, FileAccess, nodeModulesAsarUnpackedPath, nodeModulesPath } from '../../../base/common/network.js';
911
import { ThemeIcon } from '../../../base/common/themables.js';
12+
import { IEnvironmentService } from '../../environment/common/environment.js';
1013
import { getIconRegistry, IconContribution, IconFontDefinition } from '../common/iconRegistry.js';
1114
import { IProductIconTheme, IThemeService } from '../common/themeService.js';
1215

@@ -15,7 +18,11 @@ export interface IIconsStyleSheet extends IDisposable {
1518
readonly onDidChange: Event<void>;
1619
}
1720

18-
export function getIconsStyleSheet(themeService: IThemeService | undefined): IIconsStyleSheet {
21+
export function getModuleLocation(environmentService: IEnvironmentService): AppResourcePath {
22+
return `${(canASAR && environmentService.isBuilt) ? nodeModulesAsarUnpackedPath : nodeModulesPath}/@vscode/codicons/dist/codicon.ttf`;
23+
}
24+
25+
export function getIconsStyleSheet(themeService: IThemeService | undefined, environmentService: IEnvironmentService): IIconsStyleSheet {
1926
const disposable = new DisposableStore();
2027

2128
const onDidChangeEmmiter = disposable.add(new Emitter<void>());
@@ -34,6 +41,7 @@ export function getIconsStyleSheet(themeService: IThemeService | undefined): IIc
3441

3542
const rules = new css.Builder();
3643
const rootAttribs = new css.Builder();
44+
rules.push(css.inline`@font-face { font-family: "codicon"; font-display: block; src: ${css.asCSSUrl(FileAccess.asFileUri(getModuleLocation(environmentService)).with({ query: '5d4d76ab2ce5108968ad644d591a16a6' }))} format("truetype");}`);
3745
for (const contribution of iconRegistry.getIcons()) {
3846
const definition = productIconTheme.getIcon(contribution);
3947
if (!definition) {

src/vs/workbench/contrib/issue/browser/baseIssueReporterService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { IIssueFormService, IssueReporterData, IssueReporterExtensionData, Issue
3232
import { normalizeGitHubUrl } from '../common/issueReporterUtil.js';
3333
import { IssueReporterModel, IssueReporterData as IssueReporterModelData } from './issueReporterModel.js';
3434
import { IAuthenticationService } from '../../../services/authentication/common/authentication.js';
35+
import { IEnvironmentService } from '../../../../platform/environment/common/environment.js';
3536

3637
const MAX_URL_LENGTH = 7500;
3738

@@ -92,7 +93,8 @@ export class BaseIssueReporterService extends Disposable {
9293
@IFileDialogService public readonly fileDialogService: IFileDialogService,
9394
@IContextMenuService public readonly contextMenuService: IContextMenuService,
9495
@IAuthenticationService public readonly authenticationService: IAuthenticationService,
95-
@IOpenerService public readonly openerService: IOpenerService
96+
@IOpenerService public readonly openerService: IOpenerService,
97+
@IEnvironmentService private readonly environmentService: IEnvironmentService
9698
) {
9799
super();
98100
const targetExtension = data.extensionId ? data.enabledExtensions.find(extension => extension.id.toLocaleLowerCase() === data.extensionId?.toLocaleLowerCase()) : undefined;
@@ -175,7 +177,7 @@ export class BaseIssueReporterService extends Disposable {
175177
const codiconStyleSheet = createStyleSheet();
176178
codiconStyleSheet.id = 'codiconStyles';
177179

178-
const iconsStyleSheet = this._register(getIconsStyleSheet(this.themeService));
180+
const iconsStyleSheet = this._register(getIconsStyleSheet(this.themeService, this.environmentService));
179181
function updateAll() {
180182
codiconStyleSheet.textContent = iconsStyleSheet.getCSS();
181183
}

src/vs/workbench/contrib/issue/browser/issueReporterService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { IProductConfiguration } from '../../../../base/common/product.js';
66
import { localize } from '../../../../nls.js';
77
import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';
88
import { IFileDialogService } from '../../../../platform/dialogs/common/dialogs.js';
9+
import { IEnvironmentService } from '../../../../platform/environment/common/environment.js';
910
import { IFileService } from '../../../../platform/files/common/files.js';
1011
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
1112
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
@@ -33,9 +34,10 @@ export class IssueWebReporter extends BaseIssueReporterService {
3334
@IFileDialogService fileDialogService: IFileDialogService,
3435
@IContextMenuService contextMenuService: IContextMenuService,
3536
@IAuthenticationService authenticationService: IAuthenticationService,
36-
@IOpenerService openerService: IOpenerService
37+
@IOpenerService openerService: IOpenerService,
38+
@IEnvironmentService environmentService: IEnvironmentService
3739
) {
38-
super(disableExtensions, data, os, product, window, true, issueFormService, themeService, fileService, fileDialogService, contextMenuService, authenticationService, openerService);
40+
super(disableExtensions, data, os, product, window, true, issueFormService, themeService, fileService, fileDialogService, contextMenuService, authenticationService, openerService, environmentService);
3941

4042
// eslint-disable-next-line no-restricted-syntax
4143
const target = this.window.document.querySelector<HTMLElement>('.block-system .block-info');

src/vs/workbench/contrib/issue/electron-browser/issueReporterService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { IAuthenticationService } from '../../../services/authentication/common/
2525
import { BaseIssueReporterService } from '../browser/baseIssueReporterService.js';
2626
import { IssueReporterData as IssueReporterModelData } from '../browser/issueReporterModel.js';
2727
import { IIssueFormService, IssueReporterData, IssueType } from '../common/issue.js';
28+
import { IEnvironmentService } from '../../../../platform/environment/common/environment.js';
2829

2930
// GitHub has let us know that we could up our limit here to 8k. We chose 7500 to play it safe.
3031
// ref https://github.com/microsoft/vscode/issues/159191
@@ -57,9 +58,10 @@ export class IssueReporter extends BaseIssueReporterService {
5758
@IContextKeyService contextKeyService: IContextKeyService,
5859
@IContextMenuService contextMenuService: IContextMenuService,
5960
@IAuthenticationService authenticationService: IAuthenticationService,
60-
@IOpenerService openerService: IOpenerService
61+
@IOpenerService openerService: IOpenerService,
62+
@IEnvironmentService environmentService: IEnvironmentService
6163
) {
62-
super(disableExtensions, data, os, product, window, false, issueFormService, themeService, fileService, fileDialogService, contextMenuService, authenticationService, openerService);
64+
super(disableExtensions, data, os, product, window, false, issueFormService, themeService, fileService, fileDialogService, contextMenuService, authenticationService, openerService, environmentService);
6365
this.processService = processService;
6466
this.processService.getSystemInfo().then(info => {
6567
this.issueReporterModel.update({ systemInfo: info });

src/vs/workbench/services/themes/browser/workbenchThemeService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export class WorkbenchThemeService extends Disposable implements IWorkbenchTheme
179179
const codiconStyleSheet = createStyleSheet();
180180
codiconStyleSheet.id = 'codiconStyles';
181181

182-
const iconsStyleSheet = this._register(getIconsStyleSheet(this));
182+
const iconsStyleSheet = this._register(getIconsStyleSheet(this, this.environmentService));
183183
function updateAll() {
184184
codiconStyleSheet.textContent = iconsStyleSheet.getCSS();
185185
}

0 commit comments

Comments
 (0)