Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)

* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c

* remove files we don't want

* fix hygiene

* update distro

* update distro

* fix hygiene

* fix strict nulls

* distro

* distro

* fix tests

* fix tests

* add another edit

* fix viewlet icon

* fix azure dialog

* fix some padding

* fix more padding issues
This commit is contained in:
Anthony Dresser
2019-12-04 19:28:22 -08:00
committed by GitHub
parent a8818ab0df
commit f5ce7fb2a5
1507 changed files with 42813 additions and 27370 deletions

View File

@@ -13,18 +13,19 @@ import { IndentAction } from 'vs/editor/common/modes/languageConfiguration';
import { IIndentConverter, LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { IndentConsts } from 'vs/editor/common/modes/supports/indentRules';
import * as indentUtils from 'vs/editor/contrib/indentation/indentUtils';
import { EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions';
export class MoveLinesCommand implements ICommand {
private readonly _selection: Selection;
private readonly _isMovingDown: boolean;
private readonly _autoIndent: boolean;
private readonly _autoIndent: EditorAutoIndentStrategy;
private _selectionId: string | null;
private _moveEndPositionDown?: boolean;
private _moveEndLineSelectionShrink: boolean;
constructor(selection: Selection, isMovingDown: boolean, autoIndent: boolean) {
constructor(selection: Selection, isMovingDown: boolean, autoIndent: EditorAutoIndentStrategy) {
this._selection = selection;
this._isMovingDown = isMovingDown;
this._autoIndent = autoIndent;
@@ -117,7 +118,7 @@ export class MoveLinesCommand implements ICommand {
return model.getLineContent(lineNumber);
}
};
let indentOfMovingLine = LanguageConfigurationRegistry.getGoodIndentForLine(virtualModel, model.getLanguageIdAtPosition(
let indentOfMovingLine = LanguageConfigurationRegistry.getGoodIndentForLine(this._autoIndent, virtualModel, model.getLanguageIdAtPosition(
movingLineNumber, 1), s.startLineNumber, indentConverter);
if (indentOfMovingLine !== null) {
let oldIndentation = strings.getLeadingWhitespace(model.getLineContent(movingLineNumber));
@@ -152,7 +153,7 @@ export class MoveLinesCommand implements ICommand {
}
};
let newIndentatOfMovingBlock = LanguageConfigurationRegistry.getGoodIndentForLine(virtualModel, model.getLanguageIdAtPosition(
let newIndentatOfMovingBlock = LanguageConfigurationRegistry.getGoodIndentForLine(this._autoIndent, virtualModel, model.getLanguageIdAtPosition(
movingLineNumber, 1), s.startLineNumber + 1, indentConverter);
if (newIndentatOfMovingBlock !== null) {
@@ -197,7 +198,7 @@ export class MoveLinesCommand implements ICommand {
}
} else {
// it doesn't match any onEnter rule, let's check indentation rules then.
let indentOfFirstLine = LanguageConfigurationRegistry.getGoodIndentForLine(virtualModel, model.getLanguageIdAtPosition(s.startLineNumber, 1), movingLineNumber, indentConverter);
let indentOfFirstLine = LanguageConfigurationRegistry.getGoodIndentForLine(this._autoIndent, virtualModel, model.getLanguageIdAtPosition(s.startLineNumber, 1), movingLineNumber, indentConverter);
if (indentOfFirstLine !== null) {
// adjust the indentation of the moving block
let oldIndent = strings.getLeadingWhitespace(model.getLineContent(s.startLineNumber));
@@ -251,20 +252,19 @@ export class MoveLinesCommand implements ICommand {
}
let maxColumn = model.getLineMaxColumn(validPrecedingLine);
let enter = LanguageConfigurationRegistry.getEnterAction(model, new Range(validPrecedingLine, maxColumn, validPrecedingLine, maxColumn));
let enter = LanguageConfigurationRegistry.getEnterAction(this._autoIndent, model, new Range(validPrecedingLine, maxColumn, validPrecedingLine, maxColumn));
if (enter) {
let enterPrefix = enter.indentation;
let enterAction = enter.enterAction;
if (enterAction.indentAction === IndentAction.None) {
enterPrefix = enter.indentation + enterAction.appendText;
} else if (enterAction.indentAction === IndentAction.Indent) {
enterPrefix = enter.indentation + enterAction.appendText;
} else if (enterAction.indentAction === IndentAction.IndentOutdent) {
if (enter.indentAction === IndentAction.None) {
enterPrefix = enter.indentation + enter.appendText;
} else if (enter.indentAction === IndentAction.Indent) {
enterPrefix = enter.indentation + enter.appendText;
} else if (enter.indentAction === IndentAction.IndentOutdent) {
enterPrefix = enter.indentation;
} else if (enterAction.indentAction === IndentAction.Outdent) {
enterPrefix = indentConverter.unshiftIndent(enter.indentation) + enterAction.appendText;
} else if (enter.indentAction === IndentAction.Outdent) {
enterPrefix = indentConverter.unshiftIndent(enter.indentation) + enter.appendText;
}
let movingLineText = model.getLineContent(line);
if (this.trimLeft(movingLineText).indexOf(this.trimLeft(enterPrefix)) >= 0) {
@@ -288,7 +288,7 @@ export class MoveLinesCommand implements ICommand {
}
private shouldAutoIndent(model: ITextModel, selection: Selection) {
if (!this._autoIndent) {
if (this._autoIndent < EditorAutoIndentStrategy.Full) {
return false;
}
// if it's not easy to tokenize, we stop auto indent.