mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-20 20:10:11 -04:00
Merge from vscode 31e03b8ffbb218a87e3941f2b63a249f061fe0e4 (#4986)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { registerEditorAction, registerEditorCommand, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
|
||||
import { CodeActionCommand, OrganizeImportsAction, QuickFixAction, QuickFixController, RefactorAction, SourceAction, AutoFixAction } from 'vs/editor/contrib/codeAction/codeActionCommands';
|
||||
import { CodeActionCommand, OrganizeImportsAction, QuickFixAction, QuickFixController, RefactorAction, SourceAction, AutoFixAction, FixAllAction } from 'vs/editor/contrib/codeAction/codeActionCommands';
|
||||
|
||||
|
||||
registerEditorContribution(QuickFixController);
|
||||
@@ -13,4 +13,5 @@ registerEditorAction(RefactorAction);
|
||||
registerEditorAction(SourceAction);
|
||||
registerEditorAction(OrganizeImportsAction);
|
||||
registerEditorAction(AutoFixAction);
|
||||
registerEditorAction(FixAllAction);
|
||||
registerEditorCommand(new CodeActionCommand());
|
||||
|
||||
@@ -13,7 +13,7 @@ import { KeyCode, KeyMod, ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
|
||||
import { EditorAction, ServicesAccessor, registerEditorAction, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
|
||||
import { IEditorContribution, IScrollEvent, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { IMenuService, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
@@ -21,6 +21,7 @@ import { IContextMenuService, IContextViewService } from 'vs/platform/contextvie
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
||||
|
||||
export class ContextMenuController implements IEditorContribution {
|
||||
|
||||
@@ -45,8 +46,8 @@ export class ContextMenuController implements IEditorContribution {
|
||||
this._editor = editor;
|
||||
|
||||
this._toDispose.push(this._editor.onContextMenu((e: IEditorMouseEvent) => this._onContextMenu(e)));
|
||||
this._toDispose.push(this._editor.onDidScrollChange((e: IScrollEvent) => {
|
||||
if (this._contextMenuIsBeingShownCount > 0 && e.scrollTopChanged) {
|
||||
this._toDispose.push(this._editor.onMouseWheel((e: IMouseWheelEvent) => {
|
||||
if (this._contextMenuIsBeingShownCount > 0) {
|
||||
this._contextViewService.hideContextView();
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -214,7 +214,7 @@ export async function formatDocumentWithSelectedProvider(
|
||||
const provider = getRealAndSyntheticDocumentFormattersOrdered(model);
|
||||
const selected = await FormattingConflicts.select(provider, model, mode);
|
||||
if (selected) {
|
||||
await instaService.invokeFunction(formatDocumentWithProvider, selected, editorOrModel, token);
|
||||
await instaService.invokeFunction(formatDocumentWithProvider, selected, editorOrModel, mode, token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,6 +222,7 @@ export async function formatDocumentWithProvider(
|
||||
accessor: ServicesAccessor,
|
||||
provider: DocumentFormattingEditProvider,
|
||||
editorOrModel: ITextModel | IActiveCodeEditor,
|
||||
mode: FormattingMode,
|
||||
token: CancellationToken
|
||||
): Promise<boolean> {
|
||||
const workerService = accessor.get(IEditorWorkerService);
|
||||
@@ -255,10 +256,13 @@ export async function formatDocumentWithProvider(
|
||||
if (isCodeEditor(editorOrModel)) {
|
||||
// use editor to apply edits
|
||||
FormattingEdit.execute(editorOrModel, edits);
|
||||
alertFormattingEdits(edits);
|
||||
editorOrModel.pushUndoStop();
|
||||
editorOrModel.focus();
|
||||
editorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), editorCommon.ScrollType.Immediate);
|
||||
|
||||
if (mode !== FormattingMode.Silent) {
|
||||
alertFormattingEdits(edits);
|
||||
editorOrModel.pushUndoStop();
|
||||
editorOrModel.focus();
|
||||
editorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), editorCommon.ScrollType.Immediate);
|
||||
}
|
||||
|
||||
} else {
|
||||
// use model to apply edits
|
||||
|
||||
@@ -98,7 +98,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
||||
}
|
||||
}));
|
||||
const storageKey = 'peekViewLayout';
|
||||
const data = <LayoutData>JSON.parse(this._storageService.get(storageKey, StorageScope.GLOBAL, '{}'));
|
||||
const data = LayoutData.fromJSON(this._storageService.get(storageKey, StorageScope.GLOBAL, '{}'));
|
||||
this._widget = this._instantiationService.createInstance(ReferenceWidget, this._editor, this._defaultTreeKeyboardSupport, data);
|
||||
this._widget.setTitle(nls.localize('labelLoading', "Loading..."));
|
||||
this._widget.show(range);
|
||||
|
||||
@@ -157,9 +157,25 @@ class DecorationsManager implements IDisposable {
|
||||
}
|
||||
}
|
||||
|
||||
export interface LayoutData {
|
||||
export class LayoutData {
|
||||
ratio: number;
|
||||
heightInLines: number;
|
||||
|
||||
static fromJSON(raw: string): LayoutData {
|
||||
let ratio: number | undefined;
|
||||
let heightInLines: number | undefined;
|
||||
try {
|
||||
const data = <LayoutData>JSON.parse(raw);
|
||||
ratio = data.ratio;
|
||||
heightInLines = data.heightInLines;
|
||||
} catch {
|
||||
//
|
||||
}
|
||||
return {
|
||||
ratio: ratio || 0.7,
|
||||
heightInLines: heightInLines || 18
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export interface SelectionEvent {
|
||||
|
||||
Reference in New Issue
Block a user