Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229 (#8962)

* Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229

* skip failing tests

* update mac build image
This commit is contained in:
Anthony Dresser
2020-01-27 15:28:17 -08:00
committed by Karl Burtram
parent 0eaee18dc4
commit fefe1454de
481 changed files with 12764 additions and 7836 deletions

View File

@@ -126,6 +126,7 @@ export class Colorizer {
tabSize,
0,
0,
0,
-1,
'none',
false,
@@ -195,6 +196,7 @@ function _fakeColorize(lines: string[], tabSize: number): string {
tabSize,
0,
0,
0,
-1,
'none',
false,
@@ -233,6 +235,7 @@ function _actualColorize(lines: string[], tabSize: number, tokenizationSupport:
tabSize,
0,
0,
0,
-1,
'none',
false,

View File

@@ -655,8 +655,9 @@ export class SimpleBulkEditService implements IBulkEditService {
let array = edits.get(model);
if (!array) {
array = [];
edits.set(model, array);
}
edits.set(model, array.concat(edit.edits));
array.push(edit.edit);
}
}

View File

@@ -31,6 +31,7 @@ import { IAccessibilityService } from 'vs/platform/accessibility/common/accessib
import { StandaloneCodeEditorNLS } from 'vs/editor/common/standaloneStrings';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { StandaloneThemeServiceImpl } from 'vs/editor/standalone/browser/standaloneThemeServiceImpl';
/**
* Description of an action contribution
@@ -351,6 +352,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
@IAccessibilityService accessibilityService: IAccessibilityService
) {
applyConfigurationValues(configurationService, options, false);
const themeDomRegistration = (<StandaloneThemeServiceImpl>themeService).registerEditorContainer(domElement);
options = options || {};
if (typeof options.theme === 'string') {
themeService.setTheme(options.theme);
@@ -362,6 +364,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
this._contextViewService = <ContextViewService>contextViewService;
this._configurationService = configurationService;
this._register(toDispose);
this._register(themeDomRegistration);
let model: ITextModel | null;
if (typeof _model === 'undefined') {
@@ -430,6 +433,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
@optional(IClipboardService) clipboardService: IClipboardService | null,
) {
applyConfigurationValues(configurationService, options, true);
const themeDomRegistration = (<StandaloneThemeServiceImpl>themeService).registerEditorContainer(domElement);
options = options || {};
if (typeof options.theme === 'string') {
options.theme = themeService.setTheme(options.theme);
@@ -441,6 +445,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
this._configurationService = configurationService;
this._register(toDispose);
this._register(themeDomRegistration);
this._contextViewService.setContainer(this._containerDomElement);
}

View File

@@ -45,9 +45,9 @@ import { MenuService } from 'vs/platform/actions/common/menuService';
import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService';
import { MarkerDecorationsService } from 'vs/editor/common/services/markerDecorationsServiceImpl';
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
import { BrowserAccessibilityService } from 'vs/platform/accessibility/common/accessibilityService';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
import { getSingletonServiceDescriptors } from 'vs/platform/instantiation/common/extensions';
import { AccessibilityService } from 'vs/platform/accessibility/common/accessibilityService';
export interface IEditorOverrideServices {
[index: string]: any;
@@ -192,7 +192,7 @@ export class DynamicStandaloneServices extends Disposable {
let contextKeyService = ensure(IContextKeyService, () => this._register(new ContextKeyService(configurationService)));
ensure(IAccessibilityService, () => new BrowserAccessibilityService(contextKeyService, configurationService));
ensure(IAccessibilityService, () => new AccessibilityService(contextKeyService, configurationService));
ensure(IListService, () => new ListService(themeService));

View File

@@ -5,7 +5,7 @@
import * as dom from 'vs/base/browser/dom';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { Emitter } from 'vs/base/common/event';
import { TokenizationRegistry } from 'vs/editor/common/modes';
import { ITokenThemeRule, TokenTheme, generateTokensCSSForColorMap } from 'vs/editor/common/modes/supports/tokenization';
import { BuiltinTheme, IStandaloneTheme, IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
@@ -14,6 +14,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { Registry } from 'vs/platform/registry/common/platform';
import { ColorIdentifier, Extensions, IColorRegistry } from 'vs/platform/theme/common/colorRegistry';
import { Extensions as ThemingExtensions, ICssStyleCollector, IIconTheme, IThemingRegistry } from 'vs/platform/theme/common/themeService';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
const VS_THEME_NAME = 'vs';
const VS_DARK_THEME_NAME = 'vs-dark';
@@ -163,32 +164,68 @@ function newBuiltInTheme(builtinTheme: BuiltinTheme): StandaloneTheme {
return new StandaloneTheme(builtinTheme, themeData);
}
export class StandaloneThemeServiceImpl implements IStandaloneThemeService {
export class StandaloneThemeServiceImpl extends Disposable implements IStandaloneThemeService {
_serviceBrand: undefined;
private readonly _onThemeChange = this._register(new Emitter<IStandaloneTheme>());
public readonly onThemeChange = this._onThemeChange.event;
private readonly _onIconThemeChange = this._register(new Emitter<IIconTheme>());
public readonly onIconThemeChange = this._onIconThemeChange.event;
private readonly _environment: IEnvironmentService = Object.create(null);
private readonly _knownThemes: Map<string, StandaloneTheme>;
private readonly _styleElement: HTMLStyleElement;
private _css: string;
private _globalStyleElement: HTMLStyleElement | null;
private _styleElements: HTMLStyleElement[];
private _theme!: IStandaloneTheme;
private readonly _onThemeChange: Emitter<IStandaloneTheme>;
private readonly _onIconThemeChange: Emitter<IIconTheme>;
private readonly environment: IEnvironmentService = Object.create(null);
constructor() {
this._onThemeChange = new Emitter<IStandaloneTheme>();
this._onIconThemeChange = new Emitter<IIconTheme>();
super();
this._knownThemes = new Map<string, StandaloneTheme>();
this._knownThemes.set(VS_THEME_NAME, newBuiltInTheme(VS_THEME_NAME));
this._knownThemes.set(VS_DARK_THEME_NAME, newBuiltInTheme(VS_DARK_THEME_NAME));
this._knownThemes.set(HC_BLACK_THEME_NAME, newBuiltInTheme(HC_BLACK_THEME_NAME));
this._styleElement = dom.createStyleSheet();
this._styleElement.className = 'monaco-colors';
this._css = '';
this._globalStyleElement = null;
this._styleElements = [];
this.setTheme(VS_THEME_NAME);
}
public get onThemeChange(): Event<IStandaloneTheme> {
return this._onThemeChange.event;
public registerEditorContainer(domNode: HTMLElement): IDisposable {
if (dom.isInShadowDOM(domNode)) {
return this._registerShadowDomContainer(domNode);
}
return this._registerRegularEditorContainer();
}
private _registerRegularEditorContainer(): IDisposable {
if (!this._globalStyleElement) {
this._globalStyleElement = dom.createStyleSheet();
this._globalStyleElement.className = 'monaco-colors';
this._globalStyleElement.innerHTML = this._css;
this._styleElements.push(this._globalStyleElement);
}
return Disposable.None;
}
private _registerShadowDomContainer(domNode: HTMLElement): IDisposable {
const styleElement = dom.createStyleSheet(domNode);
styleElement.className = 'monaco-colors';
styleElement.innerHTML = this._css;
this._styleElements.push(styleElement);
return {
dispose: () => {
for (let i = 0; i < this._styleElements.length; i++) {
if (this._styleElements[i] === styleElement) {
this._styleElements.splice(i, 1);
return;
}
}
}
};
}
public defineTheme(themeName: string, themeData: IStandaloneThemeData): void {
@@ -240,13 +277,14 @@ export class StandaloneThemeServiceImpl implements IStandaloneThemeService {
}
}
};
themingRegistry.getThemingParticipants().forEach(p => p(theme, ruleCollector, this.environment));
themingRegistry.getThemingParticipants().forEach(p => p(theme, ruleCollector, this._environment));
let tokenTheme = theme.tokenTheme;
let colorMap = tokenTheme.getColorMap();
ruleCollector.addRule(generateTokensCSSForColorMap(colorMap));
this._styleElement.innerHTML = cssRules.join('\n');
this._css = cssRules.join('\n');
this._styleElements.forEach(styleElement => styleElement.innerHTML = this._css);
TokenizationRegistry.setColorMap(colorMap);
this._onThemeChange.fire(theme);
@@ -261,8 +299,4 @@ export class StandaloneThemeServiceImpl implements IStandaloneThemeService {
hidesExplorerArrows: false
};
}
public get onIconThemeChange(): Event<IIconTheme> {
return this._onIconThemeChange.event;
}
}