mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Respelling "WhiteSpace" as "Whitespace", in functions, as Whitespace is one word
This commit is contained in:
parent
e89ea5c965
commit
c757f491e5
|
@ -84,8 +84,8 @@ function doWrapping(individualLines: boolean, args: any) {
|
|||
|
||||
const firstLineOfSelection = editor.document.lineAt(rangeToReplace.start).text.substr(rangeToReplace.start.character);
|
||||
const matches = firstLineOfSelection.match(/^(\s*)/);
|
||||
const extraWhiteSpaceSelected = matches ? matches[1].length : 0;
|
||||
rangeToReplace = new vscode.Range(rangeToReplace.start.line, rangeToReplace.start.character + extraWhiteSpaceSelected, rangeToReplace.end.line, rangeToReplace.end.character);
|
||||
const extraWhitespaceSelected = matches ? matches[1].length : 0;
|
||||
rangeToReplace = new vscode.Range(rangeToReplace.start.line, rangeToReplace.start.character + extraWhitespaceSelected, rangeToReplace.end.line, rangeToReplace.end.character);
|
||||
|
||||
let textToWrapInPreview: string[];
|
||||
let textToReplace = editor.document.getText(rangeToReplace);
|
||||
|
@ -94,8 +94,8 @@ function doWrapping(individualLines: boolean, args: any) {
|
|||
} else {
|
||||
const wholeFirstLine = editor.document.lineAt(rangeToReplace.start).text;
|
||||
const otherMatches = wholeFirstLine.match(/^(\s*)/);
|
||||
const preceedingWhiteSpace = otherMatches ? otherMatches[1] : '';
|
||||
textToWrapInPreview = rangeToReplace.isSingleLine ? [textToReplace] : ['\n\t' + textToReplace.split('\n' + preceedingWhiteSpace).join('\n\t') + '\n'];
|
||||
const preceedingWhitespace = otherMatches ? otherMatches[1] : '';
|
||||
textToWrapInPreview = rangeToReplace.isSingleLine ? [textToReplace] : ['\n\t' + textToReplace.split('\n' + preceedingWhitespace).join('\n\t') + '\n'];
|
||||
}
|
||||
textToWrapInPreview = textToWrapInPreview.map(e => e.replace(/(\$\d)/g, '\\$1'));
|
||||
|
||||
|
|
|
@ -374,12 +374,12 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
|
|||
|
||||
let code = text.charCodeAt(pos);
|
||||
// trivia: whitespace
|
||||
if (isWhiteSpace(code)) {
|
||||
if (isWhitespace(code)) {
|
||||
do {
|
||||
pos++;
|
||||
value += String.fromCharCode(code);
|
||||
code = text.charCodeAt(pos);
|
||||
} while (isWhiteSpace(code));
|
||||
} while (isWhitespace(code));
|
||||
|
||||
return token = SyntaxKind.Trivia;
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
|
|||
}
|
||||
|
||||
function isUnknownContentCharacter(code: CharacterCodes) {
|
||||
if (isWhiteSpace(code) || isLineBreak(code)) {
|
||||
if (isWhitespace(code) || isLineBreak(code)) {
|
||||
return false;
|
||||
}
|
||||
switch (code) {
|
||||
|
@ -555,7 +555,7 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
|
|||
};
|
||||
}
|
||||
|
||||
function isWhiteSpace(ch: number): boolean {
|
||||
function isWhitespace(ch: number): boolean {
|
||||
return ch === CharacterCodes.space || ch === CharacterCodes.tab || ch === CharacterCodes.verticalTab || ch === CharacterCodes.formFeed ||
|
||||
ch === CharacterCodes.nonBreakingSpace || ch === CharacterCodes.ogham || ch >= CharacterCodes.enQuad && ch <= CharacterCodes.zeroWidthSpace ||
|
||||
ch === CharacterCodes.narrowNoBreakSpace || ch === CharacterCodes.mathematicalSpace || ch === CharacterCodes.ideographicSpace || ch === CharacterCodes.byteOrderMark;
|
||||
|
|
|
@ -589,13 +589,13 @@ export class AutoIndentOnPaste implements IEditorContribution {
|
|||
|
||||
private shouldIgnoreLine(model: ITextModel, lineNumber: number): boolean {
|
||||
model.forceTokenization(lineNumber);
|
||||
let nonWhiteSpaceColumn = model.getLineFirstNonWhitespaceColumn(lineNumber);
|
||||
if (nonWhiteSpaceColumn === 0) {
|
||||
let nonWhitespaceColumn = model.getLineFirstNonWhitespaceColumn(lineNumber);
|
||||
if (nonWhitespaceColumn === 0) {
|
||||
return true;
|
||||
}
|
||||
let tokens = model.getLineTokens(lineNumber);
|
||||
if (tokens.getCount() > 0) {
|
||||
let firstNonWhitespaceTokenIndex = tokens.findTokenIndexAtOffset(nonWhiteSpaceColumn);
|
||||
let firstNonWhitespaceTokenIndex = tokens.findTokenIndexAtOffset(nonWhitespaceColumn);
|
||||
if (firstNonWhitespaceTokenIndex >= 0 && tokens.getStandardTokenType(firstNonWhitespaceTokenIndex) === StandardTokenType.Comment) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ suite('Cursor move command test', () => {
|
|||
test('move to first non white space character of line from middle', () => {
|
||||
moveTo(thisCursor, 1, 8);
|
||||
|
||||
moveToLineFirstNonWhiteSpaceCharacter(thisCursor);
|
||||
moveToLineFirstNonWhitespaceCharacter(thisCursor);
|
||||
|
||||
cursorEqual(thisCursor, 1, 6);
|
||||
});
|
||||
|
@ -140,7 +140,7 @@ suite('Cursor move command test', () => {
|
|||
test('move to first non white space character of line from first non white space character', () => {
|
||||
moveTo(thisCursor, 1, 6);
|
||||
|
||||
moveToLineFirstNonWhiteSpaceCharacter(thisCursor);
|
||||
moveToLineFirstNonWhitespaceCharacter(thisCursor);
|
||||
|
||||
cursorEqual(thisCursor, 1, 6);
|
||||
});
|
||||
|
@ -148,7 +148,7 @@ suite('Cursor move command test', () => {
|
|||
test('move to first non white space character of line from first character', () => {
|
||||
moveTo(thisCursor, 1, 1);
|
||||
|
||||
moveToLineFirstNonWhiteSpaceCharacter(thisCursor);
|
||||
moveToLineFirstNonWhitespaceCharacter(thisCursor);
|
||||
|
||||
cursorEqual(thisCursor, 1, 6);
|
||||
});
|
||||
|
@ -180,7 +180,7 @@ suite('Cursor move command test', () => {
|
|||
test('move to last non white space character from middle', () => {
|
||||
moveTo(thisCursor, 1, 8);
|
||||
|
||||
moveToLineLastNonWhiteSpaceCharacter(thisCursor);
|
||||
moveToLineLastNonWhitespaceCharacter(thisCursor);
|
||||
|
||||
cursorEqual(thisCursor, 1, 19);
|
||||
});
|
||||
|
@ -188,7 +188,7 @@ suite('Cursor move command test', () => {
|
|||
test('move to last non white space character from last non white space character', () => {
|
||||
moveTo(thisCursor, 1, 19);
|
||||
|
||||
moveToLineLastNonWhiteSpaceCharacter(thisCursor);
|
||||
moveToLineLastNonWhitespaceCharacter(thisCursor);
|
||||
|
||||
cursorEqual(thisCursor, 1, 19);
|
||||
});
|
||||
|
@ -196,7 +196,7 @@ suite('Cursor move command test', () => {
|
|||
test('move to last non white space character from line end', () => {
|
||||
moveTo(thisCursor, 1, 21);
|
||||
|
||||
moveToLineLastNonWhiteSpaceCharacter(thisCursor);
|
||||
moveToLineLastNonWhitespaceCharacter(thisCursor);
|
||||
|
||||
cursorEqual(thisCursor, 1, 19);
|
||||
});
|
||||
|
@ -415,7 +415,7 @@ function moveToLineStart(cursor: Cursor) {
|
|||
move(cursor, { to: CursorMove.RawDirection.WrappedLineStart });
|
||||
}
|
||||
|
||||
function moveToLineFirstNonWhiteSpaceCharacter(cursor: Cursor) {
|
||||
function moveToLineFirstNonWhitespaceCharacter(cursor: Cursor) {
|
||||
move(cursor, { to: CursorMove.RawDirection.WrappedLineFirstNonWhitespaceCharacter });
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ function moveToLineEnd(cursor: Cursor) {
|
|||
move(cursor, { to: CursorMove.RawDirection.WrappedLineEnd });
|
||||
}
|
||||
|
||||
function moveToLineLastNonWhiteSpaceCharacter(cursor: Cursor) {
|
||||
function moveToLineLastNonWhitespaceCharacter(cursor: Cursor) {
|
||||
move(cursor, { to: CursorMove.RawDirection.WrappedLineLastNonWhitespaceCharacter });
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue