@codingame/monaco-vscode-task-service-override 4.5.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-task-service-override",
3
- "version": "4.5.2",
3
+ "version": "5.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@4.5.2"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@5.0.0"
30
30
  }
31
31
  }
@@ -267,9 +267,9 @@ let AbstractTaskService = class AbstractTaskService extends Disposable {
267
267
  }
268
268
  return task._label;
269
269
  });
270
- this._lifecycleService.onBeforeShutdown(e => {
270
+ this._register(this._lifecycleService.onBeforeShutdown(e => {
271
271
  this._willRestart = e.reason !== 3 ;
272
- });
272
+ }));
273
273
  this._register(this.onDidStateChange(e => {
274
274
  this._log(( localizeWithPath(_moduleId, 3, 'Task Event kind: {0}', e.kind)), true);
275
275
  if (e.kind === "changed" ) ;
@@ -2841,7 +2841,7 @@ let AbstractTaskService = class AbstractTaskService extends Disposable {
2841
2841
  }
2842
2842
  _getDefaultTasks(tasks, taskGlobsInList = false) {
2843
2843
  const defaults = [];
2844
- for (const task of tasks) {
2844
+ for (const task of tasks.filter(t => !!t.configurationProperties.group)) {
2845
2845
  if (taskGlobsInList && typeof task.configurationProperties.group.isDefault === 'string') {
2846
2846
  defaults.push(task);
2847
2847
  }
@@ -2861,7 +2861,6 @@ let AbstractTaskService = class AbstractTaskService extends Disposable {
2861
2861
  title: strings.fetching
2862
2862
  };
2863
2863
  const promise = (async () => {
2864
- let groupTasks = [];
2865
2864
  async function runSingleTask(task, problemMatcherOptions, that) {
2866
2865
  that.run(task, problemMatcherOptions, 1 ).then(undefined, reason => {
2867
2866
  });
@@ -2884,27 +2883,9 @@ let AbstractTaskService = class AbstractTaskService extends Disposable {
2884
2883
  });
2885
2884
  });
2886
2885
  };
2887
- let globTasksDetected = false;
2888
- const absoluteURI = EditorResourceAccessor.getOriginalUri(this._editorService.activeEditor);
2889
- if (absoluteURI) {
2890
- const workspaceFolder = this._contextService.getWorkspaceFolder(absoluteURI);
2891
- if (workspaceFolder) {
2892
- const configuredTasks = this._getConfiguration(workspaceFolder)?.config?.tasks;
2893
- if (configuredTasks) {
2894
- globTasksDetected = configuredTasks.filter(task => task.group && typeof task.group !== 'string' && typeof task.group.isDefault === 'string').length > 0;
2895
- if (globTasksDetected) {
2896
- const relativePath$1 = workspaceFolder?.uri ? (relativePath(workspaceFolder.uri, absoluteURI) ?? absoluteURI.path) : absoluteURI.path;
2897
- groupTasks = await this._findWorkspaceTasks((task) => {
2898
- const currentTaskGroup = task.configurationProperties.group;
2899
- if (currentTaskGroup && typeof currentTaskGroup !== 'string' && typeof currentTaskGroup.isDefault === 'string') {
2900
- return (currentTaskGroup._id === taskGroup._id && match(currentTaskGroup.isDefault, relativePath$1));
2901
- }
2902
- return false;
2903
- });
2904
- }
2905
- }
2906
- }
2907
- }
2886
+ let groupTasks = [];
2887
+ const { globGroupTasks, globTasksDetected } = await this._getGlobTasks(taskGroup._id);
2888
+ groupTasks = [...globGroupTasks];
2908
2889
  if (!globTasksDetected && groupTasks.length === 0) {
2909
2890
  groupTasks = await this._findWorkspaceTasksInGroup(taskGroup, true);
2910
2891
  }
@@ -2940,7 +2921,7 @@ let AbstractTaskService = class AbstractTaskService extends Disposable {
2940
2921
  return handleMultipleTasks(true);
2941
2922
  }
2942
2923
  if (!groupTasks.length) {
2943
- groupTasks = await this._findWorkspaceTasksInGroup(taskGroup, false);
2924
+ groupTasks = await this._findWorkspaceTasksInGroup(taskGroup, true);
2944
2925
  }
2945
2926
  if (groupTasks.length === 1) {
2946
2927
  return resolveTaskAndRun(groupTasks[0]);
@@ -2949,6 +2930,32 @@ let AbstractTaskService = class AbstractTaskService extends Disposable {
2949
2930
  })();
2950
2931
  this._progressService.withProgress(options, () => promise);
2951
2932
  }
2933
+ async _getGlobTasks(taskGroupId) {
2934
+ let globTasksDetected = false;
2935
+ const absoluteURI = EditorResourceAccessor.getOriginalUri(this._editorService.activeEditor);
2936
+ if (absoluteURI) {
2937
+ const workspaceFolder = this._contextService.getWorkspaceFolder(absoluteURI);
2938
+ if (workspaceFolder) {
2939
+ const configuredTasks = this._getConfiguration(workspaceFolder)?.config?.tasks;
2940
+ if (configuredTasks) {
2941
+ globTasksDetected = configuredTasks.filter(task => task.group && typeof task.group !== 'string' && typeof task.group.isDefault === 'string').length > 0;
2942
+ if (globTasksDetected) {
2943
+ const relativePath$1 = workspaceFolder?.uri ? (relativePath(workspaceFolder.uri, absoluteURI) ?? absoluteURI.path) : absoluteURI.path;
2944
+ const globGroupTasks = await this._findWorkspaceTasks((task) => {
2945
+ const currentTaskGroup = task.configurationProperties.group;
2946
+ if (currentTaskGroup && typeof currentTaskGroup !== 'string' && typeof currentTaskGroup.isDefault === 'string') {
2947
+ return (currentTaskGroup._id === taskGroupId && match(currentTaskGroup.isDefault, relativePath$1));
2948
+ }
2949
+ globTasksDetected = false;
2950
+ return false;
2951
+ });
2952
+ return { globGroupTasks, globTasksDetected };
2953
+ }
2954
+ }
2955
+ }
2956
+ }
2957
+ return { globGroupTasks: [], globTasksDetected };
2958
+ }
2952
2959
  _runBuildCommand() {
2953
2960
  if (!this._tasksReconnected) {
2954
2961
  return;
@@ -3114,10 +3121,11 @@ let AbstractTaskService = class AbstractTaskService extends Disposable {
3114
3121
  });
3115
3122
  }
3116
3123
  else if (fileExists && (tasksExistInFile || content)) {
3117
- if (content) {
3118
- this._configurationService.updateValue('tasks', parse$1(content), target);
3124
+ const statResource = stat?.resource;
3125
+ if (content && statResource) {
3126
+ this._configurationService.updateValue('tasks', parse$1(content), { resource: statResource }, target);
3119
3127
  }
3120
- return stat?.resource;
3128
+ return statResource;
3121
3129
  }
3122
3130
  return undefined;
3123
3131
  }).then((resource) => {
@@ -3274,10 +3282,26 @@ let AbstractTaskService = class AbstractTaskService extends Disposable {
3274
3282
  const entries = [];
3275
3283
  let selectedTask;
3276
3284
  let selectedEntry;
3277
- this._showIgnoredFoldersMessage().then(() => {
3285
+ this._showIgnoredFoldersMessage().then(async () => {
3286
+ const { globGroupTasks } = await this._getGlobTasks(TaskGroup.Build._id);
3287
+ let defaultTasks = globGroupTasks;
3288
+ if (!defaultTasks?.length) {
3289
+ defaultTasks = this._getDefaultTasks(tasks, false);
3290
+ }
3291
+ let defaultBuildTask;
3292
+ if (defaultTasks.length === 1) {
3293
+ const group = defaultTasks[0].configurationProperties.group;
3294
+ if (group) {
3295
+ if (typeof group === 'string' && group === TaskGroup.Build._id) {
3296
+ defaultBuildTask = defaultTasks[0];
3297
+ }
3298
+ else {
3299
+ defaultBuildTask = defaultTasks[0];
3300
+ }
3301
+ }
3302
+ }
3278
3303
  for (const task of tasks) {
3279
- const taskGroup = TaskGroup.from(task.configurationProperties.group);
3280
- if (taskGroup && taskGroup.isDefault && taskGroup._id === TaskGroup.Build._id) {
3304
+ if (task === defaultBuildTask) {
3281
3305
  const label = ( localizeWithPath(
3282
3306
  _moduleId,
3283
3307
  89,
@@ -51,7 +51,7 @@ let TaskStatusBarContributions = class TaskStatusBarContributions extends Dispos
51
51
  _registerListeners() {
52
52
  let promise = undefined;
53
53
  let resolve;
54
- this._taskService.onDidStateChange(event => {
54
+ this._register(this._taskService.onDidStateChange(event => {
55
55
  if (event.kind === "changed" ) {
56
56
  this._updateRunningTasksStatus();
57
57
  }
@@ -93,7 +93,7 @@ let TaskStatusBarContributions = class TaskStatusBarContributions extends Dispos
93
93
  promise = undefined;
94
94
  });
95
95
  }
96
- });
96
+ }));
97
97
  }
98
98
  async _updateRunningTasksStatus() {
99
99
  const tasks = await this._taskService.getActiveTasks();
@@ -71,9 +71,11 @@ let TaskQuickPick = TaskQuickPick_1 = class TaskQuickPick extends Disposable {
71
71
  static applyColorStyles(task, entry, themeService) {
72
72
  if (task.configurationProperties.icon?.color) {
73
73
  const colorTheme = themeService.getColorTheme();
74
- createColorStyleElement(colorTheme);
74
+ const disposable = createColorStyleElement(colorTheme);
75
75
  entry.iconClasses = [getColorClass(task.configurationProperties.icon.color)];
76
+ return disposable;
76
77
  }
78
+ return;
77
79
  }
78
80
  _createTaskEntry(task, extraButtons = []) {
79
81
  const buttons = [
@@ -81,7 +83,10 @@ let TaskQuickPick = TaskQuickPick_1 = class TaskQuickPick extends Disposable {
81
83
  ...extraButtons
82
84
  ];
83
85
  const entry = { label: TaskQuickPick_1.getTaskLabelWithIcon(task, this._guessTaskLabel(task)), description: this._taskService.getTaskDescription(task), task, detail: this._showDetail() ? task.configurationProperties.detail : undefined, buttons };
84
- TaskQuickPick_1.applyColorStyles(task, entry, this._themeService);
86
+ const disposable = TaskQuickPick_1.applyColorStyles(task, entry, this._themeService);
87
+ if (disposable) {
88
+ this._register(disposable);
89
+ }
85
90
  return entry;
86
91
  }
87
92
  _createEntriesForGroup(entries, tasks, groupLabel, extraButtons = []) {
@@ -3,7 +3,7 @@ import { deepClone } from 'vscode/vscode/vs/base/common/objects';
3
3
  import { ProblemMatcherRegistry } from './problemMatcher.js';
4
4
  import schema$1 from './jsonSchemaCommon.js';
5
5
 
6
- const _moduleId = "vs/workbench/contrib/tasks/common/jsonSchema_v1";
6
+ const _moduleId = "vs/workbench/contrib/tasks/common/jsonSchem";
7
7
  const schema = {
8
8
  oneOf: [
9
9
  {
@@ -7,7 +7,7 @@ import { applyDeprecatedVariableMessage } from 'vscode/vscode/vs/workbench/servi
7
7
  import { inputsSchema } from 'vscode/vscode/vs/workbench/services/configurationResolver/common/configurationResolverSchema';
8
8
  import { getAllCodicons } from 'vscode/vscode/vs/base/common/codicons';
9
9
 
10
- const _moduleId = "vs/workbench/contrib/tasks/common/jsonSchema_v2";
10
+ const _moduleId = "vs/workbench/contrib/tasks/common/jsonSchem";
11
11
  function fixReferences(literal) {
12
12
  if (Array.isArray(literal)) {
13
13
  literal.forEach(fixReferences);