提交 4e68ba25 编写于 作者: M Martin Aeschlimann

[themes] fix integration test on Windows

上级 c283296b
......@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { toSlashes } from 'vs/base/common/extpath';
import { basename } from 'vs/base/common/path';
import * as Json from 'vs/base/common/json';
import { Color } from 'vs/base/common/color';
......@@ -21,6 +20,7 @@ import { getParseErrorMessage } from 'vs/base/common/jsonErrorMessages';
import { URI } from 'vs/base/common/uri';
import { IFileService } from 'vs/platform/files/common/files';
import { parse as parsePList } from 'vs/workbench/services/themes/common/plistParser';
import { startsWith } from 'vs/base/common/strings';
let colorRegistry = Registry.as<IColorRegistry>(Extensions.ColorContribution);
......@@ -259,8 +259,7 @@ export class ColorThemeData implements IColorTheme {
static fromExtensionTheme(theme: IThemeExtensionPoint, colorThemeLocation: URI, extensionData: ExtensionData): ColorThemeData {
let baseTheme: string = theme['uiTheme'] || 'vs-dark';
let themeSelector = toCSSSelector(extensionData.extensionId + '-' + toSlashes(theme.path));
let themeSelector = toCSSSelector(extensionData.extensionId, theme.path);
let themeData = new ColorThemeData();
themeData.id = `${baseTheme} ${themeSelector}`;
themeData.label = theme.label || basename(theme.path);
......@@ -274,7 +273,13 @@ export class ColorThemeData implements IColorTheme {
}
}
function toCSSSelector(str: string) {
function toCSSSelector(extensionId: string, path: string) {
if (startsWith(path, './')) {
path = path.substr(2);
}
let str = `${extensionId}-${path}`;
//remove all characters that are not allowed in css
str = str.replace(/[^_\-a-zA-Z0-9]/g, '-');
if (str.charAt(0).match(/[0-9\-]/)) {
str = '_' + str;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册