本文整理汇总了TypeScript中indent-string.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: if
vscode.window.activeTextEditor.edit((editBuilder: vscode.TextEditorEdit) => {
if (startLine < 0) {
//If the function declaration is on the first line in the editor we need to set startLine to first line
//and then add an extra newline at the end of the text to insert
startLine = 0;
textToInsert = textToInsert + '\n';
}
//Check if there is any text on startLine. If there is, add a new line at the end
var lastCharIndex = vscode.window.activeTextEditor.document.lineAt(startLine).text.length;
var pos:vscode.Position;
if ((lastCharIndex > 0) && (startLine !=0)) {
pos = new vscode.Position(startLine, lastCharIndex);
textToInsert = '\n' + textToInsert;
}
else {
pos = new vscode.Position(startLine, 0);
}
var line:string = vscode.window.activeTextEditor.document.lineAt(selection.start.line).text;
var firstNonWhiteSpace :number = vscode.window.activeTextEditor.document.lineAt(selection.start.line).firstNonWhitespaceCharacterIndex;
var numIndent : number = 0;
var tabSize : number = vscode.window.activeTextEditor.options.tabSize;
var stringToIndent: string = '';
for (var i = 0; i < firstNonWhiteSpace; i++) {
if (line.charAt(i) == '\t') {
stringToIndent = stringToIndent + '\t';
}
else if (line.charAt(i) == ' ') {
stringToIndent = stringToIndent + ' ';
}
}
textToInsert = indentString(textToInsert, stringToIndent, 1);
editBuilder.insert(pos, textToInsert);
}).then(() => {
开发者ID:epaezrubio,项目名称:vscode-comment,代码行数:33,代码来源:extension.ts
示例2: testGroups
async testGroups(): Promise<ITestGroupResult[]> {
const groupResults: ITestGroupResult[] = []
for (const group of this.testRepo.groups) {
const testResults: ITestResult[] = []
for (const test of group.tests) {
let stdout = ''
let stderr = ''
let success = false
try {
const res = await exec(test.file)
console.log(`${chalk.green('✔️')} ${group.name}/${test.name}`)
stdout = res.stdout
stderr = res.stderr
success = true
} catch (e) {
console.log(`${chalk.red('❌')} ${test.name} ${test.file}`)
stdout = e.stdout
stderr = e.stderr
} finally {
if (stdout != '')
console.log(indent(`stdout:\n${indent(stdout, 4)}`, 4))
if (stderr != '')
console.log(indent(`stderr:\n${indent(chalk.red(stderr), 4)}`, 4))
}
testResults.push({
stderr,
stdout,
success,
test,
})
}
groupResults.push({
testGroup: group,
testResults,
})
}
return groupResults
}
开发者ID:ahormazabal,项目名称:rundeck,代码行数:42,代码来源:test-runner.ts
示例3: runCommand
export async function runCommand(command: ICommand, config: ICommandConfig) {
try {
log.write(
chalk.bold(
`Running [${chalk.green(command.name)}] command from [${chalk.yellow(config.rootPath)}]:\n`
)
);
const projectPaths = getProjectPaths(config.rootPath, config.options as IProjectPathOptions);
const projects = await getProjects(config.rootPath, projectPaths, {
exclude: toArray(config.options.exclude),
include: toArray(config.options.include),
});
if (projects.size === 0) {
log.write(
chalk.red(
`There are no projects found. Double check project name(s) in '-i/--include' and '-e/--exclude' filters.\n`
)
);
return process.exit(1);
}
const projectGraph = buildProjectGraph(projects);
log.write(chalk.bold(`Found [${chalk.green(projects.size.toString())}] projects:\n`));
log.write(renderProjectsTree(config.rootPath, projects));
await command.run(projects, projectGraph, config);
} catch (e) {
log.write(chalk.bold.red(`\n[${command.name}] failed:\n`));
if (e instanceof CliError) {
const msg = chalk.red(`CliError: ${e.message}\n`);
log.write(wrapAnsi(msg, 80));
const keys = Object.keys(e.meta);
if (keys.length > 0) {
const metaOutput = keys.map(key => {
const value = e.meta[key];
return `${key}: ${value}`;
});
log.write('Additional debugging info:\n');
log.write(indentString(metaOutput.join('\n'), 3));
}
} else {
log.write(e.stack);
}
process.exit(1);
}
}
开发者ID:Jaaess,项目名称:kibana,代码行数:54,代码来源:run.ts
注:本文中的indent-string.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论