Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --This was raised before in but closed for not providing enough detail. I'll try to do better. Possibly historically related, but I really don't know: . This buggy behaviour was raised to my attention on Stack Overflow in <!-- Test using the latest Insiders build to see if your issue has already been fixed: --I have tested on Insiders with no non-builtin extensions installed, and on top of that with extensions disabled: <!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes. I also tested with a default profile. <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: 1.81.1, 1.82.0-insider OS Version: Ubuntu 22.04.2. The Stack Overflow user seems to be on windows judging by the backslash path separators, and was Windows and WSL. Steps to Reproduce: a new workspace folder. put anything. Ex. "hello world!" put anything. Ex. "hello world!" and run in the command palette, and observe that it shows the task (unexpected). and run in the command palette, and observe that it shows the task (expected). swap the order the task definitions in and run in the command palette, and observe that it shows the task (expected). and run in the command palette, and observe that it shows the task (unexpected).
maybe related to this change
I can reproduce, doesn't work at all. To that I would add that it isn't documented in
Marking as feature so it gets tested/verified and because this never worked before
Thanks! Do you want me to file a reminder to document this useful feature or is it unnecessary?
that's unnecessary, but it would be great if you'd verify the fix when it's released in insider's. When that happens, you'll see the label applied.

Discussion:
title: strings.fetching }; const promise = (async () => { <del> let groupTasks: (Task | ConfiguringTask)[] = []; </del> async function runSingleTask(task: Task | undefined, problemMatcherOptions: IProblemMatcherRunOptions | undefined, that: AbstractTaskService) { that.run(task, problemMatcherOptions, TaskRunSource.User).then(undefined, reason => {

}); }); }; <del> let globTasksDetected = false; // First check for globs before checking for the default tasks of the task group const absoluteURI = EditorResourceAccessor.getOriginalUri(this._editorService.activeEditor); if (absoluteURI) { const workspaceFolder = this._contextService.getWorkspaceFolder(absoluteURI); if (workspaceFolder) { const configuredTasks = this._getConfiguration(workspaceFolder)?.config?.tasks; if (configuredTasks) { globTasksDetected = configuredTasks.filter(task => task.group && typeof task.group !== 'string' && typeof task.group.isDefault === 'string').length > 0; // This will activate extensions, so only do so if necessary #185960 if (globTasksDetected) { // Fallback to absolute path of the file if it is not in a workspace or relative path cannot be found const relativePath = workspaceFolder?.uri ? (resources.relativePath(workspaceFolder.uri, absoluteURI) ?? absoluteURI.path) : absoluteURI.path; groupTasks = await this._findWorkspaceTasks((task) => { const currentTaskGroup = task.configurationProperties.group; if (currentTaskGroup && typeof currentTaskGroup !== 'string' && typeof currentTaskGroup.isDefault === 'string') { return (currentTaskGroup._id === taskGroup._id && glob.match(currentTaskGroup.isDefault, relativePath)); } return false; }); } } } } </del> <ins> let groupTasks: (Task | ConfiguringTask)[] = []; const { globGroupTasks, globTasksDetected } = await this._getGlobTasks(taskGroup._id); groupTasks = [...globGroupTasks]; </ins> if (!globTasksDetected && groupTasks.length === 0) { groupTasks = await this._findWorkspaceTasksInGroup(taskGroup, true); }

this._progressService.withProgress(options, () => promise); } <ins> private async _getGlobTasks(taskGroupId: string): Promise<{ globGroupTasks: (Task | ConfiguringTask)[]; globTasksDetected: boolean }> { let globTasksDetected = false; // First check for globs before checking for the default tasks of the task group const absoluteURI = EditorResourceAccessor.getOriginalUri(this._editorService.activeEditor); if (absoluteURI) { const workspaceFolder = this._contextService.getWorkspaceFolder(absoluteURI); if (workspaceFolder) { const configuredTasks = this._getConfiguration(workspaceFolder)?.config?.tasks; if (configuredTasks) { globTasksDetected = configuredTasks.filter(task => task.group && typeof task.group !== 'string' && typeof task.group.isDefault === 'string').length > 0; // This will activate extensions, so only do so if necessary #185960 if (globTasksDetected) { // Fallback to absolute path of the file if it is not in a workspace or relative path cannot be found const relativePath = workspaceFolder?.uri ? (resources.relativePath(workspaceFolder.uri, absoluteURI) ?? absoluteURI.path) : absoluteURI.path; const globGroupTasks = await this._findWorkspaceTasks((task) => { const currentTaskGroup = task.configurationProperties.group; if (currentTaskGroup && typeof currentTaskGroup !== 'string' && typeof currentTaskGroup.isDefault === 'string') { return (currentTaskGroup._id === taskGroupId && glob.match(currentTaskGroup.isDefault, relativePath)); } globTasksDetected = false; return false; }); return { globGroupTasks, globTasksDetected }; } } } } return { globGroupTasks: [], globTasksDetected }; } </ins> private _runBuildCommand(): void { if (!this._tasksReconnected) { return;

const entries: QuickPickInput<TaskQuickPickEntryType>[] = []; let selectedTask: Task | undefined; let selectedEntry: TaskQuickPickEntryType | undefined; <del> this._showIgnoredFoldersMessage().then(() => { </del> <ins> this._showIgnoredFoldersMessage().then(async () => { const { globGroupTasks } = await this._getGlobTasks(TaskGroup.Build._id); let defaultTasks = globGroupTasks; if (!defaultTasks?.length) { defaultTasks = this._getDefaultTasks(tasks, false); } let defaultBuildTask; if (defaultTasks.length === 1) { const group: string | TaskGroup | undefined = defaultTasks[0].configurationProperties.group; if (group) { if (typeof group === 'string' && group === TaskGroup.Build._id) { defaultBuildTask = defaultTasks[0]; } else { defaultBuildTask = defaultTasks[0]; } } } </ins> for (const task of tasks) { <del> const taskGroup: TaskGroup | undefined = TaskGroup.from(task.configurationProperties.group); if (taskGroup && taskGroup.isDefault && taskGroup._id === TaskGroup.Build._id) { </del> <ins> if (task === defaultBuildTask) { </ins> const label = nls.localize('TaskService.defaultBuildTaskExists', '{0} is already marked as the default build task', TaskQuickPick.getTaskLabelWithIcon(task, task.getQualifiedLabel())); selectedTask = task; selectedEntry = { label, task, description: this.getTaskDescription(task), detail: this._showDetail() ? task.configurationProperties.detail : undefined };