Skip to content

Commit 3c1cb7f

Browse files
authored
fix: catch errors while fetching config tasks from language server (denoland#669)
1 parent c8d3b7d commit 3c1cb7f

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

client/src/tasks.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,22 @@ class DenoTaskProvider implements vscode.TaskProvider {
144144
const supportsConfigTasks = this.#extensionContext.serverCapabilities
145145
?.experimental?.denoConfigTasks;
146146
if (client && supportsConfigTasks) {
147-
const configTasks = await client.sendRequest(taskReq, {});
148-
for (const workspaceFolder of vscode.workspace.workspaceFolders ?? []) {
149-
if (configTasks) {
150-
for (const { name, detail } of configTasks) {
151-
tasks.push(
152-
buildDenoConfigTask(workspaceFolder, process, name, detail),
153-
);
147+
try {
148+
const configTasks = await client.sendRequest(taskReq, {});
149+
for (const workspaceFolder of vscode.workspace.workspaceFolders ?? []) {
150+
if (configTasks) {
151+
for (const { name, detail } of configTasks) {
152+
tasks.push(
153+
buildDenoConfigTask(workspaceFolder, process, name, detail),
154+
);
155+
}
154156
}
155157
}
158+
} catch (err) {
159+
vscode.window.showErrorMessage("Failed to retrieve config tasks.");
160+
this.#extensionContext.outputChannel.appendLine(
161+
`Error retrieving config tasks: ${err}`,
162+
);
156163
}
157164
}
158165

0 commit comments

Comments
 (0)