Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/src/lsp_extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface TaskRequestResponse {
command: string | null;
detail: string;
sourceUri: string;
description: string | null;
}

/** Requests any tasks from the language server that the language server is
Expand Down
3 changes: 2 additions & 1 deletion client/src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function buildDenoConfigTask(
name: string,
command: string | undefined,
sourceUri?: vscode.Uri,
description: string = "",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is description able to be null? TaskRequestResponse has it string or null, this has it as only string. Want to make sure we are consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The buildDenoConfigTask function is also used in other places, such as DenoTaskProvider.resolveTask (

return buildDenoConfigTask(
), where sourceUri is not provided.

Since I added description as a new parameter after the optional sourceUri, it also needs to be an optional parameter. Otherwise, it would cause a TypeScript error due to the ordering of optional and required parameters.

Although the current usage of buildDenoConfigTask is not well unified, I felt it wasn't necessary to refactor that at this time. So I kept description as an optional parameter with a default value of "".

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it - thanks!

): vscode.Task {
const args = [];
if (
Expand All @@ -75,7 +76,7 @@ export function buildDenoConfigTask(
new vscode.ProcessExecution(process, ["task", ...args]),
["$deno"],
);
task.detail = `$ ${command}`;
task.detail = description || `$ ${command}`;
return task;
}

Expand Down
7 changes: 3 additions & 4 deletions client/src/tasks_sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ class DenoTask extends TreeItem {
this.command = commandList[defaultCommand];
this.iconPath = new ThemeIcon("wrench");

if (this.task.definition.command) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this if check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this if check because we're no longer using this.task.definition.command.

Even before this change, the "task" string was always being passed, so the if condition was always true anyway:

command: "task",

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate the explainer

this.tooltip = this.task.definition.command;
this.description = this.task.definition.command;
}
this.tooltip = this.task.detail;
this.description = this.task.detail;
}

getFolder(): WorkspaceFolder {
Expand Down Expand Up @@ -153,6 +151,7 @@ class DenoTaskProvider implements TaskProvider {
configTask.name,
configTask.command ?? configTask.detail,
Uri.parse(configTask.sourceUri),
configTask.description ?? "",
);
tasks.push(task);
}
Expand Down