mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-22 04:40:30 -04:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -34,7 +34,7 @@ export class InsertCursorAbove extends EditorAction {
|
||||
alias: 'Add Cursor Above',
|
||||
precondition: null,
|
||||
kbOpts: {
|
||||
kbExpr: EditorContextKeys.textFocus,
|
||||
kbExpr: EditorContextKeys.editorTextFocus,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.UpArrow,
|
||||
linux: {
|
||||
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.UpArrow,
|
||||
@@ -70,7 +70,7 @@ export class InsertCursorBelow extends EditorAction {
|
||||
alias: 'Add Cursor Below',
|
||||
precondition: null,
|
||||
kbOpts: {
|
||||
kbExpr: EditorContextKeys.textFocus,
|
||||
kbExpr: EditorContextKeys.editorTextFocus,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.DownArrow,
|
||||
linux: {
|
||||
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.DownArrow,
|
||||
@@ -107,35 +107,31 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction {
|
||||
alias: 'Add Cursors to Line Ends',
|
||||
precondition: null,
|
||||
kbOpts: {
|
||||
kbExpr: EditorContextKeys.textFocus,
|
||||
kbExpr: EditorContextKeys.editorTextFocus,
|
||||
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private getCursorsForSelection(selection: Selection, editor: ICodeEditor): Selection[] {
|
||||
private getCursorsForSelection(selection: Selection, model: ITextModel, result: Selection[]): void {
|
||||
if (selection.isEmpty()) {
|
||||
return [];
|
||||
return;
|
||||
}
|
||||
|
||||
let model = editor.getModel();
|
||||
let newSelections: Selection[] = [];
|
||||
for (let i = selection.startLineNumber; i < selection.endLineNumber; i++) {
|
||||
let currentLineMaxColumn = model.getLineMaxColumn(i);
|
||||
newSelections.push(new Selection(i, currentLineMaxColumn, i, currentLineMaxColumn));
|
||||
result.push(new Selection(i, currentLineMaxColumn, i, currentLineMaxColumn));
|
||||
}
|
||||
if (selection.endColumn > 1) {
|
||||
newSelections.push(new Selection(selection.endLineNumber, selection.endColumn, selection.endLineNumber, selection.endColumn));
|
||||
result.push(new Selection(selection.endLineNumber, selection.endColumn, selection.endLineNumber, selection.endColumn));
|
||||
}
|
||||
|
||||
return newSelections;
|
||||
}
|
||||
|
||||
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
|
||||
let selections = editor.getSelections();
|
||||
let newSelections = selections
|
||||
.map((selection) => this.getCursorsForSelection(selection, editor))
|
||||
.reduce((prev, curr) => { return prev.concat(curr); });
|
||||
const model = editor.getModel();
|
||||
const selections = editor.getSelections();
|
||||
let newSelections: Selection[] = [];
|
||||
selections.forEach((sel) => this.getCursorsForSelection(sel, model, newSelections));
|
||||
|
||||
if (newSelections.length > 0) {
|
||||
editor.setSelections(newSelections);
|
||||
@@ -603,7 +599,7 @@ export class CompatChangeAll extends MultiCursorSelectionControllerAction {
|
||||
alias: 'Change All Occurrences',
|
||||
precondition: EditorContextKeys.writable,
|
||||
kbOpts: {
|
||||
kbExpr: EditorContextKeys.textFocus,
|
||||
kbExpr: EditorContextKeys.editorTextFocus,
|
||||
primary: KeyMod.CtrlCmd | KeyCode.F2
|
||||
},
|
||||
menuOpts: {
|
||||
@@ -803,9 +799,7 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
|
||||
this.state = state;
|
||||
|
||||
if (!this.state) {
|
||||
if (this.decorations.length > 0) {
|
||||
this.decorations = this.editor.deltaDecorations(this.decorations, []);
|
||||
}
|
||||
this.decorations = this.editor.deltaDecorations(this.decorations, []);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user