本文整理汇总了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;
}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:14,代码来源:cursorWordOperations.ts
示例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;
}
}
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:25,代码来源:wordSelections.ts
示例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' });
}
}
开发者ID:eamodio,项目名称:vscode,代码行数:43,代码来源:wordSelections.ts
示例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;
}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:23,代码来源:cursorWordOperations.ts
示例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);
}
开发者ID:ramesius,项目名称:vscode,代码行数:36,代码来源:cursorWordOperations.ts
示例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;
}
开发者ID:liunian,项目名称:vscode,代码行数:13,代码来源:cursorWordOperations.ts
注:本文中的vs/base/common/strings.isLowerAsciiLetter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论