本文整理汇总了TypeScript中vscode.tasks.onDidStartTask方法的典型用法代码示例。如果您正苦于以下问题:TypeScript tasks.onDidStartTask方法的具体用法?TypeScript tasks.onDidStartTask怎么用?TypeScript tasks.onDidStartTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vscode.tasks
的用法示例。
在下文中一共展示了tasks.onDidStartTask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: activate
export function activate(activationEventOccurred: boolean): void {
if (realActivationOccurred) {
return; // Occurs if multiple delayed commands occur before the real commands are registered.
}
// Activate immediately if an activation event occurred in the previous workspace session.
// If onActivationEvent doesn't occur, it won't auto-activate next time.
activatedPreviously = new PersistentWorkspaceState("activatedPreviously", false);
if (activatedPreviously.Value) {
activatedPreviously.Value = false;
realActivation();
}
if (tempCommands.length === 0) { // Only needs to be added once.
tempCommands.push(vscode.workspace.onDidOpenTextDocument(d => onDidOpenTextDocument(d)));
}
// Check if an activation event has already occurred.
if (activationEventOccurred) {
onActivationEvent();
return;
}
taskProvider = vscode.tasks.registerTaskProvider(taskSourceStr, {
provideTasks: () => {
return getBuildTasks(false);
},
resolveTask(task: vscode.Task): vscode.Task {
// Currently cannot implement because VS Code does not call this. Can implement custom output file directory when enabled.
return undefined;
}
});
vscode.tasks.onDidStartTask(event => {
if (event.execution.task.source === taskSourceStr) {
telemetry.logLanguageServerEvent('buildTaskStarted');
}
});
// handle "workspaceContains:/.vscode/c_cpp_properties.json" activation event.
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) {
for (let i: number = 0; i < vscode.workspace.workspaceFolders.length; ++i) {
let config: string = path.join(vscode.workspace.workspaceFolders[i].uri.fsPath, ".vscode/c_cpp_properties.json");
if (fs.existsSync(config)) {
onActivationEvent();
return;
}
}
}
// handle "onLanguage:cpp" and "onLanguage:c" activation events.
if (vscode.workspace.textDocuments !== undefined && vscode.workspace.textDocuments.length > 0) {
for (let i: number = 0; i < vscode.workspace.textDocuments.length; ++i) {
let document: vscode.TextDocument = vscode.workspace.textDocuments[i];
if (document.languageId === "cpp" || document.languageId === "c") {
onActivationEvent();
return;
}
}
}
}