Vscode merge (#4582)

* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd

* fix issues with merges

* bump node version in azpipe

* replace license headers

* remove duplicate launch task

* fix build errors

* fix build errors

* fix tslint issues

* working through package and linux build issues

* more work

* wip

* fix packaged builds

* working through linux build errors

* wip

* wip

* wip

* fix mac and linux file limits

* iterate linux pipeline

* disable editor typing

* revert series to parallel

* remove optimize vscode from linux

* fix linting issues

* revert testing change

* add work round for new node

* readd packaging for extensions

* fix issue with angular not resolving decorator dependencies
This commit is contained in:
Anthony Dresser
2019-03-19 17:44:35 -07:00
committed by GitHub
parent 833d197412
commit 87765e8673
1879 changed files with 54505 additions and 38058 deletions

View File

@@ -71,12 +71,12 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
private static readonly ID = 'editor.contrib.findController';
protected _editor: ICodeEditor;
private _findWidgetVisible: IContextKey<boolean>;
private readonly _findWidgetVisible: IContextKey<boolean>;
protected _state: FindReplaceState;
protected _updateHistoryDelayer: Delayer<void>;
private _model: FindModelBoundToEditorModel | null;
private _storageService: IStorageService;
private _clipboardService: IClipboardService;
private readonly _storageService: IStorageService;
private readonly _clipboardService: IClipboardService;
protected readonly _contextKeyService: IContextKeyService;
public static get(editor: ICodeEditor): CommonFindController {

View File

@@ -14,7 +14,7 @@ import { themeColorFromId } from 'vs/platform/theme/common/themeService';
export class FindDecorations implements IDisposable {
private _editor: IActiveCodeEditor;
private readonly _editor: IActiveCodeEditor;
private _decorations: string[];
private _overviewRulerApproximateDecorations: string[];
private _findScopeDecorationId: string | null;

View File

@@ -69,14 +69,14 @@ const RESEARCH_DELAY = 240;
export class FindModelBoundToEditorModel {
private _editor: IActiveCodeEditor;
private _state: FindReplaceState;
private readonly _editor: IActiveCodeEditor;
private readonly _state: FindReplaceState;
private _toDispose: IDisposable[];
private _decorations: FindDecorations;
private readonly _decorations: FindDecorations;
private _ignoreModelContentChanged: boolean;
private _startSearchingTimer: TimeoutTimer;
private readonly _startSearchingTimer: TimeoutTimer;
private _updateDecorationsScheduler: RunOnceScheduler;
private readonly _updateDecorationsScheduler: RunOnceScheduler;
private _isDisposed: boolean;
constructor(editor: IActiveCodeEditor, state: FindReplaceState) {

View File

@@ -18,14 +18,14 @@ export class FindOptionsWidget extends Widget implements IOverlayWidget {
private static readonly ID = 'editor.contrib.findOptionsWidget';
private _editor: ICodeEditor;
private _state: FindReplaceState;
private _keybindingService: IKeybindingService;
private readonly _editor: ICodeEditor;
private readonly _state: FindReplaceState;
private readonly _keybindingService: IKeybindingService;
private _domNode: HTMLElement;
private regex: RegexCheckbox;
private wholeWords: WholeWordsCheckbox;
private caseSensitive: CaseSensitiveCheckbox;
private readonly _domNode: HTMLElement;
private readonly regex: RegexCheckbox;
private readonly wholeWords: WholeWordsCheckbox;
private readonly caseSensitive: CaseSensitiveCheckbox;
constructor(
editor: ICodeEditor,
@@ -46,7 +46,7 @@ export class FindOptionsWidget extends Widget implements IOverlayWidget {
this._domNode.setAttribute('role', 'presentation');
this._domNode.setAttribute('aria-hidden', 'true');
const inputActiveOptionBorderColor = themeService.getTheme().getColor(inputActiveOptionBorder) || undefined;
const inputActiveOptionBorderColor = themeService.getTheme().getColor(inputActiveOptionBorder);
this.caseSensitive = this._register(new CaseSensitiveCheckbox({
appendTitle: this._keybindingLabelFor(FIND_IDS.ToggleCaseSensitiveCommand),
@@ -179,7 +179,7 @@ export class FindOptionsWidget extends Widget implements IOverlayWidget {
}
private _applyTheme(theme: ITheme) {
let inputStyles = { inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder) || undefined };
let inputStyles = { inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder) };
this.caseSensitive.style(inputStyles);
this.wholeWords.style(inputStyles);
this.regex.style(inputStyles);

View File

@@ -79,10 +79,6 @@
height: 25px;
}
.monaco-editor .find-widget > .find-part .monaco-inputbox > .wrapper > .input {
width: 100% !important;
padding-right: 66px;
}
.monaco-editor .find-widget > .find-part .monaco-inputbox > .wrapper > .input,
.monaco-editor .find-widget > .replace-part .monaco-inputbox > .wrapper > .input {
padding-top: 2px;

View File

@@ -29,7 +29,8 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { contrastBorder, editorFindMatch, editorFindMatchBorder, editorFindMatchHighlight, editorFindMatchHighlightBorder, editorFindRangeHighlight, editorFindRangeHighlightBorder, editorWidgetBackground, editorWidgetBorder, editorWidgetResizeBorder, errorForeground, inputActiveOptionBorder, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
import { ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { ContextScopedFindInput, ContextScopedHistoryInputBox } from 'vs/platform/widget/browser/contextScopedHistoryWidget';
import { ContextScopedFindInput, ContextScopedHistoryInputBox } from 'vs/platform/browser/contextScopedHistoryWidget';
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
export interface IFindController {
replace(): void;
@@ -83,8 +84,8 @@ export class FindWidgetViewZone implements IViewZone {
export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSashLayoutProvider {
private static readonly ID = 'editor.contrib.findWidget';
private readonly _codeEditor: ICodeEditor;
private _state: FindReplaceState;
private _controller: IFindController;
private readonly _state: FindReplaceState;
private readonly _controller: IFindController;
private readonly _contextViewProvider: IContextViewProvider;
private readonly _keybindingService: IKeybindingService;
private readonly _contextKeyService: IContextKeyService;
@@ -106,16 +107,16 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
private _isReplaceVisible: boolean;
private _ignoreChangeEvent: boolean;
private _findFocusTracker: dom.IFocusTracker;
private _findInputFocused: IContextKey<boolean>;
private _replaceFocusTracker: dom.IFocusTracker;
private _replaceInputFocused: IContextKey<boolean>;
private _viewZone: FindWidgetViewZone;
private readonly _findFocusTracker: dom.IFocusTracker;
private readonly _findInputFocused: IContextKey<boolean>;
private readonly _replaceFocusTracker: dom.IFocusTracker;
private readonly _replaceInputFocused: IContextKey<boolean>;
private _viewZone?: FindWidgetViewZone;
private _viewZoneId?: number;
private _resizeSash: Sash;
private _resized: boolean;
private _updateHistoryDelayer: Delayer<void>;
private readonly _updateHistoryDelayer: Delayer<void>;
constructor(
codeEditor: ICodeEditor,
@@ -160,6 +161,17 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
if (e.accessibilitySupport) {
this.updateAccessibilitySupport();
}
if (e.contribInfo) {
const addExtraSpaceOnTop = this._codeEditor.getConfiguration().contribInfo.find.addExtraSpaceOnTop;
if (addExtraSpaceOnTop && !this._viewZone) {
this._viewZone = new FindWidgetViewZone(0);
this._showViewZone();
}
if (!addExtraSpaceOnTop && this._viewZone) {
this._removeViewZone();
}
}
}));
this.updateAccessibilitySupport();
this._register(this._codeEditor.onDidChangeCursorSelection(() => {
@@ -197,7 +209,9 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
}));
this._codeEditor.addOverlayWidget(this);
this._viewZone = new FindWidgetViewZone(0); // Put it before the first line then users can scroll beyond the first line.
if (this._codeEditor.getConfiguration().contribInfo.find.addExtraSpaceOnTop) {
this._viewZone = new FindWidgetViewZone(0); // Put it before the first line then users can scroll beyond the first line.
}
this._applyTheme(themeService.getTheme());
this._register(themeService.onThemeChange(this._applyTheme.bind(this)));
@@ -434,7 +448,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
const startLeft = editorCoords.left + (startCoords ? startCoords.left : 0);
const startTop = startCoords ? startCoords.top : 0;
if (startTop < this._viewZone.heightInPx) {
if (this._viewZone && startTop < this._viewZone.heightInPx) {
if (selection.endLineNumber > selection.startLineNumber) {
adjustEditorScrollTop = false;
}
@@ -468,40 +482,42 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
this._codeEditor.focus();
}
this._codeEditor.layoutOverlayWidget(this);
this._codeEditor.changeViewZones((accessor) => {
if (this._viewZoneId !== undefined) {
accessor.removeZone(this._viewZoneId);
this._viewZoneId = undefined;
this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() - this._viewZone.heightInPx);
}
});
this._removeViewZone();
}
}
private _layoutViewZone() {
if (!this._isVisible) {
const addExtraSpaceOnTop = this._codeEditor.getConfiguration().contribInfo.find.addExtraSpaceOnTop;
if (!addExtraSpaceOnTop) {
this._removeViewZone();
return;
}
if (this._viewZoneId !== undefined) {
if (!this._isVisible) {
return;
}
const viewZone = this._viewZone;
if (this._viewZoneId !== undefined || !viewZone) {
return;
}
this._codeEditor.changeViewZones((accessor) => {
if (this._state.isReplaceRevealed) {
this._viewZone.heightInPx = FIND_REPLACE_AREA_HEIGHT;
viewZone.heightInPx = FIND_REPLACE_AREA_HEIGHT;
} else {
this._viewZone.heightInPx = FIND_INPUT_AREA_HEIGHT;
viewZone.heightInPx = FIND_INPUT_AREA_HEIGHT;
}
this._viewZoneId = accessor.addZone(this._viewZone);
this._viewZoneId = accessor.addZone(viewZone);
// scroll top adjust to make sure the editor doesn't scroll when adding viewzone at the beginning.
this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() + this._viewZone.heightInPx);
this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() + viewZone.heightInPx);
});
}
private _showViewZone(adjustScroll: boolean = true) {
if (!this._isVisible) {
const viewZone = this._viewZone;
if (!this._isVisible || !viewZone) {
return;
}
@@ -510,17 +526,17 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
if (this._viewZoneId !== undefined) {
if (this._state.isReplaceRevealed) {
this._viewZone.heightInPx = FIND_REPLACE_AREA_HEIGHT;
viewZone.heightInPx = FIND_REPLACE_AREA_HEIGHT;
scrollAdjustment = FIND_REPLACE_AREA_HEIGHT - FIND_INPUT_AREA_HEIGHT;
} else {
this._viewZone.heightInPx = FIND_INPUT_AREA_HEIGHT;
viewZone.heightInPx = FIND_INPUT_AREA_HEIGHT;
scrollAdjustment = FIND_INPUT_AREA_HEIGHT - FIND_REPLACE_AREA_HEIGHT;
}
accessor.removeZone(this._viewZoneId);
} else {
this._viewZone.heightInPx = FIND_INPUT_AREA_HEIGHT;
viewZone.heightInPx = FIND_INPUT_AREA_HEIGHT;
}
this._viewZoneId = accessor.addZone(this._viewZone);
this._viewZoneId = accessor.addZone(viewZone);
if (adjustScroll) {
this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() + scrollAdjustment);
@@ -528,6 +544,19 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
});
}
private _removeViewZone() {
this._codeEditor.changeViewZones((accessor) => {
if (this._viewZoneId !== undefined) {
accessor.removeZone(this._viewZoneId);
this._viewZoneId = undefined;
if (this._viewZone) {
this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() - this._viewZone.heightInPx);
this._viewZone = undefined;
}
}
});
}
private _applyTheme(theme: ITheme) {
let inputStyles: IFindInputStyles = {
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder),
@@ -542,7 +571,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder),
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground),
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground),
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder)
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder),
};
this._findInput.style(inputStyles);
this._replaceInputBox.style(inputStyles);
@@ -825,7 +854,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
}
}
} else {
this._state.change({ searchScope: undefined }, true);
this._state.change({ searchScope: null }, true);
}
}
}));
@@ -835,7 +864,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
label: NLS_CLOSE_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.CloseFindWidgetCommand),
className: 'close-fw',
onTrigger: () => {
this._state.change({ isRevealed: false, searchScope: undefined }, false);
this._state.change({ isRevealed: false, searchScope: null }, false);
},
onKeyDown: (e) => {
if (e.equals(KeyCode.Tab)) {
@@ -975,7 +1004,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
private updateAccessibilitySupport(): void {
const value = this._codeEditor.getConfiguration().accessibilitySupport;
this._findInput.setFocusInputOnOptionClick(value !== platform.AccessibilitySupport.Enabled);
this._findInput.setFocusInputOnOptionClick(value !== AccessibilitySupport.Enabled);
}
}
@@ -1130,7 +1159,7 @@ export class SimpleButton extends Widget {
// theming
registerThemingParticipant((theme, collector) => {
const addBackgroundColorRule = (selector: string, color: Color | null): void => {
const addBackgroundColorRule = (selector: string, color: Color | undefined): void => {
if (color) {
collector.addRule(`.monaco-editor ${selector} { background-color: ${color}; }`);
}

View File

@@ -15,10 +15,10 @@ interface IEditOperation {
export class ReplaceAllCommand implements editorCommon.ICommand {
private _editorSelection: Selection;
private readonly _editorSelection: Selection;
private _trackedEditorSelectionId: string;
private _ranges: Range[];
private _replaceStrings: string[];
private readonly _ranges: Range[];
private readonly _replaceStrings: string[];
constructor(editorSelection: Selection, ranges: Range[], replaceStrings: string[]) {
this._editorSelection = editorSelection;

View File

@@ -16,6 +16,7 @@
}
.monaco-workbench .simple-find-part {
visibility: hidden; /* Use visibility to maintain flex layout while hidden otherwise interferes with transition */
z-index: 10;
position: relative;
top: -45px;
@@ -27,6 +28,10 @@
}
.monaco-workbench .simple-find-part.visible {
visibility: visible;
}
.monaco-workbench .simple-find-part.visible-transition {
top: 0;
}
@@ -34,10 +39,6 @@
flex: 1;
}
.monaco-workbench .simple-find-part .monaco-findInput .monaco-inputbox .wrapper .input {
width: 100% !important;
}
.monaco-workbench .simple-find-part .button {
min-width: 20px;
width: 20px;

View File

@@ -6,7 +6,7 @@
import 'vs/css!./simpleFindWidget';
import * as nls from 'vs/nls';
import * as dom from 'vs/base/browser/dom';
import { FindInput } from 'vs/base/browser/ui/findinput/findInput';
import { FindInput, IFindInputStyles } from 'vs/base/browser/ui/findinput/findInput';
import { Widget } from 'vs/base/browser/ui/widget';
import { Delayer } from 'vs/base/common/async';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
@@ -16,7 +16,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { editorWidgetBackground, inputActiveOptionBorder, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
import { ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { ContextScopedFindInput } from 'vs/platform/widget/browser/contextScopedHistoryWidget';
import { ContextScopedFindInput } from 'vs/platform/browser/contextScopedHistoryWidget';
const NLS_FIND_INPUT_LABEL = nls.localize('label.find', "Find");
const NLS_FIND_INPUT_PLACEHOLDER = nls.localize('placeholder.find', "Find");
@@ -25,13 +25,13 @@ const NLS_NEXT_MATCH_BTN_LABEL = nls.localize('label.nextMatchButton', "Next mat
const NLS_CLOSE_BTN_LABEL = nls.localize('label.closeButton', "Close");
export abstract class SimpleFindWidget extends Widget {
private _findInput: FindInput;
private _domNode?: HTMLElement;
private _innerDomNode: HTMLElement;
private readonly _findInput: FindInput;
private readonly _domNode: HTMLElement;
private readonly _innerDomNode: HTMLElement;
private _isVisible: boolean = false;
private _focusTracker: dom.IFocusTracker;
private _findInputFocusTracker: dom.IFocusTracker;
private _updateHistoryDelayer: Delayer<void>;
private readonly _focusTracker: dom.IFocusTracker;
private readonly _findInputFocusTracker: dom.IFocusTracker;
private readonly _updateHistoryDelayer: Delayer<void>;
constructor(
@IContextViewService private readonly _contextViewService: IContextViewService,
@@ -159,7 +159,7 @@ export abstract class SimpleFindWidget extends Widget {
}
public updateTheme(theme: ITheme): void {
const inputStyles = {
const inputStyles: IFindInputStyles = {
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder),
inputBackground: theme.getColor(inputBackground),
inputForeground: theme.getColor(inputForeground),
@@ -182,7 +182,6 @@ export abstract class SimpleFindWidget extends Widget {
if (this._domNode && this._domNode.parentElement) {
this._domNode.parentElement.removeChild(this._domNode);
this._domNode = undefined;
}
}
@@ -204,10 +203,9 @@ export abstract class SimpleFindWidget extends Widget {
setTimeout(() => {
dom.addClass(this._innerDomNode, 'visible');
dom.addClass(this._innerDomNode, 'visible-transition');
this._innerDomNode.setAttribute('aria-hidden', 'false');
setTimeout(() => {
this._findInput.select();
}, 200);
this._findInput.select();
}, 0);
}
@@ -220,16 +218,20 @@ export abstract class SimpleFindWidget extends Widget {
setTimeout(() => {
dom.addClass(this._innerDomNode, 'visible');
dom.addClass(this._innerDomNode, 'visible-transition');
this._innerDomNode.setAttribute('aria-hidden', 'false');
}, 0);
}
public hide(): void {
if (this._isVisible) {
this._isVisible = false;
dom.removeClass(this._innerDomNode, 'visible');
dom.removeClass(this._innerDomNode, 'visible-transition');
this._innerDomNode.setAttribute('aria-hidden', 'true');
// Need to delay toggling visibility until after Transition, then visibility hidden - removes from tabIndex list
setTimeout(() => {
this._isVisible = false;
dom.removeClass(this._innerDomNode, 'visible');
}, 200);
}
}

View File

@@ -65,7 +65,7 @@ suite('FindController', () => {
onWillSaveState: Event.None,
get: (key: string) => queryState[key],
getBoolean: (key: string) => !!queryState[key],
getInteger: (key: string) => undefined,
getNumber: (key: string) => undefined,
store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); },
remove: (key) => undefined
} as any);
@@ -440,7 +440,7 @@ suite('FindController query options persistence', () => {
onWillSaveState: Event.None,
get: (key: string) => queryState[key],
getBoolean: (key: string) => !!queryState[key],
getInteger: (key: string) => undefined,
getNumber: (key: string) => undefined,
store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); },
remove: (key) => undefined
} as any);

View File

@@ -1507,7 +1507,7 @@ suite('FindModel', () => {
]
);
editor.getModel().setValue('hello\nhi');
editor!.getModel()!.setValue('hello\nhi');
assertFindState(
editor,
[1, 1, 1, 1],
@@ -1538,7 +1538,7 @@ suite('FindModel', () => {
findModel.selectAllMatches();
assert.deepEqual(editor.getSelections().map(s => s.toString()), [
assert.deepEqual(editor!.getSelections()!.map(s => s.toString()), [
new Selection(6, 14, 6, 19),
new Selection(6, 27, 6, 32),
new Selection(7, 14, 7, 19),
@@ -1582,14 +1582,14 @@ suite('FindModel', () => {
findModel.selectAllMatches();
assert.deepEqual(editor.getSelections().map(s => s.toString()), [
assert.deepEqual(editor!.getSelections()!.map(s => s.toString()), [
new Selection(7, 14, 7, 19),
new Selection(6, 14, 6, 19),
new Selection(6, 27, 6, 32),
new Selection(8, 14, 8, 19)
].map(s => s.toString()));
assert.deepEqual(editor.getSelection().toString(), new Selection(7, 14, 7, 19).toString());
assert.deepEqual(editor!.getSelection()!.toString(), new Selection(7, 14, 7, 19).toString());
assertFindState(
editor,
@@ -1984,7 +1984,7 @@ suite('FindModel', () => {
for (let i = 0; i < 1100; i++) {
initialText += 'line' + i + '\n';
}
editor.getModel().setValue(initialText);
editor!.getModel()!.setValue(initialText);
let findState = new FindReplaceState();
findState.change({ searchString: '^', replaceString: 'a ', isRegex: true }, false);
let findModel = new FindModelBoundToEditorModel(editor, findState);
@@ -1996,7 +1996,7 @@ suite('FindModel', () => {
expectedText += 'a line' + i + '\n';
}
expectedText += 'a ';
assert.equal(editor.getModel().getValue(), expectedText);
assert.equal(editor!.getModel()!.getValue(), expectedText);
findModel.dispose();
findState.dispose();