mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 09:35:41 -05:00
Merge from vscode 8df646d3c5477b02737fc10343fa7cf0cc3f606b
This commit is contained in:
@@ -42,8 +42,8 @@ class MsPointerHandler extends MouseHandler implements IDisposable {
|
||||
constructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) {
|
||||
super(context, viewController, viewHelper);
|
||||
|
||||
this.viewHelper.linesContentDomNode.style.msTouchAction = 'none';
|
||||
this.viewHelper.linesContentDomNode.style.msContentZooming = 'none';
|
||||
(this.viewHelper.linesContentDomNode.style as any).msTouchAction = 'none';
|
||||
(this.viewHelper.linesContentDomNode.style as any).msContentZooming = 'none';
|
||||
|
||||
// TODO@Alex -> this expects that the view is added in 100 ms, might not be the case
|
||||
// This handler should be added when the dom node is in the dom tree
|
||||
|
||||
@@ -349,7 +349,7 @@ export class TextAreaHandler extends ViewPart {
|
||||
private _getAriaLabel(options: IComputedEditorOptions): string {
|
||||
const accessibilitySupport = options.get(EditorOption.accessibilitySupport);
|
||||
if (accessibilitySupport === AccessibilitySupport.Disabled) {
|
||||
return nls.localize('accessibilityOffAriaLabel', "The editor is not accessible at this time. Press Alt+F1 for options.");
|
||||
return nls.localize('accessibilityOffAriaLabel', "The editor is not accessible at this time. Press {0} for options.", platform.isLinux ? 'Shift+Alt+F1' : 'Alt+F1');
|
||||
}
|
||||
return options.get(EditorOption.ariaLabel);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ export abstract class AbstractLineHighlightOverlay extends DynamicViewOverlay {
|
||||
protected _contentLeft: number;
|
||||
protected _contentWidth: number;
|
||||
protected _selectionIsEmpty: boolean;
|
||||
protected _renderLineHightlightOnlyWhenFocus: boolean;
|
||||
protected _focused: boolean;
|
||||
private _cursorLineNumbers: number[];
|
||||
private _selections: Selection[];
|
||||
private _renderData: string[] | null;
|
||||
@@ -35,9 +37,11 @@ export abstract class AbstractLineHighlightOverlay extends DynamicViewOverlay {
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._renderLineHighlight = options.get(EditorOption.renderLineHighlight);
|
||||
this._renderLineHightlightOnlyWhenFocus = options.get(EditorOption.renderLineHighlightOnlyWhenFocus);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
this._selectionIsEmpty = true;
|
||||
this._focused = false;
|
||||
this._cursorLineNumbers = [];
|
||||
this._selections = [];
|
||||
this._renderData = null;
|
||||
@@ -81,6 +85,7 @@ export abstract class AbstractLineHighlightOverlay extends DynamicViewOverlay {
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._lineHeight = options.get(EditorOption.lineHeight);
|
||||
this._renderLineHighlight = options.get(EditorOption.renderLineHighlight);
|
||||
this._renderLineHightlightOnlyWhenFocus = options.get(EditorOption.renderLineHighlightOnlyWhenFocus);
|
||||
this._contentLeft = layoutInfo.contentLeft;
|
||||
this._contentWidth = layoutInfo.contentWidth;
|
||||
return true;
|
||||
@@ -104,6 +109,14 @@ export abstract class AbstractLineHighlightOverlay extends DynamicViewOverlay {
|
||||
public onZonesChanged(e: viewEvents.ViewZonesChangedEvent): boolean {
|
||||
return true;
|
||||
}
|
||||
public onFocusChanged(e: viewEvents.ViewFocusChangedEvent): boolean {
|
||||
if (!this._renderLineHightlightOnlyWhenFocus) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._focused = e.isFocused;
|
||||
return true;
|
||||
}
|
||||
// --- end event handlers
|
||||
|
||||
public prepareRender(ctx: RenderingContext): void {
|
||||
@@ -157,11 +170,13 @@ export class CurrentLineHighlightOverlay extends AbstractLineHighlightOverlay {
|
||||
return (
|
||||
(this._renderLineHighlight === 'line' || this._renderLineHighlight === 'all')
|
||||
&& this._selectionIsEmpty
|
||||
&& (!this._renderLineHightlightOnlyWhenFocus || this._focused)
|
||||
);
|
||||
}
|
||||
protected _shouldRenderOther(): boolean {
|
||||
return (
|
||||
(this._renderLineHighlight === 'gutter' || this._renderLineHighlight === 'all')
|
||||
&& (!this._renderLineHightlightOnlyWhenFocus || this._focused)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -174,12 +189,14 @@ export class CurrentLineMarginHighlightOverlay extends AbstractLineHighlightOver
|
||||
protected _shouldRenderThis(): boolean {
|
||||
return (
|
||||
(this._renderLineHighlight === 'gutter' || this._renderLineHighlight === 'all')
|
||||
&& (!this._renderLineHightlightOnlyWhenFocus || this._focused)
|
||||
);
|
||||
}
|
||||
protected _shouldRenderOther(): boolean {
|
||||
return (
|
||||
(this._renderLineHighlight === 'line' || this._renderLineHighlight === 'all')
|
||||
&& this._selectionIsEmpty
|
||||
&& (!this._renderLineHightlightOnlyWhenFocus || this._focused)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,6 +546,11 @@ export interface IEditorOptions {
|
||||
* Defaults to all.
|
||||
*/
|
||||
renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all';
|
||||
/**
|
||||
* Control if the current line highlight should be rendered only the editor is focused.
|
||||
* Defaults to false.
|
||||
*/
|
||||
renderLineHighlightOnlyWhenFocus?: boolean;
|
||||
/**
|
||||
* Inserting and deleting whitespace follows tab stops.
|
||||
*/
|
||||
@@ -3414,6 +3419,7 @@ export const enum EditorOption {
|
||||
renderIndentGuides,
|
||||
renderFinalNewline,
|
||||
renderLineHighlight,
|
||||
renderLineHighlightOnlyWhenFocus,
|
||||
renderValidationDecorations,
|
||||
renderWhitespace,
|
||||
revealHorizontalRightPadding,
|
||||
@@ -3856,6 +3862,10 @@ export const EditorOptions = {
|
||||
description: nls.localize('renderLineHighlight', "Controls how the editor should render the current line highlight.")
|
||||
}
|
||||
)),
|
||||
renderLineHighlightOnlyWhenFocus: register(new EditorBooleanOption(
|
||||
EditorOption.renderLineHighlightOnlyWhenFocus, 'renderLineHighlightOnlyWhenFocus', false,
|
||||
{ description: nls.localize('renderLineHighlightOnlyWhenFocus', "Controls if the editor should render the current line highlight only when the editor is focused") }
|
||||
)),
|
||||
renderValidationDecorations: register(new EditorStringEnumOption(
|
||||
EditorOption.renderValidationDecorations, 'renderValidationDecorations',
|
||||
'editable' as 'editable' | 'on' | 'off',
|
||||
|
||||
@@ -245,43 +245,44 @@ export enum EditorOption {
|
||||
renderIndentGuides = 75,
|
||||
renderFinalNewline = 76,
|
||||
renderLineHighlight = 77,
|
||||
renderValidationDecorations = 78,
|
||||
renderWhitespace = 79,
|
||||
revealHorizontalRightPadding = 80,
|
||||
roundedSelection = 81,
|
||||
rulers = 82,
|
||||
scrollbar = 83,
|
||||
scrollBeyondLastColumn = 84,
|
||||
scrollBeyondLastLine = 85,
|
||||
scrollPredominantAxis = 86,
|
||||
selectionClipboard = 87,
|
||||
selectionHighlight = 88,
|
||||
selectOnLineNumbers = 89,
|
||||
showFoldingControls = 90,
|
||||
showUnused = 91,
|
||||
snippetSuggestions = 92,
|
||||
smoothScrolling = 93,
|
||||
stopRenderingLineAfter = 94,
|
||||
suggest = 95,
|
||||
suggestFontSize = 96,
|
||||
suggestLineHeight = 97,
|
||||
suggestOnTriggerCharacters = 98,
|
||||
suggestSelection = 99,
|
||||
tabCompletion = 100,
|
||||
useTabStops = 101,
|
||||
wordSeparators = 102,
|
||||
wordWrap = 103,
|
||||
wordWrapBreakAfterCharacters = 104,
|
||||
wordWrapBreakBeforeCharacters = 105,
|
||||
wordWrapColumn = 106,
|
||||
wordWrapMinified = 107,
|
||||
wrappingIndent = 108,
|
||||
wrappingStrategy = 109,
|
||||
editorClassName = 110,
|
||||
pixelRatio = 111,
|
||||
tabFocusMode = 112,
|
||||
layoutInfo = 113,
|
||||
wrappingInfo = 114
|
||||
renderLineHighlightOnlyWhenFocus = 78,
|
||||
renderValidationDecorations = 79,
|
||||
renderWhitespace = 80,
|
||||
revealHorizontalRightPadding = 81,
|
||||
roundedSelection = 82,
|
||||
rulers = 83,
|
||||
scrollbar = 84,
|
||||
scrollBeyondLastColumn = 85,
|
||||
scrollBeyondLastLine = 86,
|
||||
scrollPredominantAxis = 87,
|
||||
selectionClipboard = 88,
|
||||
selectionHighlight = 89,
|
||||
selectOnLineNumbers = 90,
|
||||
showFoldingControls = 91,
|
||||
showUnused = 92,
|
||||
snippetSuggestions = 93,
|
||||
smoothScrolling = 94,
|
||||
stopRenderingLineAfter = 95,
|
||||
suggest = 96,
|
||||
suggestFontSize = 97,
|
||||
suggestLineHeight = 98,
|
||||
suggestOnTriggerCharacters = 99,
|
||||
suggestSelection = 100,
|
||||
tabCompletion = 101,
|
||||
useTabStops = 102,
|
||||
wordSeparators = 103,
|
||||
wordWrap = 104,
|
||||
wordWrapBreakAfterCharacters = 105,
|
||||
wordWrapBreakBeforeCharacters = 106,
|
||||
wordWrapColumn = 107,
|
||||
wordWrapMinified = 108,
|
||||
wrappingIndent = 109,
|
||||
wrappingStrategy = 110,
|
||||
editorClassName = 111,
|
||||
pixelRatio = 112,
|
||||
tabFocusMode = 113,
|
||||
layoutInfo = 114,
|
||||
wrappingInfo = 115
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ import { themeColorFromId } from 'vs/platform/theme/common/themeService';
|
||||
import { overviewRulerRangeHighlight } from 'vs/editor/common/view/editorColorRegistry';
|
||||
import { IQuickPick, IQuickPickItem, IKeyMods } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IDisposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, DisposableStore, toDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { isDiffEditor, getCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
@@ -47,13 +47,12 @@ export abstract class AbstractEditorNavigationQuickAccessProvider implements IQu
|
||||
picker.matchOnLabel = picker.matchOnDescription = picker.matchOnDetail = picker.sortByLabel = false;
|
||||
|
||||
// Provide based on current active editor
|
||||
let pickerDisposable = this.doProvide(picker, token);
|
||||
disposables.add(toDisposable(() => pickerDisposable.dispose()));
|
||||
const pickerDisposable = disposables.add(new MutableDisposable());
|
||||
pickerDisposable.value = this.doProvide(picker, token);
|
||||
|
||||
// Re-create whenever the active editor changes
|
||||
disposables.add(this.onDidActiveTextEditorControlChange(() => {
|
||||
pickerDisposable.dispose();
|
||||
pickerDisposable = this.doProvide(picker, token);
|
||||
pickerDisposable.value = this.doProvide(picker, token);
|
||||
}));
|
||||
|
||||
return disposables;
|
||||
@@ -81,7 +80,7 @@ export abstract class AbstractEditorNavigationQuickAccessProvider implements IQu
|
||||
}));
|
||||
|
||||
disposables.add(once(token.onCancellationRequested)(() => {
|
||||
if (lastKnownEditorViewState) {
|
||||
if (lastKnownEditorViewState && editor === this.activeTextEditorControl) {
|
||||
editor.restoreViewState(lastKnownEditorViewState);
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user