mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 01:00:29 -04:00
This reverts commit 5d44b6a6a7.
This commit is contained in:
@@ -70,7 +70,7 @@ class Item extends BreadcrumbsItem {
|
||||
return false;
|
||||
}
|
||||
if (this.element instanceof FileElement && other.element instanceof FileElement) {
|
||||
return isEqual(this.element.uri, other.element.uri, false);
|
||||
return isEqual(this.element.uri, other.element.uri);
|
||||
}
|
||||
if (this.element instanceof TreeElement && other.element instanceof TreeElement) {
|
||||
return this.element.id === other.element.id;
|
||||
|
||||
@@ -388,14 +388,21 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
|
||||
const labels = this._instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER /* TODO@Jo visibility propagation */);
|
||||
this._disposables.push(labels);
|
||||
|
||||
return this._instantiationService.createInstance(WorkbenchAsyncDataTree, container, new FileVirtualDelegate(), [this._instantiationService.createInstance(FileRenderer, labels)], this._instantiationService.createInstance(FileDataSource), {
|
||||
filterOnType: true,
|
||||
multipleSelectionSupport: false,
|
||||
sorter: new FileSorter(),
|
||||
filter: this._instantiationService.createInstance(FileFilter),
|
||||
identityProvider: new FileIdentityProvider(),
|
||||
keyboardNavigationLabelProvider: new FileNavigationLabelProvider()
|
||||
}) as WorkbenchAsyncDataTree<BreadcrumbElement | IFileStat, any, FuzzyScore>;
|
||||
return this._instantiationService.createInstance(
|
||||
WorkbenchAsyncDataTree,
|
||||
container,
|
||||
new FileVirtualDelegate(),
|
||||
[this._instantiationService.createInstance(FileRenderer, labels)],
|
||||
this._instantiationService.createInstance(FileDataSource),
|
||||
{
|
||||
filterOnType: true,
|
||||
multipleSelectionSupport: false,
|
||||
sorter: new FileSorter(),
|
||||
filter: this._instantiationService.createInstance(FileFilter),
|
||||
identityProvider: new FileIdentityProvider(),
|
||||
keyboardNavigationLabelProvider: new FileNavigationLabelProvider()
|
||||
}
|
||||
) as WorkbenchAsyncDataTree<BreadcrumbElement, any, FuzzyScore>;
|
||||
}
|
||||
|
||||
_setInput(element: BreadcrumbElement): Promise<void> {
|
||||
|
||||
@@ -104,7 +104,7 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
|
||||
interface ISerializedUntitledEditorInput {
|
||||
resource: string;
|
||||
resourceJSON: object;
|
||||
modeId: string | undefined;
|
||||
modeId: string | null;
|
||||
encoding: string;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
|
||||
const serialized: ISerializedUntitledEditorInput = {
|
||||
resource: resource.toString(), // Keep for backwards compatibility
|
||||
resourceJSON: resource.toJSON(),
|
||||
modeId: untitledEditorInput.getMode(),
|
||||
modeId: untitledEditorInput.getModeId(),
|
||||
encoding: untitledEditorInput.getEncoding()
|
||||
};
|
||||
|
||||
@@ -147,10 +147,10 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
|
||||
return instantiationService.invokeFunction<UntitledEditorInput>(accessor => {
|
||||
const deserialized: ISerializedUntitledEditorInput = JSON.parse(serializedEditorInput);
|
||||
const resource = !!deserialized.resourceJSON ? URI.revive(<UriComponents>deserialized.resourceJSON) : URI.parse(deserialized.resource);
|
||||
const mode = deserialized.modeId;
|
||||
const language = deserialized.modeId;
|
||||
const encoding = deserialized.encoding;
|
||||
|
||||
return accessor.get(IEditorService).createInput({ resource, mode, encoding, forceUntitled: true }) as UntitledEditorInput;
|
||||
return accessor.get(IEditorService).createInput({ resource, language, encoding, forceUntitled: true }) as UntitledEditorInput;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ export function toEditorQuickOpenEntry(element: any): IEditorQuickOpenEntry | nu
|
||||
|
||||
// QuickOpenEntryGroup
|
||||
if (element instanceof QuickOpenEntryGroup) {
|
||||
const group = element;
|
||||
const group = <QuickOpenEntryGroup>element;
|
||||
if (group.getEntry()) {
|
||||
element = group.getEntry();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import { CLOSE_EDITOR_GROUP_COMMAND_ID } from 'vs/workbench/browser/parts/editor
|
||||
import { NoTabsTitleControl } from 'vs/workbench/browser/parts/editor/noTabsTitleControl';
|
||||
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
|
||||
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
|
||||
@@ -18,7 +18,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { EditorInput, toResource, SideBySideEditor } from 'vs/workbench/common/editor';
|
||||
import { compareItemsByScore, scoreItem, ScorerCache, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
export class EditorPickerEntry extends QuickOpenEntryGroup {
|
||||
|
||||
@@ -33,13 +32,13 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
|
||||
|
||||
getLabelOptions(): IIconLabelValueOptions {
|
||||
return {
|
||||
extraClasses: getIconClasses(this.modelService, this.modeService, this.getResource()),
|
||||
extraClasses: getIconClasses(this.modelService, this.modeService, this.getResource() || undefined),
|
||||
italic: !this._group.isPinned(this.editor)
|
||||
};
|
||||
}
|
||||
|
||||
getLabel() {
|
||||
return withNullAsUndefined(this.editor.getName());
|
||||
return this.editor.getName();
|
||||
}
|
||||
|
||||
getIcon(): string {
|
||||
@@ -59,7 +58,7 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
|
||||
}
|
||||
|
||||
getDescription() {
|
||||
return withNullAsUndefined(this.editor.getDescription());
|
||||
return this.editor.getDescription();
|
||||
}
|
||||
|
||||
run(mode: Mode, context: IEntryRunContext): boolean {
|
||||
|
||||
@@ -14,11 +14,11 @@ import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { Language } from 'vs/base/common/platform';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { IFileEditorInput, EncodingMode, IEncodingSupport, toResource, SideBySideEditorInput, IEditor as IBaseEditor, IEditorInput, SideBySideEditor, IModeSupport } from 'vs/workbench/common/editor';
|
||||
import { IFileEditorInput, EncodingMode, IEncodingSupport, toResource, SideBySideEditorInput, IEditor as IBaseEditor, IEditorInput, SideBySideEditor } from 'vs/workbench/common/editor';
|
||||
import { IDisposable, combinedDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IEditorAction } from 'vs/editor/common/editorCommon';
|
||||
import { EndOfLineSequence } from 'vs/editor/common/model';
|
||||
import { EndOfLineSequence, ITextModel } from 'vs/editor/common/model';
|
||||
import { IModelLanguageChangedEvent, IModelOptionsChangedEvent } from 'vs/editor/common/model/textModelEvents';
|
||||
import { TrimTrailingWhitespaceAction } from 'vs/editor/contrib/linesOperations/linesOperations';
|
||||
import { IndentUsingSpaces, IndentUsingTabs, DetectIndentation, IndentationToSpacesAction, IndentationToTabsAction } from 'vs/editor/contrib/indentation/indentation';
|
||||
@@ -62,15 +62,7 @@ class SideBySideEditorEncodingSupport implements IEncodingSupport {
|
||||
}
|
||||
|
||||
setEncoding(encoding: string, mode: EncodingMode): void {
|
||||
[this.master, this.details].forEach(editor => editor.setEncoding(encoding, mode));
|
||||
}
|
||||
}
|
||||
|
||||
class SideBySideEditorModeSupport implements IModeSupport {
|
||||
constructor(private master: IModeSupport, private details: IModeSupport) { }
|
||||
|
||||
setMode(mode: string): void {
|
||||
[this.master, this.details].forEach(editor => editor.setMode(mode));
|
||||
[this.master, this.details].forEach(s => s.setEncoding(encoding, mode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +86,7 @@ function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport | nu
|
||||
}
|
||||
|
||||
// File or Resource Editor
|
||||
const encodingSupport = input as IFileEditorInput;
|
||||
let encodingSupport = input as IFileEditorInput;
|
||||
if (areFunctions(encodingSupport.setEncoding, encodingSupport.getEncoding)) {
|
||||
return encodingSupport;
|
||||
}
|
||||
@@ -103,41 +95,14 @@ function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport | nu
|
||||
return null;
|
||||
}
|
||||
|
||||
function toEditorWithModeSupport(input: IEditorInput): IModeSupport | null {
|
||||
|
||||
// Untitled Editor
|
||||
if (input instanceof UntitledEditorInput) {
|
||||
return input;
|
||||
}
|
||||
|
||||
// Side by Side (diff) Editor
|
||||
if (input instanceof SideBySideEditorInput) {
|
||||
const masterModeSupport = toEditorWithModeSupport(input.master);
|
||||
const detailsModeSupport = toEditorWithModeSupport(input.details);
|
||||
|
||||
if (masterModeSupport && detailsModeSupport) {
|
||||
return new SideBySideEditorModeSupport(masterModeSupport, detailsModeSupport);
|
||||
}
|
||||
|
||||
return masterModeSupport;
|
||||
}
|
||||
|
||||
// File or Resource Editor
|
||||
const modeSupport = input as IFileEditorInput;
|
||||
if (typeof modeSupport.setMode === 'function') {
|
||||
return modeSupport;
|
||||
}
|
||||
|
||||
// Unsupported for any other editor
|
||||
return null;
|
||||
}
|
||||
|
||||
interface IEditorSelectionStatus {
|
||||
selections?: Selection[];
|
||||
charactersSelected?: number;
|
||||
}
|
||||
|
||||
class StateChange {
|
||||
_stateChangeBrand: void;
|
||||
|
||||
indentation: boolean = false;
|
||||
selectionStatus: boolean = false;
|
||||
mode: boolean = false;
|
||||
@@ -158,7 +123,7 @@ class StateChange {
|
||||
this.metadata = this.metadata || other.metadata;
|
||||
}
|
||||
|
||||
hasChanges(): boolean {
|
||||
public hasChanges(): boolean {
|
||||
return this.indentation
|
||||
|| this.selectionStatus
|
||||
|| this.mode
|
||||
@@ -217,49 +182,42 @@ class State {
|
||||
change.selectionStatus = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ('indentation' in update) {
|
||||
if (this._indentation !== update.indentation) {
|
||||
this._indentation = update.indentation;
|
||||
change.indentation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ('mode' in update) {
|
||||
if (this._mode !== update.mode) {
|
||||
this._mode = update.mode;
|
||||
change.mode = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ('encoding' in update) {
|
||||
if (this._encoding !== update.encoding) {
|
||||
this._encoding = update.encoding;
|
||||
change.encoding = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ('EOL' in update) {
|
||||
if (this._EOL !== update.EOL) {
|
||||
this._EOL = update.EOL;
|
||||
change.EOL = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ('tabFocusMode' in update) {
|
||||
if (this._tabFocusMode !== update.tabFocusMode) {
|
||||
this._tabFocusMode = update.tabFocusMode;
|
||||
change.tabFocusMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ('screenReaderMode' in update) {
|
||||
if (this._screenReaderMode !== update.screenReaderMode) {
|
||||
this._screenReaderMode = update.screenReaderMode;
|
||||
change.screenReaderMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ('metadata' in update) {
|
||||
if (this._metadata !== update.metadata) {
|
||||
this._metadata = update.metadata;
|
||||
@@ -281,6 +239,7 @@ const nlsTabFocusMode = nls.localize('tabFocusModeEnabled', "Tab Moves Focus");
|
||||
const nlsScreenReaderDetected = nls.localize('screenReaderDetected', "Screen Reader Optimized");
|
||||
const nlsScreenReaderDetectedTitle = nls.localize('screenReaderDetectedExtra', "If you are not using a Screen Reader, please change the setting `editor.accessibilitySupport` to \"off\".");
|
||||
|
||||
|
||||
class StatusBarItem {
|
||||
private _showing = true;
|
||||
|
||||
@@ -292,15 +251,15 @@ class StatusBarItem {
|
||||
this.element.title = title;
|
||||
}
|
||||
|
||||
set textContent(value: string) {
|
||||
public set textContent(value: string) {
|
||||
this.element.textContent = value;
|
||||
}
|
||||
|
||||
set onclick(value: () => void) {
|
||||
public set onclick(value: () => void) {
|
||||
this.element.onclick = value;
|
||||
}
|
||||
|
||||
setVisible(shouldShow: boolean): void {
|
||||
public setVisible(shouldShow: boolean): void {
|
||||
if (shouldShow !== this._showing) {
|
||||
this._showing = shouldShow;
|
||||
this.element.style.display = shouldShow ? '' : 'none';
|
||||
@@ -308,6 +267,7 @@ class StatusBarItem {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class EditorStatus implements IStatusbarItem {
|
||||
private state: State;
|
||||
private element: HTMLElement;
|
||||
@@ -704,7 +664,7 @@ export class EditorStatus implements IStatusbarItem {
|
||||
this.updateState(update);
|
||||
}
|
||||
|
||||
private promptedScreenReader: boolean = false;
|
||||
private _promptedScreenReader: boolean = false;
|
||||
|
||||
private onScreenReaderModeChange(editorWidget: ICodeEditor | undefined): void {
|
||||
let screenReaderMode = false;
|
||||
@@ -716,8 +676,8 @@ export class EditorStatus implements IStatusbarItem {
|
||||
const screenReaderConfiguration = this.configurationService.getValue<IEditorOptions>('editor').accessibilitySupport;
|
||||
if (screenReaderConfiguration === 'auto') {
|
||||
// show explanation
|
||||
if (!this.promptedScreenReader) {
|
||||
this.promptedScreenReader = true;
|
||||
if (!this._promptedScreenReader) {
|
||||
this._promptedScreenReader = true;
|
||||
setTimeout(() => {
|
||||
this.onScreenReaderModeClick();
|
||||
}, 100);
|
||||
@@ -814,7 +774,7 @@ export class EditorStatus implements IStatusbarItem {
|
||||
if (activeControl) {
|
||||
const activeResource = toResource(activeControl.input, { supportSideBySide: SideBySideEditor.MASTER });
|
||||
if (activeResource && activeResource.toString() === resource.toString()) {
|
||||
return this.onEncodingChange(activeControl); // only update if the encoding changed for the active resource
|
||||
return this.onEncodingChange(<IBaseEditor>activeControl); // only update if the encoding changed for the active resource
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -927,7 +887,7 @@ export class ChangeModeAction extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
return <IQuickPickItem>{
|
||||
label: lang,
|
||||
iconClasses: getIconClasses(this.modelService, this.modeService, fakeResource),
|
||||
description
|
||||
@@ -990,35 +950,50 @@ export class ChangeModeAction extends Action {
|
||||
}
|
||||
|
||||
// Change mode for active editor
|
||||
const activeEditor = this.editorService.activeControl; // {{SQL CARBON EDIT}} @anthonydresser change to activeControl from active editor
|
||||
if (activeEditor) {
|
||||
const modeSupport = toEditorWithModeSupport(activeEditor.input); // {{SQL CARBON EDIT}} @anthonydresser reference input rather than activeeditor directly
|
||||
if (modeSupport) {
|
||||
|
||||
// Find mode
|
||||
let languageSelection: ILanguageSelection | undefined;
|
||||
if (pick === autoDetectMode) {
|
||||
if (textModel) {
|
||||
const resource = toResource(activeEditor.input, { supportSideBySide: SideBySideEditor.MASTER }); // {{SQL CARBON EDIT}} @anthonydresser reference input rather than activeeditor directly
|
||||
if (resource) {
|
||||
languageSelection = this.modeService.createByFilepathOrFirstLine(resource.fsPath, textModel.getLineContent(1));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
languageSelection = this.modeService.createByLanguageName(pick.label);
|
||||
// {{SQL CARBON EDIT}} - Get activeControl instead of activeEditor @todo anthonydresser 4/12/19 investigate
|
||||
const activeEditor = this.editorService.activeControl;
|
||||
const activeTextEditorWidget = this.editorService.activeTextEditorWidget;
|
||||
const models: ITextModel[] = [];
|
||||
if (isCodeEditor(activeTextEditorWidget)) {
|
||||
const codeEditorModel = activeTextEditorWidget.getModel();
|
||||
if (codeEditorModel) {
|
||||
models.push(codeEditorModel);
|
||||
}
|
||||
} else if (isDiffEditor(activeTextEditorWidget)) {
|
||||
const diffEditorModel = activeTextEditorWidget.getModel();
|
||||
if (diffEditorModel) {
|
||||
if (diffEditorModel.original) {
|
||||
models.push(diffEditorModel.original);
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}} @anthonydresser preform a check before we actuall set the mode
|
||||
// Change mode
|
||||
if (typeof languageSelection !== 'undefined') {
|
||||
QueryEditorService.sqlLanguageModeCheck(textModel, languageSelection, activeEditor).then(newTextModel => {
|
||||
if (newTextModel) {
|
||||
modeSupport.setMode(languageSelection.languageIdentifier.language);
|
||||
}
|
||||
});
|
||||
if (diffEditorModel.modified) {
|
||||
models.push(diffEditorModel.modified);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find mode
|
||||
let languageSelection: ILanguageSelection | undefined;
|
||||
if (pick === autoDetectMode) {
|
||||
if (textModel) {
|
||||
// {{SQL CARBON EDIT}} - use activeEditor.input instead of activeEditor
|
||||
const resource = toResource(activeEditor.input, { supportSideBySide: SideBySideEditor.MASTER });
|
||||
if (resource) {
|
||||
languageSelection = this.modeService.createByFilepathOrFirstLine(resource.fsPath, textModel.getLineContent(1));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
languageSelection = this.modeService.createByLanguageName(pick.label);
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
// Change mode
|
||||
models.forEach(textModel => {
|
||||
QueryEditorService.sqlLanguageModeCheck(textModel, languageSelection, activeEditor).then((newTextModel) => {
|
||||
if (newTextModel) {
|
||||
this.modelService.setMode(newTextModel, languageSelection);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1029,9 +1004,9 @@ export class ChangeModeAction extends Action {
|
||||
|
||||
const languages = this.modeService.getRegisteredLanguageNames();
|
||||
const picks: IQuickPickItem[] = languages.sort().map((lang, index) => {
|
||||
const id = withNullAsUndefined(this.modeService.getModeIdForLanguageName(lang.toLowerCase()));
|
||||
const id = this.modeService.getModeIdForLanguageName(lang.toLowerCase());
|
||||
|
||||
return {
|
||||
return <IQuickPickItem>{
|
||||
id,
|
||||
label: lang,
|
||||
description: (id === currentAssociation) ? nls.localize('currentAssociation', "Current Association") : undefined
|
||||
@@ -1041,7 +1016,7 @@ export class ChangeModeAction extends Action {
|
||||
setTimeout(() => {
|
||||
this.quickInputService.pick(picks, { placeHolder: nls.localize('pickLanguageToConfigure', "Select Language Mode to Associate with '{0}'", extension || base) }).then(language => {
|
||||
if (language) {
|
||||
const fileAssociationsConfig = this.configurationService.inspect<{}>(FILES_ASSOCIATIONS_CONFIG);
|
||||
const fileAssociationsConfig = this.configurationService.inspect(FILES_ASSOCIATIONS_CONFIG);
|
||||
|
||||
let associationKey: string;
|
||||
if (extension && base[0] !== '.') {
|
||||
@@ -1192,7 +1167,6 @@ export class ChangeEncodingAction extends Action {
|
||||
if (!activeControl) {
|
||||
return this.quickInputService.pick([{ label: nls.localize('noEditor', "No text editor active at this time") }]);
|
||||
}
|
||||
|
||||
const encodingSupport: IEncodingSupport | null = toEditorWithEncodingSupport(activeControl.input);
|
||||
if (!encodingSupport) {
|
||||
return this.quickInputService.pick([{ label: nls.localize('noFileEditor', "No file active at this time") }]);
|
||||
@@ -1283,12 +1257,10 @@ export class ChangeEncodingAction extends Action {
|
||||
if (!encoding) {
|
||||
return;
|
||||
}
|
||||
|
||||
const activeControl = this.editorService.activeControl;
|
||||
if (!activeControl) {
|
||||
return;
|
||||
}
|
||||
|
||||
const encodingSupport = toEditorWithEncodingSupport(activeControl.input);
|
||||
if (typeof encoding.id !== 'undefined' && encodingSupport && encodingSupport.getEncoding() !== encoding.id) {
|
||||
encodingSupport.setEncoding(encoding.id, isReopenWithEncoding ? EncodingMode.Decode : EncodingMode.Encode); // Set new encoding
|
||||
|
||||
@@ -370,7 +370,7 @@ class InlineImageView {
|
||||
dispose: () => combinedDisposable(disposables).dispose()
|
||||
};
|
||||
|
||||
const cacheKey = `${descriptor.resource.toString()}:${descriptor.etag}`;
|
||||
const cacheKey = descriptor.resource.toString();
|
||||
|
||||
let ctrlPressed = false;
|
||||
let altPressed = false;
|
||||
@@ -501,8 +501,8 @@ class InlineImageView {
|
||||
return;
|
||||
}
|
||||
|
||||
const isScrollWheelKeyPressed = platform.isMacintosh ? altPressed : ctrlPressed;
|
||||
if (!isScrollWheelKeyPressed && !e.ctrlKey) { // pinching is reported as scroll wheel + ctrl
|
||||
const isScrollWhellKeyPressed = platform.isMacintosh ? altPressed : ctrlPressed;
|
||||
if (!isScrollWhellKeyPressed && !e.ctrlKey) { // pinching is reported as scroll wheel + ctrl
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -513,8 +513,12 @@ class InlineImageView {
|
||||
firstZoom();
|
||||
}
|
||||
|
||||
let delta = e.deltaY > 0 ? 1 : -1;
|
||||
let delta = e.deltaY < 0 ? 1 : -1;
|
||||
|
||||
// Pinching should increase the scale
|
||||
if (e.ctrlKey && !isScrollWhellKeyPressed) {
|
||||
delta *= -1;
|
||||
}
|
||||
updateScale(scale as number * (1 - delta * InlineImageView.SCALE_PINCH_FACTOR));
|
||||
}));
|
||||
|
||||
|
||||
@@ -93,10 +93,10 @@ export class SideBySideEditor extends BaseEditor {
|
||||
this.updateStyles();
|
||||
}
|
||||
|
||||
setInput(newInput: EditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
|
||||
const oldInput = this.input as SideBySideEditorInput;
|
||||
setInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
|
||||
const oldInput = <SideBySideEditorInput>this.input;
|
||||
return super.setInput(newInput, options, token)
|
||||
.then(() => this.updateInput(oldInput, newInput as SideBySideEditorInput, options, token));
|
||||
.then(() => this.updateInput(oldInput, newInput, options, token));
|
||||
}
|
||||
|
||||
setOptions(options: EditorOptions): void {
|
||||
@@ -177,8 +177,8 @@ export class SideBySideEditor extends BaseEditor {
|
||||
}
|
||||
|
||||
private setNewInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
|
||||
const detailsEditor = this.doCreateEditor(newInput.details, this.detailsEditorContainer);
|
||||
const masterEditor = this.doCreateEditor(newInput.master, this.masterEditorContainer);
|
||||
const detailsEditor = this.doCreateEditor(<EditorInput>newInput.details, this.detailsEditorContainer);
|
||||
const masterEditor = this.doCreateEditor(<EditorInput>newInput.master, this.masterEditorContainer);
|
||||
|
||||
return this.onEditorsCreated(detailsEditor, masterEditor, newInput.details, newInput.master, options, token);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { applyDragImage } from 'vs/base/browser/dnd';
|
||||
import { addDisposableListener, Dimension, EventType } from 'vs/base/browser/dom';
|
||||
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { ActionsOrientation, IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ActionsOrientation, IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
|
||||
import { IAction, IRunEvent } from 'vs/base/common/actions';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
@@ -15,7 +15,7 @@ import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import 'vs/css!./media/titlecontrol';
|
||||
import { getCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { localize } from 'vs/nls';
|
||||
import { createActionViewItem, fillInActionBarActions, fillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { createActionItem, fillInActionBarActions, fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { ExecuteCommandAction, IMenu, IMenuService, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
@@ -39,7 +39,7 @@ import { Themable } from 'vs/workbench/common/theme';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
|
||||
export interface IToolbarActions {
|
||||
@@ -129,7 +129,7 @@ export abstract class TitleControl extends Themable {
|
||||
const context: IEditorCommandsContext = { groupId: this.group.id };
|
||||
|
||||
this.editorActionsToolbar = this._register(new ToolBar(container, this.contextMenuService, {
|
||||
actionViewItemProvider: action => this.actionViewItemProvider(action),
|
||||
actionItemProvider: action => this.actionItemProvider(action),
|
||||
orientation: ActionsOrientation.HORIZONTAL,
|
||||
ariaLabel: localize('araLabelEditorActions', "Editor actions"),
|
||||
getKeyBinding: action => this.getKeybinding(action),
|
||||
@@ -159,21 +159,21 @@ export abstract class TitleControl extends Themable {
|
||||
}));
|
||||
}
|
||||
|
||||
private actionViewItemProvider(action: IAction): IActionViewItem | undefined {
|
||||
private actionItemProvider(action: IAction): IActionItem | undefined {
|
||||
const activeControl = this.group.activeControl;
|
||||
|
||||
// Check Active Editor
|
||||
let actionViewItem: IActionViewItem | undefined = undefined;
|
||||
let actionItem: IActionItem | undefined = undefined;
|
||||
if (activeControl instanceof BaseEditor) {
|
||||
actionViewItem = activeControl.getActionViewItem(action);
|
||||
actionItem = activeControl.getActionItem(action);
|
||||
}
|
||||
|
||||
// Check extensions
|
||||
if (!actionViewItem) {
|
||||
actionViewItem = createActionViewItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
|
||||
if (!actionItem) {
|
||||
actionItem = createActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
|
||||
}
|
||||
|
||||
return actionViewItem;
|
||||
return actionItem;
|
||||
}
|
||||
|
||||
protected updateEditorActionsToolbar(): void {
|
||||
@@ -222,7 +222,7 @@ export abstract class TitleControl extends Themable {
|
||||
this.editorToolBarMenuDisposables = dispose(this.editorToolBarMenuDisposables);
|
||||
|
||||
// Update the resource context
|
||||
this.resourceContext.set(this.group.activeEditor ? withUndefinedAsNull(toResource(this.group.activeEditor, { supportSideBySide: SideBySideEditor.MASTER })) : null);
|
||||
this.resourceContext.set(this.group.activeEditor ? toResource(this.group.activeEditor, { supportSideBySide: SideBySideEditor.MASTER }) : null);
|
||||
|
||||
// Editor actions require the editor control to be there, so we retrieve it via service
|
||||
const activeControl = this.group.activeControl;
|
||||
@@ -289,7 +289,7 @@ export abstract class TitleControl extends Themable {
|
||||
|
||||
// Update the resource context
|
||||
const currentContext = this.resourceContext.get();
|
||||
this.resourceContext.set(withUndefinedAsNull(toResource(editor, { supportSideBySide: SideBySideEditor.MASTER })));
|
||||
this.resourceContext.set(toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }));
|
||||
|
||||
// Find target anchor
|
||||
let anchor: HTMLElement | { x: number, y: number } = node;
|
||||
|
||||
Reference in New Issue
Block a user