本文整理匯總了TypeScript中vs/base/common/strings.format函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript format函數的具體用法?TypeScript format怎麽用?TypeScript format使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了format函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: testLink
supportedLinkFormats.forEach(linkFormatInfo => {
// console.log('linkFormatInfo: ', linkFormatInfo);
testLink(
strings.format(linkFormatInfo.urlFormat, linkUrl, linkFormatInfo.line, linkFormatInfo.column),
linkUrl,
linkFormatInfo.line,
linkFormatInfo.column
);
});
示例2: getPS1
getPS1(): string {
if (!this.HEAD) {
return '';
}
var label = this.HEAD.name || this.HEAD.commit.substr(0, 8);
var statusSummary = this.getStatus().getSummary();
return format('{0}{1}{2}{3}',
label,
statusSummary.hasWorkingTreeChanges ? '*' : '',
statusSummary.hasIndexChanges ? '+' : '',
statusSummary.hasMergeChanges ? '!' : ''
);
}
示例3: getPS1
getPS1(): string {
if (!this.HEAD) {
return '';
}
const tag = this.getRefs().filter(iref => iref.type === RefType.Tag && iref.commit === this.HEAD.commit)[0];
const tagName = tag && tag.name;
const head = this.HEAD.name || tagName || this.HEAD.commit.substr(0, 8);
const statusSummary = this.getStatus().getSummary();
return format('{0}{1}{2}{3}',
head,
statusSummary.hasWorkingTreeChanges ? '*' : '',
statusSummary.hasIndexChanges ? '+' : '',
statusSummary.hasMergeChanges ? '!' : ''
);
}
示例4: toQuickOpenEntries
private toQuickOpenEntries(editor: ICodeEditor, flattened: DocumentSymbol[], searchValue: string): SymbolEntry[] {
const controller = this.getController(editor);
let results: SymbolEntry[] = [];
// Convert to Entries
let normalizedSearchValue = searchValue;
if (searchValue.indexOf(SCOPE_PREFIX) === 0) {
normalizedSearchValue = normalizedSearchValue.substr(SCOPE_PREFIX.length);
}
for (const element of flattened) {
let label = strings.trim(element.name);
// Check for meatch
let highlights = matchesFuzzy(normalizedSearchValue, label);
if (highlights) {
// Show parent scope as description
let description: string | undefined = undefined;
if (element.containerName) {
description = element.containerName;
}
// Add
results.push(this.symbolEntry(label, symbolKindToCssClass(element.kind), description, element.range, highlights, editor, controller));
}
}
// Sort properly if actually searching
if (searchValue) {
if (searchValue.indexOf(SCOPE_PREFIX) === 0) {
results = results.sort(this.sortScoped.bind(this, searchValue.toLowerCase()));
} else {
results = results.sort(this.sortNormal.bind(this, searchValue.toLowerCase()));
}
}
// Mark all type groups
if (results.length > 0 && searchValue.indexOf(SCOPE_PREFIX) === 0) {
let currentType: string | null = null;
let currentResult: SymbolEntry | null = null;
let typeCounter = 0;
for (let i = 0; i < results.length; i++) {
let result = results[i];
// Found new type
if (currentType !== result.getType()) {
// Update previous result with count
if (currentResult) {
currentResult.setGroupLabel(this.typeToLabel(currentType || '', typeCounter));
}
currentType = result.getType();
currentResult = result;
typeCounter = 1;
result.setShowBorder(i > 0);
}
// Existing type, keep counting
else {
typeCounter++;
}
}
// Update previous result with count
if (currentResult) {
currentResult.setGroupLabel(this.typeToLabel(currentType || '', typeCounter));
}
}
// Mark first entry as outline
else if (results.length > 0) {
results[0].setGroupLabel(strings.format(QuickOutlineNLS._symbols_, results.length));
}
return results;
}
示例5: render
private render() {
this.element.textContent = '' + this.count;
this.element.title = format(this.titleFormat, this.count);
this.applyStyles();
}
示例6: getAriaLabel
public getAriaLabel(): string {
return strings.format(QuickOutlineNLS.entryAriaLabel, this.name);
}