mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-24 13:50:29 -04:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -111,7 +111,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
private _replaceFocusTracker: dom.IFocusTracker;
|
||||
private _replaceInputFocused: IContextKey<boolean>;
|
||||
private _viewZone: FindWidgetViewZone;
|
||||
private _viewZoneId: number;
|
||||
private _viewZoneId?: number;
|
||||
|
||||
private _resizeSash: Sash;
|
||||
private _resized: boolean;
|
||||
@@ -210,7 +210,9 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
return;
|
||||
}
|
||||
this._codeEditor.changeViewZones((accessor) => {
|
||||
accessor.removeZone(this._viewZoneId);
|
||||
if (this._viewZoneId) {
|
||||
accessor.removeZone(this._viewZoneId);
|
||||
}
|
||||
this._viewZoneId = undefined;
|
||||
});
|
||||
}));
|
||||
@@ -239,7 +241,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
return this._domNode;
|
||||
}
|
||||
|
||||
public getPosition(): IOverlayWidgetPosition {
|
||||
public getPosition(): IOverlayWidgetPosition | null {
|
||||
if (this._isVisible) {
|
||||
return {
|
||||
preference: OverlayWidgetPositionPreference.TOP_RIGHT_CORNER
|
||||
@@ -401,8 +403,8 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
if (!this._isVisible) {
|
||||
this._isVisible = true;
|
||||
|
||||
let selection = this._codeEditor.getSelection();
|
||||
let isSelection = selection ? (selection.startLineNumber !== selection.endLineNumber || selection.startColumn !== selection.endColumn) : false;
|
||||
const selection = this._codeEditor.getSelection();
|
||||
const isSelection = selection ? (selection.startLineNumber !== selection.endLineNumber || selection.startColumn !== selection.endColumn) : false;
|
||||
if (isSelection && this._codeEditor.getConfiguration().contribInfo.find.autoFindInSelection) {
|
||||
this._toggleSelectionFind.checked = true;
|
||||
} else {
|
||||
@@ -425,24 +427,27 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
|
||||
let adjustEditorScrollTop = true;
|
||||
if (this._codeEditor.getConfiguration().contribInfo.find.seedSearchStringFromSelection && selection) {
|
||||
let editorCoords = dom.getDomNodePagePosition(this._codeEditor.getDomNode());
|
||||
let startCoords = this._codeEditor.getScrolledVisiblePosition(selection.getStartPosition());
|
||||
let startLeft = editorCoords.left + startCoords.left;
|
||||
let startTop = startCoords.top;
|
||||
const domNode = this._codeEditor.getDomNode();
|
||||
if (domNode) {
|
||||
const editorCoords = dom.getDomNodePagePosition(domNode);
|
||||
const startCoords = this._codeEditor.getScrolledVisiblePosition(selection.getStartPosition());
|
||||
const startLeft = editorCoords.left + (startCoords ? startCoords.left : 0);
|
||||
const startTop = startCoords ? startCoords.top : 0;
|
||||
|
||||
if (startTop < this._viewZone.heightInPx) {
|
||||
if (selection.endLineNumber > selection.startLineNumber) {
|
||||
adjustEditorScrollTop = false;
|
||||
}
|
||||
if (startTop < this._viewZone.heightInPx) {
|
||||
if (selection.endLineNumber > selection.startLineNumber) {
|
||||
adjustEditorScrollTop = false;
|
||||
}
|
||||
|
||||
let leftOfFindWidget = dom.getTopLeftOffset(this._domNode).left;
|
||||
if (startLeft > leftOfFindWidget) {
|
||||
adjustEditorScrollTop = false;
|
||||
}
|
||||
let endCoords = this._codeEditor.getScrolledVisiblePosition(selection.getEndPosition());
|
||||
let endLeft = editorCoords.left + endCoords.left;
|
||||
if (endLeft > leftOfFindWidget) {
|
||||
adjustEditorScrollTop = false;
|
||||
const leftOfFindWidget = dom.getTopLeftOffset(this._domNode).left;
|
||||
if (startLeft > leftOfFindWidget) {
|
||||
adjustEditorScrollTop = false;
|
||||
}
|
||||
const endCoords = this._codeEditor.getScrolledVisiblePosition(selection.getEndPosition());
|
||||
const endLeft = editorCoords.left + (endCoords ? endCoords.left : 0);
|
||||
if (endLeft > leftOfFindWidget) {
|
||||
adjustEditorScrollTop = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -609,12 +614,16 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
}
|
||||
|
||||
private _updateSearchScope(): void {
|
||||
if (!this._codeEditor.hasModel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._toggleSelectionFind.checked) {
|
||||
let selection = this._codeEditor.getSelection();
|
||||
if (selection.endColumn === 1 && selection.endLineNumber > selection.startLineNumber) {
|
||||
selection = selection.setEndPosition(selection.endLineNumber - 1, this._codeEditor.getModel().getLineMaxColumn(selection.endLineNumber - 1));
|
||||
}
|
||||
let currentMatch = this._state.currentMatch;
|
||||
const currentMatch = this._state.currentMatch;
|
||||
if (selection.startLineNumber !== selection.endLineNumber) {
|
||||
if (!Range.equalsRange(selection, currentMatch)) {
|
||||
// Reseed find scope
|
||||
@@ -634,13 +643,13 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
private _onFindInputKeyDown(e: IKeyboardEvent): void {
|
||||
|
||||
if (e.equals(KeyCode.Enter)) {
|
||||
this._codeEditor.getAction(FIND_IDS.NextMatchFindAction).run().then(null, onUnexpectedError);
|
||||
this._codeEditor.getAction(FIND_IDS.NextMatchFindAction).run().then(undefined, onUnexpectedError);
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.equals(KeyMod.Shift | KeyCode.Enter)) {
|
||||
this._codeEditor.getAction(FIND_IDS.PreviousMatchFindAction).run().then(null, onUnexpectedError);
|
||||
this._codeEditor.getAction(FIND_IDS.PreviousMatchFindAction).run().then(undefined, onUnexpectedError);
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
@@ -725,7 +734,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
appendCaseSensitiveLabel: this._keybindingLabelFor(FIND_IDS.ToggleCaseSensitiveCommand),
|
||||
appendWholeWordsLabel: this._keybindingLabelFor(FIND_IDS.ToggleWholeWordCommand),
|
||||
appendRegexLabel: this._keybindingLabelFor(FIND_IDS.ToggleRegexCommand),
|
||||
validation: (value: string): InputBoxMessage => {
|
||||
validation: (value: string): InputBoxMessage | null => {
|
||||
if (value.length === 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -780,7 +789,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
label: NLS_PREVIOUS_MATCH_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.PreviousMatchFindAction),
|
||||
className: 'previous',
|
||||
onTrigger: () => {
|
||||
this._codeEditor.getAction(FIND_IDS.PreviousMatchFindAction).run().then(null, onUnexpectedError);
|
||||
this._codeEditor.getAction(FIND_IDS.PreviousMatchFindAction).run().then(undefined, onUnexpectedError);
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -789,7 +798,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
label: NLS_NEXT_MATCH_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.NextMatchFindAction),
|
||||
className: 'next',
|
||||
onTrigger: () => {
|
||||
this._codeEditor.getAction(FIND_IDS.NextMatchFindAction).run().then(null, onUnexpectedError);
|
||||
this._codeEditor.getAction(FIND_IDS.NextMatchFindAction).run().then(undefined, onUnexpectedError);
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -806,15 +815,17 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
title: NLS_TOGGLE_SELECTION_FIND_TITLE + this._keybindingLabelFor(FIND_IDS.ToggleSearchScopeCommand),
|
||||
onChange: () => {
|
||||
if (this._toggleSelectionFind.checked) {
|
||||
let selection = this._codeEditor.getSelection();
|
||||
if (selection.endColumn === 1 && selection.endLineNumber > selection.startLineNumber) {
|
||||
selection = selection.setEndPosition(selection.endLineNumber - 1, this._codeEditor.getModel().getLineMaxColumn(selection.endLineNumber - 1));
|
||||
}
|
||||
if (!selection.isEmpty()) {
|
||||
this._state.change({ searchScope: selection }, true);
|
||||
if (this._codeEditor.hasModel()) {
|
||||
let selection = this._codeEditor.getSelection();
|
||||
if (selection.endColumn === 1 && selection.endLineNumber > selection.startLineNumber) {
|
||||
selection = selection.setEndPosition(selection.endLineNumber - 1, this._codeEditor.getModel().getLineMaxColumn(selection.endLineNumber - 1));
|
||||
}
|
||||
if (!selection.isEmpty()) {
|
||||
this._state.change({ searchScope: selection }, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this._state.change({ searchScope: null }, true);
|
||||
this._state.change({ searchScope: undefined }, true);
|
||||
}
|
||||
}
|
||||
}));
|
||||
@@ -824,7 +835,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: null }, false);
|
||||
this._state.change({ isRevealed: false, searchScope: undefined }, false);
|
||||
},
|
||||
onKeyDown: (e) => {
|
||||
if (e.equals(KeyCode.Tab)) {
|
||||
@@ -850,7 +861,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
let replaceInput = document.createElement('div');
|
||||
replaceInput.className = 'replace-input';
|
||||
replaceInput.style.width = REPLACE_INPUT_AREA_WIDTH + 'px';
|
||||
this._replaceInputBox = this._register(new ContextScopedHistoryInputBox(replaceInput, null, {
|
||||
this._replaceInputBox = this._register(new ContextScopedHistoryInputBox(replaceInput, undefined, {
|
||||
ariaLabel: NLS_REPLACE_INPUT_LABEL,
|
||||
placeholder: NLS_REPLACE_INPUT_PLACEHOLDER,
|
||||
history: []
|
||||
@@ -950,8 +961,8 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
return;
|
||||
}
|
||||
|
||||
let inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH;
|
||||
let maxWidth = parseFloat(dom.getComputedStyle(this._domNode).maxWidth) || 0;
|
||||
const inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH;
|
||||
const maxWidth = parseFloat(dom.getComputedStyle(this._domNode).maxWidth!) || 0;
|
||||
if (width > maxWidth) {
|
||||
return;
|
||||
}
|
||||
@@ -1119,7 +1130,7 @@ export class SimpleButton extends Widget {
|
||||
// theming
|
||||
|
||||
registerThemingParticipant((theme, collector) => {
|
||||
const addBackgroundColorRule = (selector: string, color: Color): void => {
|
||||
const addBackgroundColorRule = (selector: string, color: Color | null): void => {
|
||||
if (color) {
|
||||
collector.addRule(`.monaco-editor ${selector} { background-color: ${color}; }`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user