未验证 提交 7674039d 编写于 作者: M Matt Bierner 提交者: GitHub

Merge pull request #77758 from pi1024e/master

Fix for "whiteSpace" typo: Parameter name and word is one command word spelled "whitespace".
...@@ -154,10 +154,10 @@ function pathToReplaceRange(valueBeforeCursor: string, fullValue: string, fullVa ...@@ -154,10 +154,10 @@ function pathToReplaceRange(valueBeforeCursor: string, fullValue: string, fullVa
const valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1); const valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1);
const startPos = shiftPosition(fullValueRange.end, -valueAfterLastSlash.length); const startPos = shiftPosition(fullValueRange.end, -valueAfterLastSlash.length);
// If whitespace exists, replace until it // If whitespace exists, replace until it
const whiteSpaceIndex = valueAfterLastSlash.indexOf(' '); const whitespaceIndex = valueAfterLastSlash.indexOf(' ');
let endPos; let endPos;
if (whiteSpaceIndex !== -1) { if (whitespaceIndex !== -1) {
endPos = shiftPosition(startPos, whiteSpaceIndex); endPos = shiftPosition(startPos, whitespaceIndex);
} else { } else {
endPos = fullValueRange.end; endPos = fullValueRange.end;
} }
......
...@@ -84,8 +84,8 @@ function doWrapping(individualLines: boolean, args: any) { ...@@ -84,8 +84,8 @@ function doWrapping(individualLines: boolean, args: any) {
const firstLineOfSelection = editor.document.lineAt(rangeToReplace.start).text.substr(rangeToReplace.start.character); const firstLineOfSelection = editor.document.lineAt(rangeToReplace.start).text.substr(rangeToReplace.start.character);
const matches = firstLineOfSelection.match(/^(\s*)/); const matches = firstLineOfSelection.match(/^(\s*)/);
const extraWhiteSpaceSelected = matches ? matches[1].length : 0; const extraWhitespaceSelected = matches ? matches[1].length : 0;
rangeToReplace = new vscode.Range(rangeToReplace.start.line, rangeToReplace.start.character + extraWhiteSpaceSelected, rangeToReplace.end.line, rangeToReplace.end.character); rangeToReplace = new vscode.Range(rangeToReplace.start.line, rangeToReplace.start.character + extraWhitespaceSelected, rangeToReplace.end.line, rangeToReplace.end.character);
let textToWrapInPreview: string[]; let textToWrapInPreview: string[];
let textToReplace = editor.document.getText(rangeToReplace); let textToReplace = editor.document.getText(rangeToReplace);
...@@ -94,8 +94,8 @@ function doWrapping(individualLines: boolean, args: any) { ...@@ -94,8 +94,8 @@ function doWrapping(individualLines: boolean, args: any) {
} else { } else {
const wholeFirstLine = editor.document.lineAt(rangeToReplace.start).text; const wholeFirstLine = editor.document.lineAt(rangeToReplace.start).text;
const otherMatches = wholeFirstLine.match(/^(\s*)/); const otherMatches = wholeFirstLine.match(/^(\s*)/);
const preceedingWhiteSpace = otherMatches ? otherMatches[1] : ''; const preceedingWhitespace = otherMatches ? otherMatches[1] : '';
textToWrapInPreview = rangeToReplace.isSingleLine ? [textToReplace] : ['\n\t' + textToReplace.split('\n' + preceedingWhiteSpace).join('\n\t') + '\n']; textToWrapInPreview = rangeToReplace.isSingleLine ? [textToReplace] : ['\n\t' + textToReplace.split('\n' + preceedingWhitespace).join('\n\t') + '\n'];
} }
textToWrapInPreview = textToWrapInPreview.map(e => e.replace(/(\$\d)/g, '\\$1')); textToWrapInPreview = textToWrapInPreview.map(e => e.replace(/(\$\d)/g, '\\$1'));
......
...@@ -108,11 +108,12 @@ function pathToSuggestion(p: string, valueBeforeCursor: string, fullValue: strin ...@@ -108,11 +108,12 @@ function pathToSuggestion(p: string, valueBeforeCursor: string, fullValue: strin
// Find the last slash before cursor, and calculate the start of replace range from there // Find the last slash before cursor, and calculate the start of replace range from there
const valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1); const valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1);
const startPos = shiftPosition(range.end, -1 - valueAfterLastSlash.length); const startPos = shiftPosition(range.end, -1 - valueAfterLastSlash.length);
// If whitespace exists, replace until it
const whiteSpaceIndex = valueAfterLastSlash.indexOf(' '); // If whitespace exists, replace until there is no more
const whitespaceIndex = valueAfterLastSlash.indexOf(' ');
let endPos; let endPos;
if (whiteSpaceIndex !== -1) { if (whitespaceIndex !== -1) {
endPos = shiftPosition(startPos, whiteSpaceIndex); endPos = shiftPosition(startPos, whitespaceIndex);
} else { } else {
endPos = shiftPosition(range.end, -1); endPos = shiftPosition(range.end, -1);
} }
......
...@@ -236,7 +236,7 @@ class KeyboardController<T> implements IDisposable { ...@@ -236,7 +236,7 @@ class KeyboardController<T> implements IDisposable {
private view: ListView<T>, private view: ListView<T>,
options: IListOptions<T> options: IListOptions<T>
) { ) {
const multipleSelectionSupport = !(options.multipleSelectionSupport === false); const multipleSelectionSupport = options.multipleSelectionSupport !== false;
this.openController = options.openController || DefaultOpenController; this.openController = options.openController || DefaultOpenController;
......
...@@ -334,7 +334,6 @@ function wrapRelativePattern(parsedPattern: ParsedStringPattern, arg2: string | ...@@ -334,7 +334,6 @@ function wrapRelativePattern(parsedPattern: ParsedStringPattern, arg2: string |
if (!extpath.isEqualOrParent(path, arg2.base)) { if (!extpath.isEqualOrParent(path, arg2.base)) {
return null; return null;
} }
return parsedPattern(paths.relative(arg2.base, path), basename); return parsedPattern(paths.relative(arg2.base, path), basename);
}; };
} }
......
...@@ -374,12 +374,12 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON ...@@ -374,12 +374,12 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
let code = text.charCodeAt(pos); let code = text.charCodeAt(pos);
// trivia: whitespace // trivia: whitespace
if (isWhiteSpace(code)) { if (isWhitespace(code)) {
do { do {
pos++; pos++;
value += String.fromCharCode(code); value += String.fromCharCode(code);
code = text.charCodeAt(pos); code = text.charCodeAt(pos);
} while (isWhiteSpace(code)); } while (isWhitespace(code));
return token = SyntaxKind.Trivia; return token = SyntaxKind.Trivia;
} }
...@@ -517,7 +517,7 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON ...@@ -517,7 +517,7 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
} }
function isUnknownContentCharacter(code: CharacterCodes) { function isUnknownContentCharacter(code: CharacterCodes) {
if (isWhiteSpace(code) || isLineBreak(code)) { if (isWhitespace(code) || isLineBreak(code)) {
return false; return false;
} }
switch (code) { switch (code) {
...@@ -555,7 +555,7 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON ...@@ -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 || 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.nonBreakingSpace || ch === CharacterCodes.ogham || ch >= CharacterCodes.enQuad && ch <= CharacterCodes.zeroWidthSpace ||
ch === CharacterCodes.narrowNoBreakSpace || ch === CharacterCodes.mathematicalSpace || ch === CharacterCodes.ideographicSpace || ch === CharacterCodes.byteOrderMark; ch === CharacterCodes.narrowNoBreakSpace || ch === CharacterCodes.mathematicalSpace || ch === CharacterCodes.ideographicSpace || ch === CharacterCodes.byteOrderMark;
......
...@@ -904,7 +904,7 @@ const editorConfiguration: IConfigurationNode = { ...@@ -904,7 +904,7 @@ const editorConfiguration: IConfigurationNode = {
'enum': ['none', 'boundary', 'selection', 'all'], 'enum': ['none', 'boundary', 'selection', 'all'],
'enumDescriptions': [ 'enumDescriptions': [
'', '',
nls.localize('renderWhiteSpace.boundary', "Render whitespace characters except for single spaces between words."), nls.localize('renderWhitespace.boundary', "Render whitespace characters except for single spaces between words."),
nls.localize('renderWhitespace.selection', "Render whitespace characters only on selected text."), nls.localize('renderWhitespace.selection', "Render whitespace characters only on selected text."),
'' ''
], ],
......
...@@ -589,13 +589,13 @@ export class AutoIndentOnPaste implements IEditorContribution { ...@@ -589,13 +589,13 @@ export class AutoIndentOnPaste implements IEditorContribution {
private shouldIgnoreLine(model: ITextModel, lineNumber: number): boolean { private shouldIgnoreLine(model: ITextModel, lineNumber: number): boolean {
model.forceTokenization(lineNumber); model.forceTokenization(lineNumber);
let nonWhiteSpaceColumn = model.getLineFirstNonWhitespaceColumn(lineNumber); let nonWhitespaceColumn = model.getLineFirstNonWhitespaceColumn(lineNumber);
if (nonWhiteSpaceColumn === 0) { if (nonWhitespaceColumn === 0) {
return true; return true;
} }
let tokens = model.getLineTokens(lineNumber); let tokens = model.getLineTokens(lineNumber);
if (tokens.getCount() > 0) { if (tokens.getCount() > 0) {
let firstNonWhitespaceTokenIndex = tokens.findTokenIndexAtOffset(nonWhiteSpaceColumn); let firstNonWhitespaceTokenIndex = tokens.findTokenIndexAtOffset(nonWhitespaceColumn);
if (firstNonWhitespaceTokenIndex >= 0 && tokens.getStandardTokenType(firstNonWhitespaceTokenIndex) === StandardTokenType.Comment) { if (firstNonWhitespaceTokenIndex >= 0 && tokens.getStandardTokenType(firstNonWhitespaceTokenIndex) === StandardTokenType.Comment) {
return true; return true;
} }
......
...@@ -132,7 +132,7 @@ suite('Cursor move command test', () => { ...@@ -132,7 +132,7 @@ suite('Cursor move command test', () => {
test('move to first non white space character of line from middle', () => { test('move to first non white space character of line from middle', () => {
moveTo(thisCursor, 1, 8); moveTo(thisCursor, 1, 8);
moveToLineFirstNonWhiteSpaceCharacter(thisCursor); moveToLineFirstNonWhitespaceCharacter(thisCursor);
cursorEqual(thisCursor, 1, 6); cursorEqual(thisCursor, 1, 6);
}); });
...@@ -140,7 +140,7 @@ suite('Cursor move command test', () => { ...@@ -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', () => { test('move to first non white space character of line from first non white space character', () => {
moveTo(thisCursor, 1, 6); moveTo(thisCursor, 1, 6);
moveToLineFirstNonWhiteSpaceCharacter(thisCursor); moveToLineFirstNonWhitespaceCharacter(thisCursor);
cursorEqual(thisCursor, 1, 6); cursorEqual(thisCursor, 1, 6);
}); });
...@@ -148,7 +148,7 @@ suite('Cursor move command test', () => { ...@@ -148,7 +148,7 @@ suite('Cursor move command test', () => {
test('move to first non white space character of line from first character', () => { test('move to first non white space character of line from first character', () => {
moveTo(thisCursor, 1, 1); moveTo(thisCursor, 1, 1);
moveToLineFirstNonWhiteSpaceCharacter(thisCursor); moveToLineFirstNonWhitespaceCharacter(thisCursor);
cursorEqual(thisCursor, 1, 6); cursorEqual(thisCursor, 1, 6);
}); });
...@@ -180,7 +180,7 @@ suite('Cursor move command test', () => { ...@@ -180,7 +180,7 @@ suite('Cursor move command test', () => {
test('move to last non white space character from middle', () => { test('move to last non white space character from middle', () => {
moveTo(thisCursor, 1, 8); moveTo(thisCursor, 1, 8);
moveToLineLastNonWhiteSpaceCharacter(thisCursor); moveToLineLastNonWhitespaceCharacter(thisCursor);
cursorEqual(thisCursor, 1, 19); cursorEqual(thisCursor, 1, 19);
}); });
...@@ -188,7 +188,7 @@ suite('Cursor move command test', () => { ...@@ -188,7 +188,7 @@ suite('Cursor move command test', () => {
test('move to last non white space character from last non white space character', () => { test('move to last non white space character from last non white space character', () => {
moveTo(thisCursor, 1, 19); moveTo(thisCursor, 1, 19);
moveToLineLastNonWhiteSpaceCharacter(thisCursor); moveToLineLastNonWhitespaceCharacter(thisCursor);
cursorEqual(thisCursor, 1, 19); cursorEqual(thisCursor, 1, 19);
}); });
...@@ -196,7 +196,7 @@ suite('Cursor move command test', () => { ...@@ -196,7 +196,7 @@ suite('Cursor move command test', () => {
test('move to last non white space character from line end', () => { test('move to last non white space character from line end', () => {
moveTo(thisCursor, 1, 21); moveTo(thisCursor, 1, 21);
moveToLineLastNonWhiteSpaceCharacter(thisCursor); moveToLineLastNonWhitespaceCharacter(thisCursor);
cursorEqual(thisCursor, 1, 19); cursorEqual(thisCursor, 1, 19);
}); });
...@@ -415,7 +415,7 @@ function moveToLineStart(cursor: Cursor) { ...@@ -415,7 +415,7 @@ function moveToLineStart(cursor: Cursor) {
move(cursor, { to: CursorMove.RawDirection.WrappedLineStart }); move(cursor, { to: CursorMove.RawDirection.WrappedLineStart });
} }
function moveToLineFirstNonWhiteSpaceCharacter(cursor: Cursor) { function moveToLineFirstNonWhitespaceCharacter(cursor: Cursor) {
move(cursor, { to: CursorMove.RawDirection.WrappedLineFirstNonWhitespaceCharacter }); move(cursor, { to: CursorMove.RawDirection.WrappedLineFirstNonWhitespaceCharacter });
} }
...@@ -427,7 +427,7 @@ function moveToLineEnd(cursor: Cursor) { ...@@ -427,7 +427,7 @@ function moveToLineEnd(cursor: Cursor) {
move(cursor, { to: CursorMove.RawDirection.WrappedLineEnd }); move(cursor, { to: CursorMove.RawDirection.WrappedLineEnd });
} }
function moveToLineLastNonWhiteSpaceCharacter(cursor: Cursor) { function moveToLineLastNonWhitespaceCharacter(cursor: Cursor) {
move(cursor, { to: CursorMove.RawDirection.WrappedLineLastNonWhitespaceCharacter }); move(cursor, { to: CursorMove.RawDirection.WrappedLineLastNonWhitespaceCharacter });
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册