mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-21 12:20:29 -04:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./messageController';
|
||||
import * as nls from 'vs/nls';
|
||||
import { setDisposableTimeout } from 'vs/base/common/async';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { alert } from 'vs/base/browser/ui/aria/aria';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
@@ -20,11 +21,11 @@ import { registerThemingParticipant, HIGH_CONTRAST } from 'vs/platform/theme/com
|
||||
import { inputValidationInfoBorder, inputValidationInfoBackground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
|
||||
export class MessageController implements editorCommon.IEditorContribution {
|
||||
export class MessageController extends Disposable implements editorCommon.IEditorContribution {
|
||||
|
||||
private static readonly _id = 'editor.contrib.messageController';
|
||||
|
||||
static CONTEXT_SNIPPET_MODE = new RawContextKey<boolean>('messageVisible', false);
|
||||
static MESSAGE_VISIBLE = new RawContextKey<boolean>('messageVisible', false);
|
||||
|
||||
static get(editor: ICodeEditor): MessageController {
|
||||
return editor.getContribution<MessageController>(MessageController._id);
|
||||
@@ -43,11 +44,14 @@ export class MessageController implements editorCommon.IEditorContribution {
|
||||
editor: ICodeEditor,
|
||||
@IContextKeyService contextKeyService: IContextKeyService
|
||||
) {
|
||||
super();
|
||||
this._editor = editor;
|
||||
this._visible = MessageController.CONTEXT_SNIPPET_MODE.bindTo(contextKeyService);
|
||||
this._visible = MessageController.MESSAGE_VISIBLE.bindTo(contextKeyService);
|
||||
this._register(this._editor.onDidAttemptReadOnlyEdit(() => this._onDidAttemptReadOnlyEdit()));
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
super.dispose();
|
||||
this._visible.reset();
|
||||
}
|
||||
|
||||
@@ -96,6 +100,10 @@ export class MessageController implements editorCommon.IEditorContribution {
|
||||
this._messageListeners = dispose(this._messageListeners);
|
||||
this._messageListeners.push(MessageWidget.fadeOut(this._messageWidget));
|
||||
}
|
||||
|
||||
private _onDidAttemptReadOnlyEdit(): void {
|
||||
this.showMessage(nls.localize('editor.readonly', "Cannot edit in read-only editor"), this._editor.getPosition());
|
||||
}
|
||||
}
|
||||
|
||||
const MessageCommand = EditorCommand.bindToContribution<MessageController>(MessageController.get);
|
||||
@@ -103,7 +111,7 @@ const MessageCommand = EditorCommand.bindToContribution<MessageController>(Messa
|
||||
|
||||
registerEditorCommand(new MessageCommand({
|
||||
id: 'leaveEditorMessage',
|
||||
precondition: MessageController.CONTEXT_SNIPPET_MODE,
|
||||
precondition: MessageController.MESSAGE_VISIBLE,
|
||||
handler: c => c.closeMessage(),
|
||||
kbOpts: {
|
||||
weight: KeybindingsRegistry.WEIGHT.editorContrib(30),
|
||||
|
||||
Reference in New Issue
Block a user