Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 307 B

View File

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 307 B

View File

@@ -15,10 +15,9 @@ import Event, { Emitter } from 'vs/base/common/event';
import * as dom from 'vs/base/browser/dom';
import { ActionBar, IActionBarOptions } from 'vs/base/browser/ui/actionbar/actionbar';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ICommonCodeEditor } from 'vs/editor/common/editorCommon';
import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IOptions, ZoneWidget, IStyles } from 'vs/editor/contrib/zoneWidget/browser/zoneWidget';
import { IOptions, ZoneWidget, IStyles } from 'vs/editor/contrib/zoneWidget/zoneWidget';
import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget';
import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { Color } from 'vs/base/common/color';
@@ -28,7 +27,7 @@ export namespace PeekContext {
export const notInPeekEditor: ContextKeyExpr = inPeekEditor.toNegated();
}
export function getOuterEditor(accessor: ServicesAccessor): ICommonCodeEditor {
export function getOuterEditor(accessor: ServicesAccessor): ICodeEditor {
let editor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
if (editor instanceof EmbeddedCodeEditorWidget) {
return editor.getParentEditor();

View File

@@ -15,7 +15,7 @@ import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRe
import { Position, IPosition } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { editorAction, ServicesAccessor, EditorAction, CommonEditorRegistry, commonEditorContribution } from 'vs/editor/common/editorCommonExtensions';
import { registerEditorAction, ServicesAccessor, EditorAction, registerEditorContribution, registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions';
import { Location, ReferenceProviderRegistry } from 'vs/editor/common/modes';
import { PeekContext, getOuterEditor } from './peekViewWidget';
import { ReferencesController, RequestOptions, ctxReferenceSearchVisible } from './referencesController';
@@ -24,6 +24,7 @@ import { asWinJsPromise } from 'vs/base/common/async';
import { onUnexpectedExternalError } from 'vs/base/common/errors';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget';
import { ICodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser';
const defaultReferenceSearchOptions: RequestOptions = {
getMetaTitle(model) {
@@ -31,13 +32,12 @@ const defaultReferenceSearchOptions: RequestOptions = {
}
};
@commonEditorContribution
export class ReferenceController implements editorCommon.IEditorContribution {
private static ID = 'editor.contrib.referenceController';
private static readonly ID = 'editor.contrib.referenceController';
constructor(
editor: editorCommon.ICommonCodeEditor,
editor: ICodeEditor,
@IContextKeyService contextKeyService: IContextKeyService
) {
if (editor instanceof EmbeddedCodeEditorWidget) {
@@ -53,7 +53,6 @@ export class ReferenceController implements editorCommon.IEditorContribution {
}
}
@editorAction
export class ReferenceAction extends EditorAction {
constructor() {
@@ -76,7 +75,7 @@ export class ReferenceAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: editorCommon.ICommonCodeEditor): void {
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
let controller = ReferencesController.get(editor);
if (!controller) {
return;
@@ -88,6 +87,10 @@ export class ReferenceAction extends EditorAction {
}
}
registerEditorContribution(ReferenceController);
registerEditorAction(ReferenceAction);
let findReferencesCommand: ICommandHandler = (accessor: ServicesAccessor, resource: URI, position: IPosition) => {
if (!(resource instanceof URI)) {
@@ -100,7 +103,7 @@ let findReferencesCommand: ICommandHandler = (accessor: ServicesAccessor, resour
return accessor.get(IEditorService).openEditor({ resource }).then(editor => {
let control = editor.getControl();
if (!editorCommon.isCommonCodeEditor(control)) {
if (!isCodeEditor(control)) {
return undefined;
}
@@ -123,7 +126,7 @@ let showReferencesCommand: ICommandHandler = (accessor: ServicesAccessor, resour
return accessor.get(IEditorService).openEditor({ resource: resource }).then(editor => {
let control = editor.getControl();
if (!editorCommon.isCommonCodeEditor(control)) {
if (!isCodeEditor(control)) {
return undefined;
}
@@ -177,7 +180,7 @@ function closeActiveReferenceSearch(accessor: ServicesAccessor, args: any) {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'closeReferenceSearch',
weight: CommonEditorRegistry.commandWeight(50),
weight: KeybindingsRegistry.WEIGHT.editorContrib(50),
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape],
when: ContextKeyExpr.and(ctxReferenceSearchVisible, ContextKeyExpr.not('config.editor.stablePeek')),
@@ -186,7 +189,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'closeReferenceSearchEditor',
weight: CommonEditorRegistry.commandWeight(-101),
weight: KeybindingsRegistry.WEIGHT.editorContrib(-101),
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape],
when: ContextKeyExpr.and(PeekContext.inPeekEditor, ContextKeyExpr.not('config.editor.stablePeek')),
@@ -221,4 +224,4 @@ export function provideReferences(model: editorCommon.IReadOnlyModel, position:
});
}
CommonEditorRegistry.registerDefaultLanguageCommand('_executeReferenceProvider', provideReferences);
registerDefaultLanguageCommand('_executeReferenceProvider', provideReferences);

View File

@@ -10,17 +10,15 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import Severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
import { IEditorService } from 'vs/platform/editor/common/editor';
import { fromPromise, stopwatch } from 'vs/base/common/event';
import { IInstantiationService, optional } from 'vs/platform/instantiation/common/instantiation';
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IMessageService } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { editorContribution } from 'vs/editor/browser/editorBrowserExtensions';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { ReferencesModel, OneReference } from './referencesModel';
import { ReferenceWidget, LayoutData } from './referencesWidget';
import { Range } from 'vs/editor/common/core/range';
@@ -36,10 +34,9 @@ export interface RequestOptions {
onGoto?: (reference: OneReference) => TPromise<any>;
}
@editorContribution
export class ReferencesController implements editorCommon.IEditorContribution {
private static ID = 'editor.contrib.referencesController';
private static readonly ID = 'editor.contrib.referencesController';
private _editor: ICodeEditor;
private _widget: ReferenceWidget;
@@ -50,7 +47,7 @@ export class ReferencesController implements editorCommon.IEditorContribution {
private _referenceSearchVisible: IContextKey<boolean>;
public static get(editor: editorCommon.ICommonCodeEditor): ReferencesController {
public static get(editor: ICodeEditor): ReferencesController {
return editor.getContribution<ReferencesController>(ReferencesController.ID);
}
@@ -59,7 +56,6 @@ export class ReferencesController implements editorCommon.IEditorContribution {
@IContextKeyService contextKeyService: IContextKeyService,
@IEditorService private _editorService: IEditorService,
@ITextModelService private _textModelResolverService: ITextModelService,
@ITelemetryService private _telemetryService: ITelemetryService,
@IMessageService private _messageService: IMessageService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IWorkspaceContextService private _contextService: IWorkspaceContextService,
@@ -144,7 +140,7 @@ export class ReferencesController implements editorCommon.IEditorContribution {
const requestId = ++this._requestIdPool;
const promise = modelPromise.then(model => {
modelPromise.then(model => {
// still current request? widget still open?
if (requestId !== this._requestIdPool || !this._widget) {
@@ -157,23 +153,6 @@ export class ReferencesController implements editorCommon.IEditorContribution {
this._model = model;
// measure time it stays open
const startTime = Date.now();
this._disposables.push({
dispose: () => {
/* __GDPR__
"zoneWidgetShown" : {
"mode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"elapsedTime": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this._telemetryService.publicLog('zoneWidgetShown', {
mode: 'reference search',
elapsedTime: Date.now() - startTime
});
}
});
// show widget
return this._widget.setModel(this._model).then(() => {
@@ -193,20 +172,6 @@ export class ReferencesController implements editorCommon.IEditorContribution {
}, error => {
this._messageService.show(Severity.Error, error);
});
const onDone = stopwatch(fromPromise(promise));
const mode = this._editor.getModel().getLanguageIdentifier().language;
/* __GDPR__
"findReferences" : {
"durarion" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
"mode": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
onDone(duration => this._telemetryService.publicLog('findReferences', {
duration,
mode
}));
}
public closeWidget(): void {
@@ -270,3 +235,5 @@ export class ReferencesController implements editorCommon.IEditorContribution {
}
}
}
registerEditorContribution(ReferencesController);

View File

@@ -5,8 +5,7 @@
'use strict';
import { localize } from 'vs/nls';
import { EventEmitter } from 'vs/base/common/eventEmitter';
import Event, { fromEventEmitter } from 'vs/base/common/event';
import Event, { Emitter } from 'vs/base/common/event';
import { basename, dirname } from 'vs/base/common/paths';
import { IDisposable, dispose, IReference } from 'vs/base/common/lifecycle';
import * as strings from 'vs/base/common/strings';
@@ -19,13 +18,14 @@ import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/r
import { Position } from 'vs/editor/common/core/position';
export class OneReference {
private _id: string;
private _onRefChanged = new Emitter<this>();
readonly onRefChanged: Event<this> = this._onRefChanged.event;
constructor(
private _parent: FileReferences,
private _range: IRange,
private _eventBus: EventEmitter
private _range: IRange
) {
this._id = defaultGenerator.nextId();
}
@@ -60,7 +60,7 @@ export class OneReference {
public set range(value: IRange) {
this._range = value;
this._eventBus.emit('ref/changed', this);
this._onRefChanged.fire(this);
}
public getAriaMessage(): string {
@@ -197,14 +197,15 @@ export class FileReferences implements IDisposable {
export class ReferencesModel implements IDisposable {
private readonly _disposables: IDisposable[];
private _groups: FileReferences[] = [];
private _references: OneReference[] = [];
private _eventBus = new EventEmitter();
private _onDidChangeReferenceRange = new Emitter<OneReference>();
onDidChangeReferenceRange: Event<OneReference> = fromEventEmitter<OneReference>(this._eventBus, 'ref/changed');
onDidChangeReferenceRange: Event<OneReference> = this._onDidChangeReferenceRange.event;
constructor(references: Location[]) {
this._disposables = [];
// grouping and sorting
references.sort(ReferencesModel._compareReferences);
@@ -220,7 +221,8 @@ export class ReferencesModel implements IDisposable {
if (current.children.length === 0
|| !Range.equalsRange(ref.range, current.children[current.children.length - 1].range)) {
let oneRef = new OneReference(current, ref.range, this._eventBus);
let oneRef = new OneReference(current, ref.range);
this._disposables.push(oneRef.onRefChanged((e) => this._onDidChangeReferenceRange.fire(e)));
this._references.push(oneRef);
current.children.push(oneRef);
}
@@ -297,6 +299,8 @@ export class ReferencesModel implements IDisposable {
dispose(): void {
this._groups = dispose(this._groups);
dispose(this._disposables);
this._disposables.length = 0;
}
private static _compareReferences(a: Location, b: Location): number {

View File

@@ -45,7 +45,7 @@ import URI from 'vs/base/common/uri';
class DecorationsManager implements IDisposable {
private static DecorationOptions = ModelDecorationOptions.register({
private static readonly DecorationOptions = ModelDecorationOptions.register({
stickiness: editorCommon.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
className: 'reference-decoration'
});
@@ -218,11 +218,14 @@ class DataSource implements tree.IDataSource {
class Controller extends DefaultController {
static Events = {
FOCUSED: 'events/custom/focused',
SELECTED: 'events/custom/selected',
OPEN_TO_SIDE: 'events/custom/opentoside'
};
private _onDidFocus = new Emitter<any>();
readonly onDidFocus: Event<any> = this._onDidFocus.event;
private _onDidSelect = new Emitter<any>();
readonly onDidSelect: Event<any> = this._onDidSelect.event;
private _onDidOpenToSide = new Emitter<any>();
readonly onDidOpenToSide: Event<any> = this._onDidOpenToSide.event;
public onTap(tree: tree.ITree, element: any, event: GestureEvent): boolean {
if (element instanceof FileReferences) {
@@ -232,7 +235,8 @@ class Controller extends DefaultController {
}
var result = super.onTap(tree, element, event);
tree.emit(Controller.Events.FOCUSED, element);
this._onDidFocus.fire(element);
return result;
}
@@ -246,11 +250,11 @@ class Controller extends DefaultController {
var result = super.onClick(tree, element, event);
if (event.ctrlKey || event.metaKey) {
tree.emit(Controller.Events.OPEN_TO_SIDE, element);
this._onDidOpenToSide.fire(element);
} else if (event.detail === 2) {
tree.emit(Controller.Events.SELECTED, element);
this._onDidSelect.fire(element);
} else {
tree.emit(Controller.Events.FOCUSED, element);
this._onDidFocus.fire(element);
}
return result;
}
@@ -288,9 +292,9 @@ class Controller extends DefaultController {
var result = super.onEnter(tree, event);
if (event.ctrlKey || event.metaKey) {
tree.emit(Controller.Events.OPEN_TO_SIDE, element);
this._onDidOpenToSide.fire(element);
} else {
tree.emit(Controller.Events.SELECTED, element);
this._onDidSelect.fire(element);
}
return result;
}
@@ -336,7 +340,13 @@ class Controller extends DefaultController {
var focus = tree.getFocus();
tree.setSelection([focus]);
// send out event
tree.emit(Controller.Events.FOCUSED, focus);
this._onDidFocus.fire(focus);
}
dispose(): void {
this._onDidFocus.dispose();
this._onDidSelect.dispose();
this._onDidOpenToSide.dispose();
}
}
@@ -409,7 +419,7 @@ class OneReferenceTemplate {
class Renderer implements tree.IRenderer {
private static _ids = {
private static readonly _ids = {
FileReferences: 'FileReferences',
OneReference: 'OneReference'
};
@@ -493,11 +503,11 @@ class VSash {
// compute the current widget clientX postion since
// the sash works with clientX when dragging
let clientX: number;
this._disposables.push(this._sash.addListener('start', (e: ISashEvent) => {
this._disposables.push(this._sash.onDidStart((e: ISashEvent) => {
clientX = e.startX - (this._width * this.ratio);
}));
this._disposables.push(this._sash.addListener('change', (e: ISashEvent) => {
this._disposables.push(this._sash.onDidChange((e: ISashEvent) => {
// compute the new position of the sash and from that
// compute the new ratio that we are using
let newLeft = e.currentX - clientX;
@@ -676,13 +686,33 @@ export class ReferenceWidget extends PeekViewWidget {
// tree
container.div({ 'class': 'ref-tree inline' }, (div: Builder) => {
const controller = new Controller();
var config = <tree.ITreeConfiguration>{
dataSource: this._instantiationService.createInstance(DataSource),
renderer: this._instantiationService.createInstance(Renderer),
controller: new Controller(),
controller,
accessibilityProvider: new AriaProvider()
};
// listen on selection and focus
this._disposables.push(controller.onDidFocus((element) => {
if (element instanceof OneReference) {
this._revealReference(element);
this._onDidSelectReference.fire({ element, kind: 'show', source: 'tree' });
}
}));
this._disposables.push(controller.onDidSelect((element: any) => {
if (element instanceof OneReference) {
this._onDidSelectReference.fire({ element, kind: 'goto', source: 'tree' });
}
}));
this._disposables.push(controller.onDidOpenToSide((element: any) => {
if (element instanceof OneReference) {
this._onDidSelectReference.fire({ element, kind: 'side', source: 'tree' });
}
}));
var options = {
allowHorizontalScroll: false,
twistiePixels: 20,
@@ -752,25 +782,6 @@ export class ReferenceWidget extends PeekViewWidget {
// listen on model changes
this._disposeOnNewModel.push(this._model.onDidChangeReferenceRange(reference => this._tree.refresh(reference)));
// listen on selection and focus
this._disposeOnNewModel.push(this._tree.addListener(Controller.Events.FOCUSED, (element) => {
if (element instanceof OneReference) {
this._revealReference(element);
this._onDidSelectReference.fire({ element, kind: 'show', source: 'tree' });
}
}));
this._disposeOnNewModel.push(this._tree.addListener(Controller.Events.SELECTED, (element: any) => {
if (element instanceof OneReference) {
this._onDidSelectReference.fire({ element, kind: 'goto', source: 'tree' });
}
}));
this._disposeOnNewModel.push(this._tree.addListener(Controller.Events.OPEN_TO_SIDE, (element: any) => {
if (element instanceof OneReference) {
this._onDidSelectReference.fire({ element, kind: 'side', source: 'tree' });
}
}));
// listen on editor
this._disposeOnNewModel.push(this._preview.onMouseDown((e) => {
if (e.event.detail === 2) {

View File

@@ -8,7 +8,7 @@ import * as assert from 'assert';
import URI from 'vs/base/common/uri';
import { Range } from 'vs/editor/common/core/range';
import { Position } from 'vs/editor/common/core/position';
import { ReferencesModel } from 'vs/editor/contrib/referenceSearch/browser/referencesModel';
import { ReferencesModel } from 'vs/editor/contrib/referenceSearch/referencesModel';
suite('references', function () {