@codingame/monaco-vscode-scm-service-override 9.0.2 → 10.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.
@@ -1,133 +0,0 @@
1
- import { basename } from 'vscode/vscode/vs/base/common/path';
2
- import { MenuItemAction } from 'vscode/vscode/vs/platform/actions/common/actions';
3
- import { Action } from 'vscode/vscode/vs/base/common/actions';
4
- import { createAndFillInActionBarActions, createAndFillInContextMenuActions, createActionViewItem } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
5
- import { equals } from 'vscode/vscode/vs/base/common/arrays';
6
- import { ActionViewItem } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionViewItems';
7
- import { renderLabelWithIcons } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabels';
8
- import { reset } from 'vscode/vscode/vs/base/browser/dom';
9
- import { ResourceTree } from 'vscode/vscode/vs/base/common/resourceTree';
10
-
11
- function isSCMViewService(element) {
12
- return Array.isArray(element.repositories) && Array.isArray(element.visibleRepositories);
13
- }
14
- function isSCMRepository(element) {
15
- return !!element.provider && !!element.input;
16
- }
17
- function isSCMInput(element) {
18
- return !!element.validateInput && typeof element.value === 'string';
19
- }
20
- function isSCMActionButton(element) {
21
- return element.type === 'actionButton';
22
- }
23
- function isSCMResourceGroup(element) {
24
- return !!element.provider && !!element.resources;
25
- }
26
- function isSCMResource(element) {
27
- return !!element.sourceUri && isSCMResourceGroup(element.resourceGroup);
28
- }
29
- function isSCMResourceNode(element) {
30
- return ResourceTree.isResourceNode(element) && isSCMResourceGroup(element.context);
31
- }
32
- function isSCMHistoryItemGroupTreeElement(element) {
33
- return element.type === 'historyItemGroup';
34
- }
35
- function isSCMHistoryItemTreeElement(element) {
36
- return element.type === 'allChanges' ||
37
- element.type === 'historyItem';
38
- }
39
- function isSCMHistoryItemViewModelTreeElement(element) {
40
- return element.type === 'historyItem2';
41
- }
42
- function isSCMHistoryItemLoadMoreTreeElement(element) {
43
- return element.type === 'historyItemLoadMore';
44
- }
45
- function isSCMHistoryItemChangeTreeElement(element) {
46
- return element.type === 'historyItemChange';
47
- }
48
- function isSCMHistoryItemChangeNode(element) {
49
- return ResourceTree.isResourceNode(element) && isSCMHistoryItemTreeElement(element.context);
50
- }
51
- function isSCMViewSeparator(element) {
52
- return element.type === 'separator';
53
- }
54
- function toDiffEditorArguments(uri, originalUri, modifiedUri) {
55
- const basename$1 = basename(uri.fsPath);
56
- const originalQuery = JSON.parse(originalUri.query);
57
- const modifiedQuery = JSON.parse(modifiedUri.query);
58
- const originalShortRef = originalQuery.ref.substring(0, 8).concat(originalQuery.ref.endsWith('^') ? '^' : '');
59
- const modifiedShortRef = modifiedQuery.ref.substring(0, 8).concat(modifiedQuery.ref.endsWith('^') ? '^' : '');
60
- return [originalUri, modifiedUri, `${basename$1} (${originalShortRef}) ↔ ${basename$1} (${modifiedShortRef})`, null];
61
- }
62
- const compareActions = (a, b) => {
63
- if (a instanceof MenuItemAction && b instanceof MenuItemAction) {
64
- return a.id === b.id && a.enabled === b.enabled && a.hideActions?.isHidden === b.hideActions?.isHidden;
65
- }
66
- return a.id === b.id && a.enabled === b.enabled;
67
- };
68
- function connectPrimaryMenu(menu, callback, primaryGroup) {
69
- let cachedPrimary = [];
70
- let cachedSecondary = [];
71
- const updateActions = () => {
72
- const primary = [];
73
- const secondary = [];
74
- createAndFillInActionBarActions(menu, { shouldForwardArgs: true }, { primary, secondary }, primaryGroup);
75
- if (equals(cachedPrimary, primary, compareActions) && equals(cachedSecondary, secondary, compareActions)) {
76
- return;
77
- }
78
- cachedPrimary = primary;
79
- cachedSecondary = secondary;
80
- callback(primary, secondary);
81
- };
82
- updateActions();
83
- return menu.onDidChange(updateActions);
84
- }
85
- function connectPrimaryMenuToInlineActionBar(menu, actionBar) {
86
- return connectPrimaryMenu(menu, (primary) => {
87
- actionBar.clear();
88
- actionBar.push(primary, { icon: true, label: false });
89
- }, 'inline');
90
- }
91
- function collectContextMenuActions(menu) {
92
- const primary = [];
93
- const actions = [];
94
- createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, { primary, secondary: actions }, 'inline');
95
- return actions;
96
- }
97
- class StatusBarAction extends Action {
98
- constructor(command, commandService) {
99
- super(`statusbaraction{${command.id}}`, command.title, '', true);
100
- this.command = command;
101
- this.commandService = commandService;
102
- this.tooltip = command.tooltip || '';
103
- }
104
- run() {
105
- return this.commandService.executeCommand(this.command.id, ...(this.command.arguments || []));
106
- }
107
- }
108
- class StatusBarActionViewItem extends ActionViewItem {
109
- constructor(action, options) {
110
- super(null, action, { ...options, icon: false, label: true });
111
- }
112
- updateLabel() {
113
- if (this.options.label && this.label) {
114
- reset(this.label, ...renderLabelWithIcons(this.action.label));
115
- }
116
- }
117
- }
118
- function getActionViewItemProvider(instaService) {
119
- return (action, options) => {
120
- if (action instanceof StatusBarAction) {
121
- return ( new StatusBarActionViewItem(action, options));
122
- }
123
- return createActionViewItem(instaService, action, options);
124
- };
125
- }
126
- function getProviderKey(provider) {
127
- return `${provider.contextValue}:${provider.label}${provider.rootUri ? `:${( provider.rootUri.toString())}` : ''}`;
128
- }
129
- function getRepositoryResourceCount(provider) {
130
- return provider.groups.reduce((r, g) => r + g.resources.length, 0);
131
- }
132
-
133
- export { StatusBarAction, collectContextMenuActions, connectPrimaryMenu, connectPrimaryMenuToInlineActionBar, getActionViewItemProvider, getProviderKey, getRepositoryResourceCount, isSCMActionButton, isSCMHistoryItemChangeNode, isSCMHistoryItemChangeTreeElement, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemLoadMoreTreeElement, isSCMHistoryItemTreeElement, isSCMHistoryItemViewModelTreeElement, isSCMInput, isSCMRepository, isSCMResource, isSCMResourceGroup, isSCMResourceNode, isSCMViewSeparator, isSCMViewService, toDiffEditorArguments };