mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection, SelectionDirection } from 'vs/editor/common/core/selection';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
|
||||
export class CopyLinesCommand implements editorCommon.ICommand {
|
||||
|
||||
@@ -23,7 +24,7 @@ export class CopyLinesCommand implements editorCommon.ICommand {
|
||||
this._isCopyingDown = isCopyingDown;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
var s = this._selection;
|
||||
|
||||
this._startLineNumberDelta = 0;
|
||||
@@ -57,7 +58,7 @@ export class CopyLinesCommand implements editorCommon.ICommand {
|
||||
this._selectionDirection = this._selection.getDirection();
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
var result = helper.getTrackedSelection(this._selectionId);
|
||||
|
||||
if (this._startLineNumberDelta !== 0 || this._endLineNumberDelta !== 0) {
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
|
||||
export class DeleteLinesCommand implements ICommand {
|
||||
|
||||
@@ -20,7 +21,7 @@ export class DeleteLinesCommand implements ICommand {
|
||||
this.restoreCursorToColumn = restoreCursorToColumn;
|
||||
}
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void {
|
||||
if (model.getLineCount() === 1 && model.getLineMaxColumn(1) === 1) {
|
||||
// Model is empty
|
||||
return;
|
||||
@@ -42,7 +43,7 @@ export class DeleteLinesCommand implements ICommand {
|
||||
builder.addTrackedEditOperation(new Range(startLineNumber, startColumn, endLineNumber, endColumn), null);
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection {
|
||||
var inverseEditOperations = helper.getInverseEditOperations();
|
||||
var srcRange = inverseEditOperations[0].range;
|
||||
return new Selection(
|
||||
|
||||
@@ -9,7 +9,8 @@ import { KeyCode, KeyMod, KeyChord } from 'vs/base/common/keyCodes';
|
||||
import { SortLinesCommand } from 'vs/editor/contrib/linesOperations/sortLinesCommand';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { TrimTrailingWhitespaceCommand } from 'vs/editor/common/commands/trimTrailingWhitespaceCommand';
|
||||
import { ICommand, IIdentifiedSingleEditOperation } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand } from 'vs/editor/common/editorCommon';
|
||||
import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { ReplaceCommand, ReplaceCommandThatPreservesSelection } from 'vs/editor/common/commands/replaceCommand';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder, ITokenizedModel } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand, ICursorStateComputerData, IEditOperationBuilder } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { LanguageConfigurationRegistry, IIndentConverter } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { ShiftCommand } from 'vs/editor/common/commands/shiftCommand';
|
||||
import * as IndentUtil from 'vs/editor/contrib/indentation/indentUtils';
|
||||
@@ -31,7 +32,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
this._moveEndLineSelectionShrink = false;
|
||||
}
|
||||
|
||||
public getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void {
|
||||
public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void {
|
||||
|
||||
var modelLineCount = model.getLineCount();
|
||||
|
||||
@@ -238,7 +239,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
};
|
||||
}
|
||||
|
||||
private matchEnterRule(model: ITokenizedModel, indentConverter: IIndentConverter, tabSize: number, line: number, oneLineAbove: number, oneLineAboveText?: string) {
|
||||
private matchEnterRule(model: ITextModel, indentConverter: IIndentConverter, tabSize: number, line: number, oneLineAbove: number, oneLineAboveText?: string) {
|
||||
let validPrecedingLine = oneLineAbove;
|
||||
while (validPrecedingLine >= 1) {
|
||||
// ship empty lines as empty lines just inherit indentation
|
||||
@@ -297,7 +298,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
return str.replace(/^\s+/, '');
|
||||
}
|
||||
|
||||
private shouldAutoIndent(model: ITokenizedModel, selection: Selection) {
|
||||
private shouldAutoIndent(model: ITextModel, selection: Selection) {
|
||||
if (!this._autoIndent) {
|
||||
return false;
|
||||
}
|
||||
@@ -319,7 +320,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
private getIndentEditsOfMovingBlock(model: ITokenizedModel, builder: IEditOperationBuilder, s: Selection, tabSize: number, insertSpaces: boolean, offset: number) {
|
||||
private getIndentEditsOfMovingBlock(model: ITextModel, builder: IEditOperationBuilder, s: Selection, tabSize: number, insertSpaces: boolean, offset: number) {
|
||||
for (let i = s.startLineNumber; i <= s.endLineNumber; i++) {
|
||||
let lineContent = model.getLineContent(i);
|
||||
let originalIndent = strings.getLeadingWhitespace(lineContent);
|
||||
@@ -340,7 +341,7 @@ export class MoveLinesCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
public computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection {
|
||||
var result = helper.getTrackedSelection(this._selectionId);
|
||||
|
||||
if (this._moveEndPositionDown) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ITextModel, IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
|
||||
|
||||
export class SortLinesCommand implements editorCommon.ICommand {
|
||||
|
||||
@@ -20,7 +21,7 @@ export class SortLinesCommand implements editorCommon.ICommand {
|
||||
this.descending = descending;
|
||||
}
|
||||
|
||||
public getEditOperations(model: editorCommon.ITokenizedModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void {
|
||||
let op = sortLines(model, this.selection, this.descending);
|
||||
if (op) {
|
||||
builder.addEditOperation(op.range, op.text);
|
||||
@@ -29,11 +30,11 @@ export class SortLinesCommand implements editorCommon.ICommand {
|
||||
this.selectionId = builder.trackSelection(this.selection);
|
||||
}
|
||||
|
||||
public computeCursorState(model: editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection {
|
||||
return helper.getTrackedSelection(this.selectionId);
|
||||
}
|
||||
|
||||
public static canRun(model: editorCommon.ITextModel, selection: Selection, descending: boolean): boolean {
|
||||
public static canRun(model: ITextModel, selection: Selection, descending: boolean): boolean {
|
||||
let data = getSortData(model, selection, descending);
|
||||
|
||||
if (!data) {
|
||||
@@ -50,7 +51,7 @@ export class SortLinesCommand implements editorCommon.ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
function getSortData(model: editorCommon.ITextModel, selection: Selection, descending: boolean) {
|
||||
function getSortData(model: ITextModel, selection: Selection, descending: boolean) {
|
||||
let startLineNumber = selection.startLineNumber;
|
||||
let endLineNumber = selection.endLineNumber;
|
||||
|
||||
@@ -91,7 +92,7 @@ function getSortData(model: editorCommon.ITextModel, selection: Selection, desce
|
||||
/**
|
||||
* Generate commands for sorting lines on a model.
|
||||
*/
|
||||
function sortLines(model: editorCommon.ITextModel, selection: Selection, descending: boolean): editorCommon.IIdentifiedSingleEditOperation {
|
||||
function sortLines(model: ITextModel, selection: Selection, descending: boolean): IIdentifiedSingleEditOperation {
|
||||
let data = getSortData(model, selection, descending);
|
||||
|
||||
if (!data) {
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
import * as assert from 'assert';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Handler, IModel, DefaultEndOfLine } from 'vs/editor/common/editorCommon';
|
||||
import { Handler } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel, DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
|
||||
import { DeleteAllLeftAction, JoinLinesAction, TransposeAction, UpperCaseAction, LowerCaseAction, DeleteAllRightAction, InsertLineBeforeAction, InsertLineAfterAction, IndentLinesAction, SortLinesAscendingAction, SortLinesDescendingAction } from 'vs/editor/contrib/linesOperations/linesOperations';
|
||||
import { Cursor } from 'vs/editor/common/controller/cursor';
|
||||
import { Model } from 'vs/editor/common/model/model';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands';
|
||||
|
||||
suite('Editor Contrib - Line Operations', () => {
|
||||
@@ -662,7 +663,7 @@ suite('Editor Contrib - Line Operations', () => {
|
||||
});
|
||||
|
||||
test('InsertLineBeforeAction', function () {
|
||||
function testInsertLineBefore(lineNumber: number, column: number, callback: (model: IModel, cursor: Cursor) => void): void {
|
||||
function testInsertLineBefore(lineNumber: number, column: number, callback: (model: ITextModel, cursor: Cursor) => void): void {
|
||||
const TEXT = [
|
||||
'First line',
|
||||
'Second line',
|
||||
@@ -703,7 +704,7 @@ suite('Editor Contrib - Line Operations', () => {
|
||||
});
|
||||
|
||||
test('InsertLineAfterAction', () => {
|
||||
function testInsertLineAfter(lineNumber: number, column: number, callback: (model: IModel, cursor: Cursor) => void): void {
|
||||
function testInsertLineAfter(lineNumber: number, column: number, callback: (model: ITextModel, cursor: Cursor) => void): void {
|
||||
const TEXT = [
|
||||
'First line',
|
||||
'Second line',
|
||||
@@ -745,7 +746,7 @@ suite('Editor Contrib - Line Operations', () => {
|
||||
|
||||
test('Bug 18276:[editor] Indentation broken when selection is empty', () => {
|
||||
|
||||
let model = Model.createFromString(
|
||||
let model = TextModel.createFromString(
|
||||
[
|
||||
'function baz() {'
|
||||
].join('\n'),
|
||||
|
||||
Reference in New Issue
Block a user