提交 d8969035 编写于 作者: M Matt Bierner

Strict null supressesions in themes.test

上级 d94ce50f
......@@ -662,6 +662,7 @@
"./vs/workbench/contrib/terminal/test/node/terminalCommandTracker.test.ts",
"./vs/workbench/contrib/terminal/test/node/terminalEnvironment.test.ts",
"./vs/workbench/contrib/themes/electron-browser/themes.contribution.ts",
"./vs/workbench/contrib/themes/test/electron-browser/themes.test.contribution.ts",
"./vs/workbench/contrib/url/electron-browser/url.contribution.ts",
"./vs/workbench/contrib/webview/electron-browser/webviewProtocols.ts",
"./vs/workbench/electron-browser/window.ts",
......@@ -772,6 +773,7 @@
"./vs/workbench/test/browser/viewlet.test.ts",
"./vs/workbench/test/common/editor/editorOptions.test.ts",
"./vs/workbench/test/common/notifications.test.ts",
"./vs/workbench/test/electron-browser/api/extHost.api.impl.test.ts",
"./vs/workbench/test/electron-browser/api/extHostDocumentData.test.ts",
"./vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts",
"./vs/workbench/test/electron-browser/api/extHostTypes.test.ts",
......
......@@ -69,7 +69,7 @@ class ThemeDocument {
return this._generateExplanation('default', color);
}
let expected = Color.fromHex(matchingRule.settings.foreground);
let expected = Color.fromHex(matchingRule.settings.foreground!);
if (!color.equals(expected)) {
throw new Error(`[${this._theme.label}]: Unexpected color ${Color.Format.CSS.formatHexA(color)} for ${scopes}. Expected ${Color.Format.CSS.formatHexA(expected)} coming in from ${matchingRule.rawSelector}`);
}
......@@ -78,7 +78,7 @@ class ThemeDocument {
private _findMatchingThemeRule(scopes: string): ThemeRule {
if (!this._cache[scopes]) {
this._cache[scopes] = findMatchingThemeRule(this._theme, scopes.split(' '));
this._cache[scopes] = findMatchingThemeRule(this._theme, scopes.split(' '))!;
}
return this._cache[scopes];
}
......@@ -112,7 +112,7 @@ class Snapper {
result[resultLen++] = {
text: tokenText,
color: colorMap[color]
color: colorMap![color]
};
}
......@@ -178,16 +178,16 @@ class Snapper {
let defaultThemes = themeDatas.filter(themeData => !!getThemeName(themeData.id));
for (let defaultTheme of defaultThemes) {
let themeId = defaultTheme.id;
let success = await this.themeService.setColorTheme(themeId, null);
let success = await this.themeService.setColorTheme(themeId, undefined);
if (success) {
let themeName = getThemeName(themeId);
result[themeName] = {
result[themeName!] = {
document: new ThemeDocument(this.themeService.getColorTheme()),
tokens: this._themedTokenize(grammar, lines)
};
}
}
await this.themeService.setColorTheme(currentTheme.id, null);
await this.themeService.setColorTheme(currentTheme.id, undefined);
return result;
}
......@@ -215,7 +215,7 @@ class Snapper {
public captureSyntaxTokens(fileName: string, content: string): Promise<IToken[]> {
const modeId = this.modeService.getModeIdByFilepathOrFirstLine(fileName);
return this.textMateService.createGrammar(modeId).then((grammar) => {
return this.textMateService.createGrammar(modeId!).then((grammar) => {
let lines = content.split(/\r\n|\r|\n/);
let result = this._tokenize(grammar, lines);
......@@ -240,8 +240,8 @@ CommandsRegistry.registerCommand('_workbench.captureSyntaxTokens', function (acc
};
if (!resource) {
let editorService = accessor.get(IEditorService);
let file = toResource(editorService.activeEditor, { filter: 'file' });
const editorService = accessor.get(IEditorService);
const file = editorService.activeEditor ? toResource(editorService.activeEditor, { filter: 'file' }) : null;
if (file) {
process(file).then(result => {
console.log(result);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册