@codingame/monaco-vscode-api 1.83.15-next.0 → 1.83.16
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/README.md +430 -0
- package/contributions.js +3 -0
- package/localExtensionHost.js +3 -2
- package/missing-services.js +57 -1
- package/monaco-editor-treemending.patch +3375 -3375
- package/package.json +6 -6
- package/vscode/src/vs/base/common/prefixTree.js +130 -0
- package/vscode/src/vs/platform/actions/browser/floatingMenu.js +26 -2
- package/vscode/src/vs/platform/terminal/common/capabilities/bufferMarkCapability.js +41 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +566 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/cwdDetectionCapability.js +29 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.js +48 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/terminalCapabilityStore.js +94 -0
- package/vscode/src/vs/platform/terminal/common/terminalEnvironment.js +37 -0
- package/vscode/src/vs/platform/terminal/common/terminalStrings.js +16 -0
- package/vscode/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.js +319 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +91 -1
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +423 -0
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsNone.js +82 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.js +564 -11
- package/vscode/src/vs/workbench/contrib/scm/common/scm.js +9 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/detachedTerminal.js +67 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalExtensions.js +25 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcons.js +64 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/widgets/widgetManager.js +36 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +538 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +104 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +416 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/suggestAddon.js +390 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +799 -0
- package/vscode/src/vs/workbench/contrib/testing/common/getComputedState.js +101 -0
- package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +30 -0
- package/vscode/src/vs/workbench/contrib/testing/common/storedValue.js +36 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testExplorerFilterState.js +116 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testProfileService.js +172 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +384 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testResultService.js +156 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testResultStorage.js +156 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testService.js +75 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +9 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testingContextKeys.js +179 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testingContinuousRunService.js +102 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testingDecorations.js +29 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testingPeekOpener.js +3 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testingStates.js +47 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +594 -2
- package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +307 -1
- package/vscode/src/vs/workbench/services/suggest/browser/media/suggest.css.js +4 -0
- package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionItem.js +10 -0
- package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionModel.js +98 -0
- package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +428 -0
- package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.js +83 -0
- package/vscode/src/vs/workbench/services/textfile/common/textfiles.js +6 -2
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
|
|
2
|
+
import { statePriority, maxPriority, makeEmptyCounts } from './testingStates.js';
|
|
3
|
+
const isDurationAccessor = (accessor) => 'getOwnDuration' in accessor;
|
|
4
|
+
const getComputedState = (accessor, node, force = false) => {
|
|
5
|
+
let computed = accessor.getCurrentComputedState(node);
|
|
6
|
+
if (computed === undefined || force) {
|
|
7
|
+
computed = accessor.getOwnState(node) ?? 0 ;
|
|
8
|
+
let childrenCount = 0;
|
|
9
|
+
const stateMap = makeEmptyCounts();
|
|
10
|
+
for (const child of accessor.getChildren(node)) {
|
|
11
|
+
const childComputed = getComputedState(accessor, child);
|
|
12
|
+
childrenCount++;
|
|
13
|
+
stateMap[childComputed]++;
|
|
14
|
+
computed = childComputed === 5 && computed === 0
|
|
15
|
+
? 5 : maxPriority(computed, childComputed);
|
|
16
|
+
}
|
|
17
|
+
if (childrenCount > LARGE_NODE_THRESHOLD) {
|
|
18
|
+
largeNodeChildrenStates.set(node, stateMap);
|
|
19
|
+
}
|
|
20
|
+
accessor.setComputedState(node, computed);
|
|
21
|
+
}
|
|
22
|
+
return computed;
|
|
23
|
+
};
|
|
24
|
+
const getComputedDuration = (accessor, node, force = false) => {
|
|
25
|
+
let computed = accessor.getCurrentComputedDuration(node);
|
|
26
|
+
if (computed === undefined || force) {
|
|
27
|
+
const own = accessor.getOwnDuration(node);
|
|
28
|
+
if (own !== undefined) {
|
|
29
|
+
computed = own;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
computed = undefined;
|
|
33
|
+
for (const child of accessor.getChildren(node)) {
|
|
34
|
+
const d = getComputedDuration(accessor, child);
|
|
35
|
+
if (d !== undefined) {
|
|
36
|
+
computed = (computed || 0) + d;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
accessor.setComputedDuration(node, computed);
|
|
41
|
+
}
|
|
42
|
+
return computed;
|
|
43
|
+
};
|
|
44
|
+
const LARGE_NODE_THRESHOLD = 64;
|
|
45
|
+
const largeNodeChildrenStates = ( new WeakMap());
|
|
46
|
+
const refreshComputedState = (accessor, node, explicitNewComputedState, refreshDuration = true) => {
|
|
47
|
+
const oldState = accessor.getCurrentComputedState(node);
|
|
48
|
+
const oldPriority = statePriority[oldState];
|
|
49
|
+
const newState = explicitNewComputedState ?? getComputedState(accessor, node, true);
|
|
50
|
+
const newPriority = statePriority[newState];
|
|
51
|
+
const toUpdate = ( new Set());
|
|
52
|
+
if (newPriority !== oldPriority) {
|
|
53
|
+
accessor.setComputedState(node, newState);
|
|
54
|
+
toUpdate.add(node);
|
|
55
|
+
let moveFromState = oldState;
|
|
56
|
+
let moveToState = newState;
|
|
57
|
+
for (const parent of accessor.getParents(node)) {
|
|
58
|
+
const lnm = largeNodeChildrenStates.get(parent);
|
|
59
|
+
if (lnm) {
|
|
60
|
+
lnm[moveFromState]--;
|
|
61
|
+
lnm[moveToState]++;
|
|
62
|
+
}
|
|
63
|
+
const prev = accessor.getCurrentComputedState(parent);
|
|
64
|
+
if (newPriority > oldPriority) {
|
|
65
|
+
if (prev !== undefined && statePriority[prev] >= newPriority) {
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
if (lnm && lnm[moveToState] > 1) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
accessor.setComputedState(parent, newState);
|
|
72
|
+
toUpdate.add(parent);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
if (prev === undefined || statePriority[prev] > oldPriority) {
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
if (lnm && lnm[moveFromState] > 0) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
moveToState = getComputedState(accessor, parent, true);
|
|
82
|
+
accessor.setComputedState(parent, moveToState);
|
|
83
|
+
toUpdate.add(parent);
|
|
84
|
+
}
|
|
85
|
+
moveFromState = prev;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (isDurationAccessor(accessor) && refreshDuration) {
|
|
89
|
+
for (const parent of Iterable.concat(Iterable.single(node), accessor.getParents(node))) {
|
|
90
|
+
const oldDuration = accessor.getCurrentComputedDuration(parent);
|
|
91
|
+
const newDuration = getComputedDuration(accessor, parent, true);
|
|
92
|
+
if (oldDuration === newDuration) {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
accessor.setComputedDuration(parent, newDuration);
|
|
96
|
+
toUpdate.add(parent);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return toUpdate;
|
|
100
|
+
};
|
|
101
|
+
export { refreshComputedState };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Event, Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
2
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
const staticObservableValue = (value) => ({
|
|
4
|
+
onDidChange: Event.None,
|
|
5
|
+
value,
|
|
6
|
+
});
|
|
7
|
+
class MutableObservableValue extends Disposable {
|
|
8
|
+
get value() {
|
|
9
|
+
return this._value;
|
|
10
|
+
}
|
|
11
|
+
set value(v) {
|
|
12
|
+
if (v !== this._value) {
|
|
13
|
+
this._value = v;
|
|
14
|
+
this.changeEmitter.fire(v);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
static stored(stored, defaultValue) {
|
|
18
|
+
const o = ( new MutableObservableValue(stored.get(defaultValue)));
|
|
19
|
+
o._register(stored);
|
|
20
|
+
o._register(o.onDidChange(value => stored.store(value)));
|
|
21
|
+
return o;
|
|
22
|
+
}
|
|
23
|
+
constructor(_value) {
|
|
24
|
+
super();
|
|
25
|
+
this._value = _value;
|
|
26
|
+
this.changeEmitter = this._register(( new Emitter()));
|
|
27
|
+
this.onDidChange = this.changeEmitter.event;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export { MutableObservableValue, staticObservableValue };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
4
|
+
const defaultSerialization = {
|
|
5
|
+
deserialize: d => JSON.parse(d),
|
|
6
|
+
serialize: d => JSON.stringify(d),
|
|
7
|
+
};
|
|
8
|
+
let StoredValue = class StoredValue extends Disposable {
|
|
9
|
+
constructor(options, storage) {
|
|
10
|
+
super();
|
|
11
|
+
this.storage = storage;
|
|
12
|
+
this.key = options.key;
|
|
13
|
+
this.scope = options.scope;
|
|
14
|
+
this.target = options.target;
|
|
15
|
+
this.serialization = options.serialization ?? defaultSerialization;
|
|
16
|
+
this.onDidChange = this.storage.onDidChangeValue(this.scope, this.key, this._register(( new DisposableStore())));
|
|
17
|
+
}
|
|
18
|
+
get(defaultValue) {
|
|
19
|
+
if (this.value === undefined) {
|
|
20
|
+
const value = this.storage.get(this.key, this.scope);
|
|
21
|
+
this.value = value === undefined ? defaultValue : this.serialization.deserialize(value);
|
|
22
|
+
}
|
|
23
|
+
return this.value;
|
|
24
|
+
}
|
|
25
|
+
store(value) {
|
|
26
|
+
this.value = value;
|
|
27
|
+
this.storage.store(this.key, this.serialization.serialize(value), this.scope, this.target);
|
|
28
|
+
}
|
|
29
|
+
delete() {
|
|
30
|
+
this.storage.remove(this.key, this.scope);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
StoredValue = ( __decorate([
|
|
34
|
+
( __param(1, IStorageService))
|
|
35
|
+
], StoredValue));
|
|
36
|
+
export { StoredValue };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
+
import { splitGlobAware } from 'monaco-editor/esm/vs/base/common/glob.js';
|
|
4
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
6
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
7
|
+
import { MutableObservableValue } from './observableValue.js';
|
|
8
|
+
import { StoredValue } from './storedValue.js';
|
|
9
|
+
import { namespaceTestTag } from './testTypes.js';
|
|
10
|
+
const ITestExplorerFilterState = ( createDecorator('testingFilterState'));
|
|
11
|
+
const tagRe = /!?@([^ ,:]+)/g;
|
|
12
|
+
const trimExtraWhitespace = (str) => str.replace(/\s\s+/g, ' ').trim();
|
|
13
|
+
let TestExplorerFilterState = class TestExplorerFilterState extends Disposable {
|
|
14
|
+
constructor(storageService) {
|
|
15
|
+
super();
|
|
16
|
+
this.storageService = storageService;
|
|
17
|
+
this.focusEmitter = ( new Emitter());
|
|
18
|
+
this.termFilterState = {};
|
|
19
|
+
this.globList = [];
|
|
20
|
+
this.includeTags = ( new Set());
|
|
21
|
+
this.excludeTags = ( new Set());
|
|
22
|
+
this.text = this._register(( new MutableObservableValue('')));
|
|
23
|
+
this.fuzzy = this._register(MutableObservableValue.stored(( new StoredValue({
|
|
24
|
+
key: 'testHistoryFuzzy',
|
|
25
|
+
scope: 0 ,
|
|
26
|
+
target: 0 ,
|
|
27
|
+
}, this.storageService)), false));
|
|
28
|
+
this.reveal = this._register(( new MutableObservableValue(undefined)));
|
|
29
|
+
this.onDidRequestInputFocus = this.focusEmitter.event;
|
|
30
|
+
}
|
|
31
|
+
focusInput() {
|
|
32
|
+
this.focusEmitter.fire();
|
|
33
|
+
}
|
|
34
|
+
setText(text) {
|
|
35
|
+
if (text === this.text.value) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.termFilterState = {};
|
|
39
|
+
this.globList = [];
|
|
40
|
+
this.includeTags.clear();
|
|
41
|
+
this.excludeTags.clear();
|
|
42
|
+
let globText = '';
|
|
43
|
+
let lastIndex = 0;
|
|
44
|
+
for (const match of text.matchAll(tagRe)) {
|
|
45
|
+
let nextIndex = match.index + match[0].length;
|
|
46
|
+
const tag = match[0];
|
|
47
|
+
if (allTestFilterTerms.includes(tag)) {
|
|
48
|
+
this.termFilterState[tag] = true;
|
|
49
|
+
}
|
|
50
|
+
if (text[nextIndex] === ':') {
|
|
51
|
+
nextIndex++;
|
|
52
|
+
let delimiter = text[nextIndex];
|
|
53
|
+
if (delimiter !== `"` && delimiter !== `'`) {
|
|
54
|
+
delimiter = ' ';
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
nextIndex++;
|
|
58
|
+
}
|
|
59
|
+
let tagId = '';
|
|
60
|
+
while (nextIndex < text.length && text[nextIndex] !== delimiter) {
|
|
61
|
+
if (text[nextIndex] === '\\') {
|
|
62
|
+
tagId += text[nextIndex + 1];
|
|
63
|
+
nextIndex += 2;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
tagId += text[nextIndex];
|
|
67
|
+
nextIndex++;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (match[0].startsWith('!')) {
|
|
71
|
+
this.excludeTags.add(namespaceTestTag(match[1], tagId));
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.includeTags.add(namespaceTestTag(match[1], tagId));
|
|
75
|
+
}
|
|
76
|
+
nextIndex++;
|
|
77
|
+
}
|
|
78
|
+
globText += text.slice(lastIndex, match.index);
|
|
79
|
+
lastIndex = nextIndex;
|
|
80
|
+
}
|
|
81
|
+
globText += text.slice(lastIndex).trim();
|
|
82
|
+
if (globText.length) {
|
|
83
|
+
for (const filter of ( splitGlobAware(globText, ',').map(s => s.trim())).filter(s => !!s.length)) {
|
|
84
|
+
if (filter.startsWith('!')) {
|
|
85
|
+
this.globList.push({ include: false, text: filter.slice(1).toLowerCase() });
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.globList.push({ include: true, text: filter.toLowerCase() });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
this.text.value = text;
|
|
93
|
+
}
|
|
94
|
+
isFilteringFor(term) {
|
|
95
|
+
return !!this.termFilterState[term];
|
|
96
|
+
}
|
|
97
|
+
toggleFilteringFor(term, shouldFilter) {
|
|
98
|
+
const text = this.text.value.trim();
|
|
99
|
+
if (shouldFilter !== false && !this.termFilterState[term]) {
|
|
100
|
+
this.setText(text ? `${text} ${term}` : term);
|
|
101
|
+
}
|
|
102
|
+
else if (shouldFilter !== true && this.termFilterState[term]) {
|
|
103
|
+
this.setText(trimExtraWhitespace(text.replace(term, '')));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
TestExplorerFilterState = ( __decorate([
|
|
108
|
+
( __param(0, IStorageService))
|
|
109
|
+
], TestExplorerFilterState));
|
|
110
|
+
const allTestFilterTerms = [
|
|
111
|
+
"@failed" ,
|
|
112
|
+
"@executed" ,
|
|
113
|
+
"@doc" ,
|
|
114
|
+
"@hidden" ,
|
|
115
|
+
];
|
|
116
|
+
export { ITestExplorerFilterState, TestExplorerFilterState };
|
|
@@ -1,3 +1,174 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
+
import { isDefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
4
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
1
5
|
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
6
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
7
|
+
import { StoredValue } from './storedValue.js';
|
|
8
|
+
import { testRunProfileBitsetList } from './testTypes.js';
|
|
9
|
+
import { TestId } from './testId.js';
|
|
10
|
+
import { TestingContextKeys } from './testingContextKeys.js';
|
|
11
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
2
12
|
const ITestProfileService = ( createDecorator('testProfileService'));
|
|
3
|
-
|
|
13
|
+
const canUseProfileWithTest = (profile, test) => profile.controllerId === test.controllerId && (TestId.isRoot(test.item.extId) || !profile.tag || test.item.tags.includes(profile.tag));
|
|
14
|
+
const sorter = (a, b) => {
|
|
15
|
+
if (a.isDefault !== b.isDefault) {
|
|
16
|
+
return a.isDefault ? -1 : 1;
|
|
17
|
+
}
|
|
18
|
+
return a.label.localeCompare(b.label);
|
|
19
|
+
};
|
|
20
|
+
const capabilityContextKeys = (capabilities) => [
|
|
21
|
+
[TestingContextKeys.hasRunnableTests.key, ((capabilities & 2) ) !== 0],
|
|
22
|
+
[TestingContextKeys.hasDebuggableTests.key, ((capabilities & 4) ) !== 0],
|
|
23
|
+
[TestingContextKeys.hasCoverableTests.key, ((capabilities & 8) ) !== 0],
|
|
24
|
+
];
|
|
25
|
+
let TestProfileService = class TestProfileService extends Disposable {
|
|
26
|
+
constructor(contextKeyService, storageService) {
|
|
27
|
+
super();
|
|
28
|
+
this.changeEmitter = this._register(( new Emitter()));
|
|
29
|
+
this.controllerProfiles = ( new Map());
|
|
30
|
+
this.onDidChange = this.changeEmitter.event;
|
|
31
|
+
this.preferredDefaults = this._register(( new StoredValue({
|
|
32
|
+
key: 'testingPreferredProfiles',
|
|
33
|
+
scope: 1 ,
|
|
34
|
+
target: 1 ,
|
|
35
|
+
}, storageService)));
|
|
36
|
+
this.capabilitiesContexts = {
|
|
37
|
+
[2 ]: TestingContextKeys.hasRunnableTests.bindTo(contextKeyService),
|
|
38
|
+
[4 ]: TestingContextKeys.hasDebuggableTests.bindTo(contextKeyService),
|
|
39
|
+
[8 ]: TestingContextKeys.hasCoverableTests.bindTo(contextKeyService),
|
|
40
|
+
[16 ]: TestingContextKeys.hasNonDefaultProfile.bindTo(contextKeyService),
|
|
41
|
+
[32 ]: TestingContextKeys.hasConfigurableProfile.bindTo(contextKeyService),
|
|
42
|
+
[64 ]: TestingContextKeys.supportsContinuousRun.bindTo(contextKeyService),
|
|
43
|
+
};
|
|
44
|
+
this.refreshContextKeys();
|
|
45
|
+
}
|
|
46
|
+
addProfile(controller, profile) {
|
|
47
|
+
let record = this.controllerProfiles.get(profile.controllerId);
|
|
48
|
+
if (record) {
|
|
49
|
+
record.profiles.push(profile);
|
|
50
|
+
record.profiles.sort(sorter);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
record = {
|
|
54
|
+
profiles: [profile],
|
|
55
|
+
controller,
|
|
56
|
+
};
|
|
57
|
+
this.controllerProfiles.set(profile.controllerId, record);
|
|
58
|
+
}
|
|
59
|
+
this.refreshContextKeys();
|
|
60
|
+
this.changeEmitter.fire();
|
|
61
|
+
}
|
|
62
|
+
updateProfile(controllerId, profileId, update) {
|
|
63
|
+
const ctrl = this.controllerProfiles.get(controllerId);
|
|
64
|
+
if (!ctrl) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const profile = ctrl.profiles.find(c => c.controllerId === controllerId && c.profileId === profileId);
|
|
68
|
+
if (!profile) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
Object.assign(profile, update);
|
|
72
|
+
ctrl.profiles.sort(sorter);
|
|
73
|
+
this.changeEmitter.fire();
|
|
74
|
+
}
|
|
75
|
+
configure(controllerId, profileId) {
|
|
76
|
+
this.controllerProfiles.get(controllerId)?.controller.configureRunProfile(profileId);
|
|
77
|
+
}
|
|
78
|
+
removeProfile(controllerId, profileId) {
|
|
79
|
+
const ctrl = this.controllerProfiles.get(controllerId);
|
|
80
|
+
if (!ctrl) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!profileId) {
|
|
84
|
+
this.controllerProfiles.delete(controllerId);
|
|
85
|
+
this.changeEmitter.fire();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const index = ctrl.profiles.findIndex(c => c.profileId === profileId);
|
|
89
|
+
if (index === -1) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
ctrl.profiles.splice(index, 1);
|
|
93
|
+
this.refreshContextKeys();
|
|
94
|
+
this.changeEmitter.fire();
|
|
95
|
+
}
|
|
96
|
+
capabilitiesForTest(test) {
|
|
97
|
+
const ctrl = this.controllerProfiles.get(test.controllerId);
|
|
98
|
+
if (!ctrl) {
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
let capabilities = 0;
|
|
102
|
+
for (const profile of ctrl.profiles) {
|
|
103
|
+
if (!profile.tag || test.item.tags.includes(profile.tag)) {
|
|
104
|
+
capabilities |= capabilities & profile.group ? 16 : profile.group;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return capabilities;
|
|
108
|
+
}
|
|
109
|
+
all() {
|
|
110
|
+
return ( this.controllerProfiles.values());
|
|
111
|
+
}
|
|
112
|
+
getControllerProfiles(profileId) {
|
|
113
|
+
return this.controllerProfiles.get(profileId)?.profiles ?? [];
|
|
114
|
+
}
|
|
115
|
+
getGroupDefaultProfiles(group) {
|
|
116
|
+
const preferred = this.preferredDefaults.get();
|
|
117
|
+
if (!preferred) {
|
|
118
|
+
return this.getBaseDefaults(group);
|
|
119
|
+
}
|
|
120
|
+
const profiles = preferred[group]
|
|
121
|
+
?.map(p => this.controllerProfiles.get(p.controllerId)?.profiles.find(c => c.profileId === p.profileId && c.group === group))
|
|
122
|
+
.filter(isDefined);
|
|
123
|
+
return profiles?.length ? profiles : this.getBaseDefaults(group);
|
|
124
|
+
}
|
|
125
|
+
setGroupDefaultProfiles(group, profiles) {
|
|
126
|
+
const next = {
|
|
127
|
+
...this.preferredDefaults.get(),
|
|
128
|
+
[group]: ( profiles.map(c => ({ profileId: c.profileId, controllerId: c.controllerId }))),
|
|
129
|
+
};
|
|
130
|
+
if (group === 2 || group === 4 ) {
|
|
131
|
+
const otherGroup = group === 2 ? 4 : 2 ;
|
|
132
|
+
const previousDefaults = next[otherGroup] || [];
|
|
133
|
+
let newDefaults = previousDefaults.slice();
|
|
134
|
+
for (const [ctrlId, { profiles: ctrlProfiles }] of this.controllerProfiles) {
|
|
135
|
+
const labels = ( new Set(( profiles.filter(p => p.controllerId === ctrlId).map(p => p.label))));
|
|
136
|
+
const nextByLabels = ctrlProfiles.filter(p => ( labels.has(p.label)) && p.group === otherGroup);
|
|
137
|
+
if (nextByLabels.length) {
|
|
138
|
+
newDefaults = newDefaults.filter(p => p.controllerId !== ctrlId);
|
|
139
|
+
newDefaults.push(...( nextByLabels.map(p => ({ profileId: p.profileId, controllerId: p.controllerId }))));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
next[otherGroup] = newDefaults;
|
|
143
|
+
}
|
|
144
|
+
this.preferredDefaults.store(next);
|
|
145
|
+
this.changeEmitter.fire();
|
|
146
|
+
}
|
|
147
|
+
getBaseDefaults(group) {
|
|
148
|
+
const defaults = [];
|
|
149
|
+
for (const { profiles } of ( this.controllerProfiles.values())) {
|
|
150
|
+
const profile = profiles.find(c => c.group === group);
|
|
151
|
+
if (profile) {
|
|
152
|
+
defaults.push(profile);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return defaults;
|
|
156
|
+
}
|
|
157
|
+
refreshContextKeys() {
|
|
158
|
+
let allCapabilities = 0;
|
|
159
|
+
for (const { profiles } of ( this.controllerProfiles.values())) {
|
|
160
|
+
for (const profile of profiles) {
|
|
161
|
+
allCapabilities |= allCapabilities & profile.group ? 16 : profile.group;
|
|
162
|
+
allCapabilities |= profile.supportsContinuousRun ? 64 : 0;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
for (const group of testRunProfileBitsetList) {
|
|
166
|
+
this.capabilitiesContexts[group].set((allCapabilities & group) !== 0);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
TestProfileService = ( __decorate([
|
|
171
|
+
( __param(0, IContextKeyService)),
|
|
172
|
+
( __param(1, IStorageService))
|
|
173
|
+
], TestProfileService));
|
|
174
|
+
export { ITestProfileService, TestProfileService, canUseProfileWithTest, capabilityContextKeys };
|