本文整理匯總了TypeScript中vs/base/common/strings.isLowerAsciiLetter函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isLowerAsciiLetter函數的具體用法?TypeScript isLowerAsciiLetter怎麽用?TypeScript isLowerAsciiLetter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isLowerAsciiLetter函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: _lastWordPartEnd
export function _lastWordPartEnd(str: string, startIndex: number = str.length - 1): number {
let ignoreUpperCase = !strings.isLowerAsciiLetter(str.charCodeAt(startIndex + 1));
for (let i = startIndex; i >= 0; i--) {
let chCode = str.charCodeAt(i);
if (chCode === CharCode.Space || chCode === CharCode.Tab || (!ignoreUpperCase && strings.isUpperAsciiLetter(chCode)) || chCode === CharCode.Underline) {
return i - 1;
}
if (ignoreUpperCase && i < startIndex && strings.isLowerAsciiLetter(chCode)) {
return i;
}
ignoreUpperCase = ignoreUpperCase && strings.isUpperAsciiLetter(chCode);
}
return -1;
}
示例2: _addInWordRanges
private _addInWordRanges(bucket: SelectionRange[], model: ITextModel, pos: Position): void {
const obj = model.getWordAtPosition(pos);
if (!obj) {
return;
}
let { word, startColumn } = obj;
let offset = pos.column - startColumn;
let lastCh: number = 0;
for (; offset < word.length; offset++) {
let ch = word.charCodeAt(offset);
if (isUpperAsciiLetter(ch) && isLowerAsciiLetter(lastCh)) {
// fooBar
// ^^^
// ^^^^^^
bucket.push({ range: new Range(pos.lineNumber, startColumn, pos.lineNumber, startColumn + offset), kind: 'statement.word.part' });
} else if (ch === CharCode.Underline && lastCh !== CharCode.Underline) {
// foo_bar
// ^^^
// ^^^^^^^
bucket.push({ range: new Range(pos.lineNumber, startColumn, pos.lineNumber, startColumn + offset), kind: 'statement.word.part' });
offset += 1;
}
lastCh = ch;
}
}
示例3: _addInWordRanges
private _addInWordRanges(bucket: SelectionRange[], model: ITextModel, pos: Position): void {
const obj = model.getWordAtPosition(pos);
if (!obj) {
return;
}
let { word, startColumn } = obj;
let offset = pos.column - startColumn;
let start = offset;
let end = offset;
let lastCh: number = 0;
// LEFT anchor (start)
for (; start >= 0; start--) {
let ch = word.charCodeAt(start);
if (ch === CharCode.Underline || ch === CharCode.Dash) {
// foo-bar OR foo_bar
break;
} else if (isLowerAsciiLetter(ch) && isUpperAsciiLetter(lastCh)) {
// fooBar
break;
}
lastCh = ch;
}
start += 1;
// RIGHT anchor (end)
for (; end < word.length; end++) {
let ch = word.charCodeAt(end);
if (isUpperAsciiLetter(ch) && isLowerAsciiLetter(lastCh)) {
// fooBar
break;
} else if (ch === CharCode.Underline || ch === CharCode.Dash) {
// foo-bar OR foo_bar
break;
}
lastCh = ch;
}
if (start < end) {
bucket.push({ range: new Range(pos.lineNumber, startColumn + start, pos.lineNumber, startColumn + end), kind: 'statement.word.part' });
}
}
示例4: _nextWordPartBegin
export function _nextWordPartBegin(str: string, startIndex: number = 0): number {
let prevChCode = str.charCodeAt(startIndex - 1);
let chCode = str.charCodeAt(startIndex);
// handle the special case ' X' and ' x' which is different from the standard methods
if ((prevChCode === CharCode.Space || prevChCode === CharCode.Tab) && (strings.isLowerAsciiLetter(chCode) || strings.isUpperAsciiLetter(chCode))) {
return startIndex + 1;
}
let ignoreUpperCase = strings.isUpperAsciiLetter(chCode);
for (let i = startIndex; i < str.length; ++i) {
chCode = str.charCodeAt(i);
if (chCode === CharCode.Space || chCode === CharCode.Tab || (!ignoreUpperCase && strings.isUpperAsciiLetter(chCode))) {
return i + 1;
}
if (ignoreUpperCase && strings.isLowerAsciiLetter(chCode)) {
return i; // multiple UPPERCase : assume an upper case word and a CamelCase word - like DSLModel
}
ignoreUpperCase = ignoreUpperCase && strings.isUpperAsciiLetter(chCode);
if (chCode === CharCode.Underline) {
return i + 2;
}
}
return str.length + 1;
}
示例5: _moveWordPartRight
public static _moveWordPartRight(model: ICursorSimpleModel, position: Position): Position {
const lineNumber = position.lineNumber;
const maxColumn = model.getLineMaxColumn(lineNumber);
if (position.column === maxColumn) {
return (lineNumber < model.getLineCount() ? new Position(lineNumber + 1, 1) : position);
}
const lineContent = model.getLineContent(lineNumber);
for (let column = position.column + 1; column < maxColumn; column++) {
const left = lineContent.charCodeAt(column - 2);
const right = lineContent.charCodeAt(column - 1);
if (left === CharCode.Underline && right !== CharCode.Underline) {
// snake_case_variables
return new Position(lineNumber, column);
}
if (strings.isLowerAsciiLetter(left) && strings.isUpperAsciiLetter(right)) {
// camelCaseVariables
return new Position(lineNumber, column);
}
if (strings.isUpperAsciiLetter(left) && strings.isUpperAsciiLetter(right)) {
// thisIsACamelCaseWithOneLetterWords
if (column + 1 < maxColumn) {
const rightRight = lineContent.charCodeAt(column);
if (strings.isLowerAsciiLetter(rightRight)) {
return new Position(lineNumber, column);
}
}
}
}
return new Position(lineNumber, maxColumn);
}
示例6: _nextWordPartBegin
export function _nextWordPartBegin(str: string, startIndex: number = str.length - 1): number {
const checkLowerCase = str.charCodeAt(startIndex - 1) === CharCode.Space; // does a lc char count as a part start?
for (let i = startIndex; i < str.length; ++i) {
let chCode = str.charCodeAt(i);
if (chCode === CharCode.Space || chCode === CharCode.Tab || strings.isUpperAsciiLetter(chCode) || (checkLowerCase && strings.isLowerAsciiLetter(chCode))) {
return i + 1;
}
if (chCode === CharCode.Underline) {
return i + 2;
}
}
return str.length + 1;
}