mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 4c9161a3f125f5a788aafa73a4ecfcb27dcfc319 (#9143)
* Merge from vscode 4c9161a3f125f5a788aafa73a4ecfcb27dcfc319 * minor spacing fix
This commit is contained in:
@@ -55,6 +55,7 @@ import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
||||
import { EditorAutoSave } from 'vs/workbench/browser/parts/editor/editorAutoSave';
|
||||
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
|
||||
|
||||
// Register String Editor
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
|
||||
@@ -134,9 +135,21 @@ class UntitledTextEditorInputFactory implements IEditorInputFactory {
|
||||
resource = toLocalResource(resource, this.environmentService.configuration.remoteAuthority); // untitled with associated file path use the local schema
|
||||
}
|
||||
|
||||
// Mode: only remember mode if it is either specific (not text)
|
||||
// or if the mode was explicitly set by the user. We want to preserve
|
||||
// this information across restarts and not set the mode unless
|
||||
// this is the case.
|
||||
let modeId: string | undefined;
|
||||
const modeIdCandidate = untitledTextEditorInput.getMode();
|
||||
if (modeIdCandidate !== PLAINTEXT_MODE_ID) {
|
||||
modeId = modeIdCandidate;
|
||||
} else if (untitledTextEditorInput.model.hasModeSetExplicitly) {
|
||||
modeId = modeIdCandidate;
|
||||
}
|
||||
|
||||
const serialized: ISerializedUntitledTextEditorInput = {
|
||||
resourceJSON: resource.toJSON(),
|
||||
modeId: untitledTextEditorInput.getMode(),
|
||||
modeId,
|
||||
encoding: untitledTextEditorInput.getEncoding()
|
||||
};
|
||||
|
||||
|
||||
@@ -214,6 +214,10 @@ export class TextResourceEditor extends AbstractTextResourceEditor {
|
||||
}
|
||||
|
||||
private onDidEditorPaste(e: IPasteEvent, codeEditor: ICodeEditor): void {
|
||||
if (this.input instanceof UntitledTextEditorInput && this.input.model.hasModeSetExplicitly) {
|
||||
return; // do not override mode if it was set explicitly
|
||||
}
|
||||
|
||||
if (e.range.startLineNumber !== 1 || e.range.startColumn !== 1) {
|
||||
return; // only when pasting into first line, first column (= empty document)
|
||||
}
|
||||
|
||||
@@ -222,4 +222,5 @@ export function registerNotificationCommands(center: INotificationsCenterControl
|
||||
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: SHOW_NOTIFICATIONS_CENTER, title: { value: localize('showNotifications', "Show Notifications"), original: 'Show Notifications' }, category }, when: NotificationsCenterVisibleContext.toNegated() });
|
||||
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: HIDE_NOTIFICATIONS_CENTER, title: { value: localize('hideNotifications', "Hide Notifications"), original: 'Hide Notifications' }, category }, when: NotificationsCenterVisibleContext });
|
||||
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: CLEAR_ALL_NOTIFICATIONS, title: { value: localize('clearAllNotifications', "Clear All Notifications"), original: 'Clear All Notifications' }, category } });
|
||||
}
|
||||
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: FOCUS_NOTIFICATION_TOAST, title: { value: localize('focusNotificationToasts', "Focus Notification Toast"), original: 'Focus Notification Toast' }, category }, when: NotificationsToastsVisibleContext });
|
||||
}
|
||||
|
||||
@@ -93,20 +93,16 @@ class BrowserMain extends Disposable {
|
||||
|
||||
// Layout
|
||||
const viewport = platform.isIOS && (<any>window).visualViewport ? (<any>window).visualViewport /** Visual viewport */ : window /** Layout viewport */;
|
||||
this._register(addDisposableListener(viewport, EventType.RESIZE, () => {
|
||||
workbench.layout();
|
||||
}));
|
||||
this._register(addDisposableListener(viewport, EventType.RESIZE, () => workbench.layout()));
|
||||
|
||||
// Prevent the back/forward gestures in macOS
|
||||
this._register(addDisposableListener(this.domElement, EventType.WHEEL, (e) => {
|
||||
e.preventDefault();
|
||||
}, { passive: false }));
|
||||
this._register(addDisposableListener(this.domElement, EventType.WHEEL, e => e.preventDefault(), { passive: false }));
|
||||
|
||||
// Prevent native context menus in web
|
||||
this._register(addDisposableListener(this.domElement, EventType.CONTEXT_MENU, (e) => EventHelper.stop(e, true)));
|
||||
this._register(addDisposableListener(this.domElement, EventType.CONTEXT_MENU, e => EventHelper.stop(e, true)));
|
||||
|
||||
// Prevent default navigation on drop
|
||||
this._register(addDisposableListener(this.domElement, EventType.DROP, (e) => EventHelper.stop(e, true)));
|
||||
this._register(addDisposableListener(this.domElement, EventType.DROP, e => EventHelper.stop(e, true)));
|
||||
|
||||
// Workbench Lifecycle
|
||||
this._register(workbench.onBeforeShutdown(event => {
|
||||
|
||||
Reference in New Issue
Block a user