當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript strings.format函數代碼示例

本文整理匯總了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
						);
					});
開發者ID:VishalMadhvani,項目名稱:vscode,代碼行數:9,代碼來源:terminalLinkHandler.test.ts

示例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 ? '!' : ''
		);
	}
開發者ID:asotog,項目名稱:vscode,代碼行數:15,代碼來源:gitModel.ts

示例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 ? '!' : ''
		);
	}
開發者ID:StateFarmIns,項目名稱:vscode,代碼行數:18,代碼來源:gitModel.ts

示例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;
	}
開發者ID:PKRoma,項目名稱:vscode,代碼行數:81,代碼來源:quickOutline.ts

示例5: render

	private render() {
		this.element.textContent = '' + this.count;
		this.element.title = format(this.titleFormat, this.count);

		this.applyStyles();
	}
開發者ID:hungys,項目名稱:vscode,代碼行數:6,代碼來源:countBadge.ts

示例6: getAriaLabel

	public getAriaLabel(): string {
		return strings.format(QuickOutlineNLS.entryAriaLabel, this.name);
	}
開發者ID:PKRoma,項目名稱:vscode,代碼行數:3,代碼來源:quickOutline.ts


注:本文中的vs/base/common/strings.format函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。