mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 01:37:20 +00:00
trimLeft
-> trimStart
(#190601)
These should be the same but the `trimLeft` name has been deprecated
This commit is contained in:
parent
dea0b0c294
commit
3f8a55b32c
3 changed files with 7 additions and 7 deletions
|
@ -481,7 +481,7 @@ export class Git {
|
|||
const result = await this.exec(pathInsidePossibleRepository, ['rev-parse', '--show-toplevel']);
|
||||
|
||||
// Keep trailing spaces which are part of the directory name
|
||||
const repositoryRootPath = path.normalize(result.stdout.trimLeft().replace(/[\r\n]+$/, ''));
|
||||
const repositoryRootPath = path.normalize(result.stdout.trimStart().replace(/[\r\n]+$/, ''));
|
||||
|
||||
if (isWindows) {
|
||||
// On Git 2.25+ if you call `rev-parse --show-toplevel` on a mapped drive, instead of getting the mapped
|
||||
|
@ -528,7 +528,7 @@ export class Git {
|
|||
!isDescendant(pathInsidePossibleRepository, repositoryRootPath) &&
|
||||
this.compareGitVersionTo('2.31.0') !== -1) {
|
||||
const relativePathResult = await this.exec(pathInsidePossibleRepository, ['rev-parse', '--path-format=relative', '--show-toplevel',]);
|
||||
return path.resolve(pathInsidePossibleRepository, relativePathResult.stdout.trimLeft().replace(/[\r\n]+$/, ''));
|
||||
return path.resolve(pathInsidePossibleRepository, relativePathResult.stdout.trimStart().replace(/[\r\n]+$/, ''));
|
||||
}
|
||||
|
||||
return repositoryRootPath;
|
||||
|
|
|
@ -117,7 +117,7 @@ export class MoveLinesCommand implements ICommand {
|
|||
const oldIndentation = strings.getLeadingWhitespace(model.getLineContent(movingLineNumber));
|
||||
const newSpaceCnt = movingLineMatchResult + indentUtils.getSpaceCnt(oldIndentation, tabSize);
|
||||
const newIndentation = indentUtils.generateIndent(newSpaceCnt, tabSize, insertSpaces);
|
||||
insertingText = newIndentation + this.trimLeft(movingLineText);
|
||||
insertingText = newIndentation + this.trimStart(movingLineText);
|
||||
} else {
|
||||
// no enter rule matches, let's check indentatin rules then.
|
||||
virtualModel.getLineContent = (lineNumber: number) => {
|
||||
|
@ -141,7 +141,7 @@ export class MoveLinesCommand implements ICommand {
|
|||
const oldSpaceCnt = indentUtils.getSpaceCnt(oldIndentation, tabSize);
|
||||
if (newSpaceCnt !== oldSpaceCnt) {
|
||||
const newIndentation = indentUtils.generateIndent(newSpaceCnt, tabSize, insertSpaces);
|
||||
insertingText = newIndentation + this.trimLeft(movingLineText);
|
||||
insertingText = newIndentation + this.trimStart(movingLineText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ export class MoveLinesCommand implements ICommand {
|
|||
enterPrefix = indentConverter.unshiftIndent(enter.indentation) + enter.appendText;
|
||||
}
|
||||
const movingLineText = model.getLineContent(line);
|
||||
if (this.trimLeft(movingLineText).indexOf(this.trimLeft(enterPrefix)) >= 0) {
|
||||
if (this.trimStart(movingLineText).indexOf(this.trimStart(enterPrefix)) >= 0) {
|
||||
const oldIndentation = strings.getLeadingWhitespace(model.getLineContent(line));
|
||||
let newIndentation = strings.getLeadingWhitespace(enterPrefix);
|
||||
const indentMetadataOfMovelingLine = getIndentMetadata(model, line, this._languageConfigurationService);
|
||||
|
@ -354,7 +354,7 @@ export class MoveLinesCommand implements ICommand {
|
|||
return this.parseEnterResult(model, indentConverter, tabSize, line, enter);
|
||||
}
|
||||
|
||||
private trimLeft(str: string) {
|
||||
private trimStart(str: string) {
|
||||
return str.replace(/^\s+/, '');
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ export class Match {
|
|||
after = this._oneLinePreviewText.substring(this._rangeInPreviewText.endColumn - 1);
|
||||
|
||||
before = lcut(before, 26);
|
||||
before = before.trimLeft();
|
||||
before = before.trimStart();
|
||||
|
||||
let charsRemaining = Match.MAX_PREVIEW_CHARS - before.length;
|
||||
inside = inside.substr(0, charsRemaining);
|
||||
|
|
Loading…
Reference in a new issue