mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-29 16:20:29 -04:00
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:
@@ -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}; }`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user