mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode bd0efff9e3f36d6b3e1045cee9887003af8034d7
This commit is contained in:
@@ -18,7 +18,12 @@ export interface IActivityBarService {
|
||||
showActivity(viewletOrActionId: string, badge: IBadge, clazz?: string, priority?: number): IDisposable;
|
||||
|
||||
/**
|
||||
* Returns id of pinned viewlets following the visual order.
|
||||
* Returns id of pinned view containers following the visual order.
|
||||
*/
|
||||
getPinnedViewletIds(): string[];
|
||||
getPinnedViewContainerIds(): string[];
|
||||
|
||||
/**
|
||||
* Returns id of visible viewlets following the visual order.
|
||||
*/
|
||||
getVisibleViewContainerIds(): string[];
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ export class BackupFilesModel implements IBackupFilesModel {
|
||||
}
|
||||
|
||||
get(): URI[] {
|
||||
return this.cache.keys();
|
||||
return [...this.cache.keys()];
|
||||
}
|
||||
|
||||
remove(resource: URI): void {
|
||||
|
||||
@@ -87,7 +87,7 @@ export class ConflictDetector {
|
||||
}
|
||||
|
||||
list(): URI[] {
|
||||
return this._conflicts.keys();
|
||||
return [...this._conflicts.keys()];
|
||||
}
|
||||
|
||||
hasConflicts(): boolean {
|
||||
|
||||
@@ -127,12 +127,12 @@ class FileServiceBasedConfiguration extends Disposable {
|
||||
this._folderSettingsModelParser.parseContent('');
|
||||
|
||||
// parse
|
||||
if (settingsContents[0]) {
|
||||
if (settingsContents[0] !== undefined) {
|
||||
this._folderSettingsModelParser.parseContent(settingsContents[0]);
|
||||
}
|
||||
for (let index = 0; index < standAloneConfigurationContents.length; index++) {
|
||||
const contents = standAloneConfigurationContents[index];
|
||||
if (contents) {
|
||||
if (contents !== undefined) {
|
||||
const standAloneConfigurationModelParser = new StandaloneConfigurationModelParser(this.standAloneConfigurationResources[index][1].toString(), this.standAloneConfigurationResources[index][0]);
|
||||
standAloneConfigurationModelParser.parseContent(contents);
|
||||
this._standAloneConfigurations.push(standAloneConfigurationModelParser.configurationModel);
|
||||
|
||||
@@ -190,7 +190,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
|
||||
}
|
||||
|
||||
// Handle no longer visible out of workspace resources
|
||||
this.activeOutOfWorkspaceWatchers.keys().forEach(resource => {
|
||||
[...this.activeOutOfWorkspaceWatchers.keys()].forEach(resource => {
|
||||
if (!visibleOutOfWorkspaceResources.get(resource)) {
|
||||
dispose(this.activeOutOfWorkspaceWatchers.get(resource));
|
||||
this.activeOutOfWorkspaceWatchers.delete(resource);
|
||||
|
||||
@@ -114,8 +114,13 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
@memoize
|
||||
get snippetsHome(): URI { return joinPath(this.userRoamingDataHome, 'snippets'); }
|
||||
|
||||
/*
|
||||
* In Web every workspace can potentially have scoped user-data and/or extensions and if Sync state is shared then it can make
|
||||
* Sync error prone - say removing extensions from another workspace. Hence scope Sync state per workspace.
|
||||
* Sync scoped to a workspace is capable of handling opening same workspace in multiple windows.
|
||||
*/
|
||||
@memoize
|
||||
get userDataSyncHome(): URI { return joinPath(this.userRoamingDataHome, 'sync'); }
|
||||
get userDataSyncHome(): URI { return joinPath(this.userRoamingDataHome, 'sync', this.options.workspaceId); }
|
||||
|
||||
@memoize
|
||||
get userDataSyncLogResource(): URI { return joinPath(this.options.logsPath, 'userDataSync.log'); }
|
||||
|
||||
@@ -17,6 +17,8 @@ import { trackFocus } from 'vs/base/browser/dom';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
|
||||
/**
|
||||
* A workspace to open in the workbench can either be:
|
||||
@@ -77,17 +79,15 @@ export class BrowserHostService extends Disposable implements IHostService {
|
||||
}
|
||||
}
|
||||
|
||||
private _onDidChangeFocus: Event<boolean> | undefined;
|
||||
@memoize
|
||||
get onDidChangeFocus(): Event<boolean> {
|
||||
if (!this._onDidChangeFocus) {
|
||||
const focusTracker = this._register(trackFocus(window));
|
||||
this._onDidChangeFocus = Event.any(
|
||||
Event.map(focusTracker.onDidFocus, () => this.hasFocus),
|
||||
Event.map(focusTracker.onDidBlur, () => this.hasFocus)
|
||||
);
|
||||
}
|
||||
const focusTracker = this._register(trackFocus(window));
|
||||
|
||||
return this._onDidChangeFocus;
|
||||
return Event.latch(Event.any(
|
||||
Event.map(focusTracker.onDidFocus, () => this.hasFocus),
|
||||
Event.map(focusTracker.onDidBlur, () => this.hasFocus),
|
||||
Event.map(domEvent(window.document, 'visibilitychange'), () => this.hasFocus)
|
||||
));
|
||||
}
|
||||
|
||||
get hasFocus(): boolean {
|
||||
|
||||
@@ -26,10 +26,10 @@ export class DesktopHostService extends Disposable implements IHostService {
|
||||
}
|
||||
|
||||
get onDidChangeFocus(): Event<boolean> { return this._onDidChangeFocus; }
|
||||
private _onDidChangeFocus: Event<boolean> = Event.any(
|
||||
private _onDidChangeFocus: Event<boolean> = Event.latch(Event.any(
|
||||
Event.map(Event.filter(this.electronService.onWindowFocus, id => id === this.environmentService.configuration.windowId), () => this.hasFocus),
|
||||
Event.map(Event.filter(this.electronService.onWindowBlur, id => id === this.environmentService.configuration.windowId), () => this.hasFocus)
|
||||
);
|
||||
));
|
||||
|
||||
get hasFocus(): boolean {
|
||||
return document.hasFocus();
|
||||
|
||||
@@ -57,7 +57,7 @@ export class ProgressService extends Disposable implements IProgressService {
|
||||
return this.withPanelProgress(location, task, { ...options, location });
|
||||
}
|
||||
|
||||
if (this.viewsService.getProgressIndicator(location)) {
|
||||
if (this.viewsService.getViewProgressIndicator(location)) {
|
||||
return this.withViewProgress(location, task, { ...options, location });
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ export class ProgressService extends Disposable implements IProgressService {
|
||||
private withViewProgress<P extends Promise<R>, R = unknown>(viewId: string, task: (progress: IProgress<IProgressStep>) => P, options: IProgressCompositeOptions): P {
|
||||
|
||||
// show in viewlet
|
||||
const promise = this.withCompositeProgress(this.viewsService.getProgressIndicator(viewId), task, options);
|
||||
const promise = this.withCompositeProgress(this.viewsService.getViewProgressIndicator(viewId), task, options);
|
||||
|
||||
const location = this.viewDescriptorService.getViewLocationById(viewId);
|
||||
if (location !== ViewContainerLocation.Sidebar) {
|
||||
|
||||
@@ -74,7 +74,7 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
const localResults = this.getLocalResults(query);
|
||||
|
||||
if (onProgress) {
|
||||
arrays.coalesce(localResults.results.values()).forEach(onProgress);
|
||||
arrays.coalesce([...localResults.results.values()]).forEach(onProgress);
|
||||
}
|
||||
|
||||
const onProviderProgress = (progress: ISearchProgressItem) => {
|
||||
@@ -99,7 +99,7 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
...{
|
||||
limitHit: otherResults.limitHit || localResults.limitHit
|
||||
},
|
||||
results: [...otherResults.results, ...arrays.coalesce(localResults.results.values())]
|
||||
results: [...otherResults.results, ...arrays.coalesce([...localResults.results.values()])]
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
|
||||
})();
|
||||
|
||||
get models(): TextFileEditorModel[] {
|
||||
return this.mapResourceToModel.values();
|
||||
return [...this.mapResourceToModel.values()];
|
||||
}
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { first } from 'vs/base/common/async';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IDisposable, toDisposable, IReference, ReferenceCollection, ImmortalReference } from 'vs/base/common/lifecycle';
|
||||
@@ -110,7 +109,6 @@ class ResourceModelCollection extends ReferenceCollection<Promise<ITextEditorMod
|
||||
private async resolveTextModelContent(key: string): Promise<ITextModel> {
|
||||
const resource = URI.parse(key);
|
||||
const providers = this.providers[resource.scheme] || [];
|
||||
const factories = providers.map(p => () => Promise.resolve(p.provideTextContent(resource)));
|
||||
|
||||
if (resource.query || resource.fragment) {
|
||||
type TextModelResolverUri = {
|
||||
@@ -127,12 +125,13 @@ class ResourceModelCollection extends ReferenceCollection<Promise<ITextEditorMod
|
||||
});
|
||||
}
|
||||
|
||||
const model = await first(factories);
|
||||
if (!model) {
|
||||
throw new Error('resource is not available');
|
||||
for (const provider of providers) {
|
||||
const value = await provider.provideTextContent(resource);
|
||||
if (value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return model;
|
||||
throw new Error('resource is not available');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ import { getParseErrorMessage } from 'vs/base/common/jsonErrorMessages';
|
||||
import { asCSSUrl } from 'vs/base/browser/dom';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { DEFAULT_PRODUCT_ICON_THEME_SETTING_VALUE } from 'vs/workbench/services/themes/common/themeConfiguration';
|
||||
import { fontIdRegex, fontWeightRegex, fontStyleRegex } from 'vs/workbench/services/themes/common/productIconThemeSchema';
|
||||
import { isString } from 'vs/base/common/types';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { getIconRegistry } from 'vs/platform/theme/common/iconRegistry';
|
||||
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
|
||||
const PERSISTED_PRODUCT_ICON_THEME_STORAGE_KEY = 'productIconThemeData';
|
||||
|
||||
@@ -38,22 +43,26 @@ export class ProductIconThemeData implements IWorkbenchProductIconTheme {
|
||||
this.isLoaded = false;
|
||||
}
|
||||
|
||||
public ensureLoaded(fileService: IFileService): Promise<string | undefined> {
|
||||
return !this.isLoaded ? this.load(fileService) : Promise.resolve(this.styleSheetContent);
|
||||
public ensureLoaded(fileService: IFileService, logService: ILogService): Promise<string | undefined> {
|
||||
return !this.isLoaded ? this.load(fileService, logService) : Promise.resolve(this.styleSheetContent);
|
||||
}
|
||||
|
||||
public reload(fileService: IFileService): Promise<string | undefined> {
|
||||
return this.load(fileService);
|
||||
public reload(fileService: IFileService, logService: ILogService): Promise<string | undefined> {
|
||||
return this.load(fileService, logService);
|
||||
}
|
||||
|
||||
private load(fileService: IFileService): Promise<string | undefined> {
|
||||
if (!this.location) {
|
||||
private load(fileService: IFileService, logService: ILogService): Promise<string | undefined> {
|
||||
const location = this.location;
|
||||
if (!location) {
|
||||
return Promise.resolve(this.styleSheetContent);
|
||||
}
|
||||
return _loadProductIconThemeDocument(fileService, this.location).then(iconThemeDocument => {
|
||||
const result = _processIconThemeDocument(this.id, this.location!, iconThemeDocument);
|
||||
return _loadProductIconThemeDocument(fileService, location).then(iconThemeDocument => {
|
||||
const result = _processIconThemeDocument(this.id, location, iconThemeDocument);
|
||||
this.styleSheetContent = result.content;
|
||||
this.isLoaded = true;
|
||||
if (result.warnings.length) {
|
||||
logService.error(nls.localize('error.parseicondefs', "Problems processing product icons definitions in {0}:\n{1}", location.toString(), result.warnings.join('\n')));
|
||||
}
|
||||
return this.styleSheetContent;
|
||||
});
|
||||
}
|
||||
@@ -174,9 +183,10 @@ function _loadProductIconThemeDocument(fileService: IFileService, location: URI)
|
||||
});
|
||||
}
|
||||
|
||||
function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, iconThemeDocument: ProductIconThemeDocument): { content: string; } {
|
||||
function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, iconThemeDocument: ProductIconThemeDocument): { content: string; warnings: string[] } {
|
||||
|
||||
const result = { content: '' };
|
||||
const warnings: string[] = [];
|
||||
const result = { content: '', warnings };
|
||||
|
||||
if (!iconThemeDocument.iconDefinitions || !Array.isArray(iconThemeDocument.fonts) || !iconThemeDocument.fonts.length) {
|
||||
return result;
|
||||
@@ -187,22 +197,72 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i
|
||||
return resources.joinPath(iconThemeDocumentLocationDirname, path);
|
||||
}
|
||||
|
||||
let cssRules: string[] = [];
|
||||
const cssRules: string[] = [];
|
||||
|
||||
let fonts = iconThemeDocument.fonts;
|
||||
const fonts = iconThemeDocument.fonts;
|
||||
const fontIdMapping: { [id: string]: string } = {};
|
||||
for (const font of fonts) {
|
||||
const src = font.src.map(l => `${asCSSUrl(resolvePath(l.path))} format('${l.format}')`).join(', ');
|
||||
cssRules.push(`@font-face { src: ${src}; font-family: '${font.id}'; font-weight: ${font.weight}; font-style: ${font.style}; }`);
|
||||
if (isString(font.id) && font.id.match(fontIdRegex)) {
|
||||
const fontId = `pi-` + font.id;
|
||||
fontIdMapping[font.id] = fontId;
|
||||
|
||||
let fontWeight = '';
|
||||
if (isString(font.weight) && font.weight.match(fontWeightRegex)) {
|
||||
fontWeight = `font-weight: ${font.weight};`;
|
||||
} else {
|
||||
warnings.push(nls.localize('error.fontWeight', 'Invalid font weight in font \'{0}\'. Ignoring setting.', font.id));
|
||||
}
|
||||
|
||||
let fontStyle = '';
|
||||
if (isString(font.style) && font.style.match(fontStyleRegex)) {
|
||||
fontStyle = `font-style: ${font.style};`;
|
||||
} else {
|
||||
warnings.push(nls.localize('error.fontStyle', 'Invalid font style in font \'{0}\'. Ignoring setting.', font.id));
|
||||
}
|
||||
|
||||
cssRules.push(`@font-face { src: ${src}; font-family: '${fontId}';${fontWeight}${fontStyle} }`);
|
||||
} else {
|
||||
warnings.push(nls.localize('error.fontId', 'Missing or invalid font id \'{0}\'. Skipping font definition.', font.id));
|
||||
}
|
||||
}
|
||||
|
||||
let primaryFontId = fonts[0].id;
|
||||
let iconDefinitions = iconThemeDocument.iconDefinitions;
|
||||
for (const iconId in iconThemeDocument.iconDefinitions) {
|
||||
const definition = iconDefinitions[iconId];
|
||||
if (definition && definition.fontCharacter) {
|
||||
cssRules.push(`.codicon-${iconId}:before { content: '${definition.fontCharacter}' !important; font-family: ${definition.fontId || primaryFontId} !important; }`);
|
||||
const primaryFontId = fonts.length > 0 ? fontIdMapping[fonts[0].id] : '';
|
||||
|
||||
const iconDefinitions = iconThemeDocument.iconDefinitions;
|
||||
const iconRegistry = getIconRegistry();
|
||||
|
||||
|
||||
for (let iconContribution of iconRegistry.getIcons()) {
|
||||
const iconId = iconContribution.id;
|
||||
|
||||
let definition = iconDefinitions[iconId];
|
||||
|
||||
// look if an inherited icon has a definition
|
||||
while (!definition && ThemeIcon.isThemeIcon(iconContribution.defaults)) {
|
||||
const ic = iconRegistry.getIcon(iconContribution.defaults.id);
|
||||
if (ic) {
|
||||
definition = iconDefinitions[ic.id];
|
||||
iconContribution = ic;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (definition) {
|
||||
if (isString(definition.fontCharacter)) {
|
||||
const fontId = definition.fontId !== undefined ? fontIdMapping[definition.fontId] : primaryFontId;
|
||||
if (fontId) {
|
||||
cssRules.push(`.codicon-${iconId}:before { content: '${definition.fontCharacter}' !important; font-family: ${fontId} !important; }`);
|
||||
} else {
|
||||
warnings.push(nls.localize('error.icon.fontId', 'Skipping icon definition \'{0}\'. Unknown font.', iconId));
|
||||
}
|
||||
} else {
|
||||
warnings.push(nls.localize('error.icon.fontCharacter', 'Skipping icon definition \'{0}\'. Unknown fontCharacter.', iconId));
|
||||
}
|
||||
}
|
||||
}
|
||||
result.content = cssRules.join('\n');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import { ThemeRegistry, registerColorThemeExtensionPoint, registerFileIconThemeE
|
||||
import { updateColorThemeConfigurationSchemas, updateFileIconThemeConfigurationSchemas, ThemeConfiguration, updateProductIconThemeConfigurationSchemas } from 'vs/workbench/services/themes/common/themeConfiguration';
|
||||
import { ProductIconThemeData, DEFAULT_PRODUCT_ICON_THEME_ID } from 'vs/workbench/services/themes/browser/productIconThemeData';
|
||||
import { registerProductIconThemeSchemas } from 'vs/workbench/services/themes/common/productIconThemeSchema';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
// implementation
|
||||
|
||||
@@ -99,7 +100,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@IExtensionResourceLoaderService private readonly extensionResourceLoaderService: IExtensionResourceLoaderService,
|
||||
@IWorkbenchLayoutService readonly layoutService: IWorkbenchLayoutService
|
||||
@IWorkbenchLayoutService readonly layoutService: IWorkbenchLayoutService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
) {
|
||||
this.container = layoutService.getWorkbenchContainer();
|
||||
this.settings = new ThemeConfiguration(configurationService);
|
||||
@@ -573,7 +575,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
|
||||
}
|
||||
|
||||
const newThemeData = await this.productIconThemeRegistry.findThemeById(iconTheme) || ProductIconThemeData.defaultTheme;
|
||||
await newThemeData.ensureLoaded(this.fileService);
|
||||
await newThemeData.ensureLoaded(this.fileService, this.logService);
|
||||
|
||||
this.applyAndSetProductIconTheme(newThemeData);
|
||||
|
||||
@@ -587,7 +589,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
|
||||
}
|
||||
|
||||
private async reloadCurrentProductIconTheme() {
|
||||
await this.currentProductIconTheme.reload(this.fileService);
|
||||
await this.currentProductIconTheme.reload(this.fileService, this.logService);
|
||||
this.applyAndSetProductIconTheme(this.currentProductIconTheme);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as nls from 'vs/nls';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Extensions as JSONExtensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { fontWeightRegex, fontStyleRegex, fontSizeRegex, fontIdRegex } from 'vs/workbench/services/themes/common/productIconThemeSchema';
|
||||
|
||||
const schemaId = 'vscode://schemas/icon-theme';
|
||||
const schema: IJSONSchema = {
|
||||
@@ -110,7 +111,9 @@ const schema: IJSONSchema = {
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.id', 'The ID of the font.')
|
||||
description: nls.localize('schema.id', 'The ID of the font.'),
|
||||
pattern: fontIdRegex,
|
||||
patternErrorMessage: nls.localize('schema.id.formatError', 'The ID must only contain letter, numbers, underscore and minus.')
|
||||
},
|
||||
src: {
|
||||
type: 'array',
|
||||
@@ -124,7 +127,8 @@ const schema: IJSONSchema = {
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.font-format', 'The format of the font.')
|
||||
description: nls.localize('schema.font-format', 'The format of the font.'),
|
||||
enum: ['woff', 'woff2', 'truetype', 'opentype', 'embedded-opentype', 'svg']
|
||||
}
|
||||
},
|
||||
required: [
|
||||
@@ -135,15 +139,18 @@ const schema: IJSONSchema = {
|
||||
},
|
||||
weight: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.font-weight', 'The weight of the font.')
|
||||
description: nls.localize('schema.font-weight', 'The weight of the font. See https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight for valid values.'),
|
||||
pattern: fontWeightRegex
|
||||
},
|
||||
style: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.font-sstyle', 'The style of the font.')
|
||||
description: nls.localize('schema.font-style', 'The style of the font. See https://developer.mozilla.org/en-US/docs/Web/CSS/font-style for valid values.'),
|
||||
pattern: fontStyleRegex
|
||||
},
|
||||
size: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.font-size', 'The default size of the font.')
|
||||
description: nls.localize('schema.font-size', 'The default size of the font. See https://developer.mozilla.org/en-US/docs/Web/CSS/font-size for valid values.'),
|
||||
pattern: fontSizeRegex
|
||||
}
|
||||
},
|
||||
required: [
|
||||
@@ -174,7 +181,8 @@ const schema: IJSONSchema = {
|
||||
},
|
||||
fontSize: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.fontSize', 'When using a font: The font size in percentage to the text font. If not set, defaults to the size in the font definition.')
|
||||
description: nls.localize('schema.fontSize', 'When using a font: The font size in percentage to the text font. If not set, defaults to the size in the font definition.'),
|
||||
pattern: fontSizeRegex
|
||||
},
|
||||
fontId: {
|
||||
type: 'string',
|
||||
|
||||
@@ -9,6 +9,10 @@ import { Extensions as JSONExtensions, IJSONContributionRegistry } from 'vs/plat
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { iconsSchemaId } from 'vs/platform/theme/common/iconRegistry';
|
||||
|
||||
export const fontIdRegex = '^([\\w-_]+)$';
|
||||
export const fontStyleRegex = '^(normal|italic|(oblique[ \\w\\s-]+))$';
|
||||
export const fontWeightRegex = '^(normal|bold|lighter|bolder|(\\d{0-1000}))$';
|
||||
export const fontSizeRegex = '^([\\w .%-_]+)$';
|
||||
|
||||
const schemaId = 'vscode://schemas/product-icon-theme';
|
||||
const schema: IJSONSchema = {
|
||||
@@ -18,13 +22,14 @@ const schema: IJSONSchema = {
|
||||
properties: {
|
||||
fonts: {
|
||||
type: 'array',
|
||||
description: nls.localize('schema.fonts', 'Fonts that are used in the icon definitions.'),
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.id', 'The ID of the font.')
|
||||
description: nls.localize('schema.id', 'The ID of the font.'),
|
||||
pattern: fontIdRegex,
|
||||
patternErrorMessage: nls.localize('schema.id.formatError', 'The ID must only contain letters, numbers, underscore and minus.')
|
||||
},
|
||||
src: {
|
||||
type: 'array',
|
||||
@@ -38,7 +43,8 @@ const schema: IJSONSchema = {
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.font-format', 'The format of the font.')
|
||||
description: nls.localize('schema.font-format', 'The format of the font.'),
|
||||
enum: ['woff', 'woff2', 'truetype', 'opentype', 'embedded-opentype', 'svg']
|
||||
}
|
||||
},
|
||||
required: [
|
||||
@@ -49,15 +55,19 @@ const schema: IJSONSchema = {
|
||||
},
|
||||
weight: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.font-weight', 'The weight of the font.')
|
||||
description: nls.localize('schema.font-weight', 'The weight of the font. See https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight for valid values.'),
|
||||
anyOf: [
|
||||
{ enum: ['normal', 'bold', 'lighter', 'bolder'] },
|
||||
{ type: 'string', pattern: fontWeightRegex }
|
||||
]
|
||||
},
|
||||
style: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.font-sstyle', 'The style of the font.')
|
||||
},
|
||||
size: {
|
||||
type: 'string',
|
||||
description: nls.localize('schema.font-size', 'The default size of the font.')
|
||||
description: nls.localize('schema.font-style', 'The style of the font. See https://developer.mozilla.org/en-US/docs/Web/CSS/font-style for valid values.'),
|
||||
anyOf: [
|
||||
{ enum: ['normal', 'italic', 'oblique'] },
|
||||
{ type: 'string', pattern: fontStyleRegex }
|
||||
]
|
||||
}
|
||||
},
|
||||
required: [
|
||||
|
||||
@@ -11,6 +11,7 @@ export const ITitleService = createDecorator<ITitleService>('titleService');
|
||||
export interface ITitleProperties {
|
||||
isPure?: boolean;
|
||||
isAdmin?: boolean;
|
||||
prefix?: string;
|
||||
}
|
||||
|
||||
export interface ITitleService {
|
||||
|
||||
@@ -30,11 +30,6 @@ export interface IViewletService {
|
||||
*/
|
||||
getActiveViewlet(): IViewlet | undefined;
|
||||
|
||||
/**
|
||||
* Returns the id of the default viewlet.
|
||||
*/
|
||||
getDefaultViewletId(): string;
|
||||
|
||||
/**
|
||||
* Returns the viewlet by id.
|
||||
*/
|
||||
|
||||
@@ -84,6 +84,9 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
readonly onDidChangeViewContainers: Event<{ added: ReadonlyArray<{ container: ViewContainer, location: ViewContainerLocation }>, removed: ReadonlyArray<{ container: ViewContainer, location: ViewContainerLocation }> }>;
|
||||
get viewContainers(): ReadonlyArray<ViewContainer> { return this.viewContainersRegistry.all; }
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@@ -107,7 +110,11 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
|
||||
this.cachedViewContainerInfo = this.getCachedViewContainerLocations();
|
||||
|
||||
// Register all containers that were registered before this ctor
|
||||
this.getViewContainers().forEach(viewContainer => this.onDidRegisterViewContainer(viewContainer));
|
||||
this.viewContainers.forEach(viewContainer => this.onDidRegisterViewContainer(viewContainer));
|
||||
this.onDidChangeViewContainers = Event.any<{ added: ReadonlyArray<{ container: ViewContainer, location: ViewContainerLocation }>, removed: ReadonlyArray<{ container: ViewContainer, location: ViewContainerLocation }> }>(
|
||||
Event.map(this.viewContainersRegistry.onDidRegister, e => ({ added: [{ container: e.viewContainer, location: e.viewContainerLocation }], removed: [] })),
|
||||
Event.map(this.viewContainersRegistry.onDidDeregister, e => ({ added: [], removed: [{ container: e.viewContainer, location: e.viewContainerLocation }] }))
|
||||
);
|
||||
|
||||
// Try generating all generated containers that don't need extensions
|
||||
this.tryGenerateContainers();
|
||||
@@ -293,11 +300,13 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
|
||||
getViewContainerById(id: string): ViewContainer | null {
|
||||
return this.viewContainersRegistry.get(id) || null;
|
||||
}
|
||||
|
||||
getViewContainersByLocation(location: ViewContainerLocation): ViewContainer[] {
|
||||
return this.getViewContainers().filter(v => this.getViewContainerLocation(v) === location);
|
||||
return this.viewContainers.filter(v => this.getViewContainerLocation(v) === location);
|
||||
}
|
||||
getViewContainers(): ViewContainer[] {
|
||||
return this.viewContainersRegistry.all;
|
||||
|
||||
getDefaultViewContainer(location: ViewContainerLocation): ViewContainer | undefined {
|
||||
return this.viewContainersRegistry.getDefaultViewContainer(location);
|
||||
}
|
||||
|
||||
moveViewContainerToLocation(viewContainer: ViewContainer, location: ViewContainerLocation): void {
|
||||
@@ -453,7 +462,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
|
||||
}
|
||||
|
||||
// If a value is not present in the cache, it must be reset to default
|
||||
this.getViewContainers().forEach(viewContainer => {
|
||||
this.viewContainers.forEach(viewContainer => {
|
||||
const viewContainerModel = this.getViewContainerModel(viewContainer);
|
||||
viewContainerModel.allViewDescriptors.forEach(viewDescriptor => {
|
||||
if (!newCachedPositions.has(viewDescriptor.id)) {
|
||||
@@ -486,7 +495,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
this.getViewContainers().forEach(viewContainer => {
|
||||
this.viewContainers.forEach(viewContainer => {
|
||||
if (!newCachedLocations.has(viewContainer.id)) {
|
||||
const currentLocation = this.getViewContainerLocation(viewContainer);
|
||||
const defaultLocation = this.getDefaultViewContainerLocation(viewContainer);
|
||||
@@ -526,7 +535,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
|
||||
}
|
||||
|
||||
private saveViewPositionsToCache(): void {
|
||||
this.getViewContainers().forEach(viewContainer => {
|
||||
this.viewContainers.forEach(viewContainer => {
|
||||
const viewContainerModel = this.getViewContainerModel(viewContainer);
|
||||
viewContainerModel.allViewDescriptors.forEach(viewDescriptor => {
|
||||
const containerLocation = this.getViewContainerLocation(viewContainer);
|
||||
|
||||
Reference in New Issue
Block a user