@codingame/monaco-vscode-scm-service-override 6.0.3 → 7.0.1
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 +2 -2
- package/vscode/src/vs/workbench/contrib/scm/browser/activity.js +119 -174
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +34 -10
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistory.js +180 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.js +25 -22
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +240 -65
- package/vscode/src/vs/workbench/contrib/scm/browser/util.js +7 -1
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.js +34 -9
|
@@ -20,8 +20,9 @@ import { MenuItemAction, MenuId, MenuRegistry, Action2, registerAction2 } from '
|
|
|
20
20
|
import { IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions.service';
|
|
21
21
|
import { ActionRunner, Action, Separator } from 'vscode/vscode/vs/base/common/actions';
|
|
22
22
|
import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
23
|
+
import { registerThemingParticipant } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
23
24
|
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
24
|
-
import { isSCMResource, connectPrimaryMenuToInlineActionBar, connectPrimaryMenu, isSCMInput, isSCMActionButton, isSCMRepository, isSCMResourceGroup, isSCMResourceNode, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMHistoryItemChangeTreeElement, isSCMHistoryItemChangeNode, isSCMViewSeparator, getActionViewItemProvider, toDiffEditorArguments, collectContextMenuActions, isSCMViewService } from './util.js';
|
|
25
|
+
import { isSCMResource, connectPrimaryMenuToInlineActionBar, connectPrimaryMenu, isSCMInput, isSCMActionButton, isSCMRepository, isSCMResourceGroup, isSCMResourceNode, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMHistoryItemViewModelTreeElement, isSCMHistoryItemChangeTreeElement, isSCMHistoryItemChangeNode, isSCMViewSeparator, getActionViewItemProvider, toDiffEditorArguments, collectContextMenuActions, isSCMViewService } from './util.js';
|
|
25
26
|
import { WorkbenchCompressibleAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
26
27
|
import { ConfigurationTarget } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
27
28
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
@@ -87,10 +88,10 @@ import { EditOperation } from 'vscode/vscode/vs/editor/common/core/editOperation
|
|
|
87
88
|
import { stripIcons } from 'vscode/vscode/vs/base/common/iconLabels';
|
|
88
89
|
import { IconLabel } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabel';
|
|
89
90
|
import { registerColor, transparent } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
90
|
-
import { foreground } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
91
|
+
import { foreground, selectionBackground } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
91
92
|
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
92
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
93
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
93
|
+
import { editorSelectionBackground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
94
|
+
import { inputBackground, inputForeground } from 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
94
95
|
import { listActiveSelectionForeground } from 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
95
96
|
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
96
97
|
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
@@ -102,38 +103,23 @@ import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellati
|
|
|
102
103
|
import { DropdownWithPrimaryActionViewItem } from 'vscode/vscode/vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
|
|
103
104
|
import { clamp, rot } from 'vscode/vscode/vs/base/common/numbers';
|
|
104
105
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
105
|
-
import { getDefaultHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
106
106
|
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
107
107
|
import { IHoverService } from 'vscode/vscode/vs/platform/hover/browser/hover.service';
|
|
108
108
|
import { OpenScmGroupAction } from 'vscode/vscode/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver';
|
|
109
109
|
import { HoverController } from 'vscode/vscode/vs/editor/contrib/hover/browser/hoverController';
|
|
110
|
+
import 'vscode/vscode/vs/base/common/arrays';
|
|
111
|
+
import 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
112
|
+
import { autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
113
|
+
import 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
114
|
+
import { getDefaultHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
115
|
+
import { renderSCMHistoryItemGraph, toISCMHistoryItemViewModelArray } from './scmHistory.js';
|
|
110
116
|
|
|
111
|
-
var ActionButtonRenderer_1, InputRenderer_1, ResourceGroupRenderer_1, ResourceRenderer_1, HistoryItemGroupRenderer_1, HistoryItemRenderer_1, HistoryItemChangeRenderer_1, SeparatorRenderer_1, SCMInputWidget_1;
|
|
117
|
+
var ActionButtonRenderer_1, InputRenderer_1, ResourceGroupRenderer_1, ResourceRenderer_1, HistoryItemGroupRenderer_1, HistoryItemRenderer_1, HistoryItem2Renderer_1, HistoryItemChangeRenderer_1, SeparatorRenderer_1, SCMInputWidget_1;
|
|
112
118
|
const _moduleId = "vs/workbench/contrib/scm/browser/scmViewPane";
|
|
113
|
-
registerColor('scm.historyItemAdditionsForeground',
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
hcLight: 'gitDecoration.addedResourceForeground'
|
|
118
|
-
}, ( localizeWithPath(_moduleId, 0, "History item additions foreground color.")));
|
|
119
|
-
registerColor('scm.historyItemDeletionsForeground', {
|
|
120
|
-
dark: 'gitDecoration.deletedResourceForeground',
|
|
121
|
-
light: 'gitDecoration.deletedResourceForeground',
|
|
122
|
-
hcDark: 'gitDecoration.deletedResourceForeground',
|
|
123
|
-
hcLight: 'gitDecoration.deletedResourceForeground'
|
|
124
|
-
}, ( localizeWithPath(_moduleId, 1, "History item deletions foreground color.")));
|
|
125
|
-
registerColor('scm.historyItemStatisticsBorder', {
|
|
126
|
-
dark: ( (transparent(foreground, 0.2))),
|
|
127
|
-
light: ( (transparent(foreground, 0.2))),
|
|
128
|
-
hcDark: ( (transparent(foreground, 0.2))),
|
|
129
|
-
hcLight: ( (transparent(foreground, 0.2)))
|
|
130
|
-
}, ( localizeWithPath(_moduleId, 2, "History item statistics border color.")));
|
|
131
|
-
registerColor('scm.historyItemSelectedStatisticsBorder', {
|
|
132
|
-
dark: ( (transparent(listActiveSelectionForeground, 0.2))),
|
|
133
|
-
light: ( (transparent(listActiveSelectionForeground, 0.2))),
|
|
134
|
-
hcDark: ( (transparent(listActiveSelectionForeground, 0.2))),
|
|
135
|
-
hcLight: ( (transparent(listActiveSelectionForeground, 0.2)))
|
|
136
|
-
}, ( localizeWithPath(_moduleId, 3, "History item selected statistics border color.")));
|
|
119
|
+
registerColor('scm.historyItemAdditionsForeground', 'gitDecoration.addedResourceForeground', ( localizeWithPath(_moduleId, 0, "History item additions foreground color.")));
|
|
120
|
+
registerColor('scm.historyItemDeletionsForeground', 'gitDecoration.deletedResourceForeground', ( localizeWithPath(_moduleId, 1, "History item deletions foreground color.")));
|
|
121
|
+
registerColor('scm.historyItemStatisticsBorder', ( (transparent(foreground, 0.2))), ( localizeWithPath(_moduleId, 2, "History item statistics border color.")));
|
|
122
|
+
registerColor('scm.historyItemSelectedStatisticsBorder', ( (transparent(listActiveSelectionForeground, 0.2))), ( localizeWithPath(_moduleId, 3, "History item selected statistics border color.")));
|
|
137
123
|
function processResourceFilterData(uri, filterData) {
|
|
138
124
|
if (!filterData) {
|
|
139
125
|
return [undefined, undefined];
|
|
@@ -707,7 +693,7 @@ let HistoryItemRenderer = class HistoryItemRenderer {
|
|
|
707
693
|
const filesLabel = append(statsContainer, $('.files-label'));
|
|
708
694
|
const insertionsLabel = append(statsContainer, $('.insertions-label'));
|
|
709
695
|
const deletionsLabel = append(statsContainer, $('.deletions-label'));
|
|
710
|
-
const statsCustomHover = this.hoverService.
|
|
696
|
+
const statsCustomHover = this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), statsContainer, '');
|
|
711
697
|
disposables.add(statsCustomHover);
|
|
712
698
|
return { iconContainer, label: iconLabel, actionBar, statsContainer, statsCustomHover, filesLabel, insertionsLabel, deletionsLabel, elementDisposables: ( (new DisposableStore())), disposables };
|
|
713
699
|
}
|
|
@@ -793,6 +779,79 @@ HistoryItemRenderer = HistoryItemRenderer_1 = ( (__decorate([
|
|
|
793
779
|
( (__param(2, IHoverService))),
|
|
794
780
|
( (__param(3, ISCMViewService)))
|
|
795
781
|
], HistoryItemRenderer)));
|
|
782
|
+
let HistoryItem2Renderer = class HistoryItem2Renderer {
|
|
783
|
+
static { HistoryItem2Renderer_1 = this; }
|
|
784
|
+
static { this.TEMPLATE_ID = 'history-item-2'; }
|
|
785
|
+
get templateId() { return HistoryItem2Renderer_1.TEMPLATE_ID; }
|
|
786
|
+
constructor(hoverService) {
|
|
787
|
+
this.hoverService = hoverService;
|
|
788
|
+
}
|
|
789
|
+
renderTemplate(container) {
|
|
790
|
+
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-no-twistie');
|
|
791
|
+
const element = append(container, $('.history-item'));
|
|
792
|
+
const graphContainer = append(element, $('.graph-container'));
|
|
793
|
+
const iconLabel = ( (new IconLabel(
|
|
794
|
+
element,
|
|
795
|
+
{ supportIcons: true, supportHighlights: true, supportDescriptionHighlights: true }
|
|
796
|
+
)));
|
|
797
|
+
const labelContainer = append(element, $('.label-container'));
|
|
798
|
+
element.appendChild(labelContainer);
|
|
799
|
+
return { graphContainer, label: iconLabel, labelContainer, elementDisposables: ( (new DisposableStore())), disposables: ( (new DisposableStore())) };
|
|
800
|
+
}
|
|
801
|
+
renderElement(node, index, templateData, height) {
|
|
802
|
+
const historyItemViewModel = node.element.historyItemViewModel;
|
|
803
|
+
const historyItem = historyItemViewModel.historyItem;
|
|
804
|
+
templateData.graphContainer.textContent = '';
|
|
805
|
+
templateData.graphContainer.appendChild(renderSCMHistoryItemGraph(historyItemViewModel));
|
|
806
|
+
const title = this.getTooltip(historyItemViewModel);
|
|
807
|
+
const [matches, descriptionMatches] = this.processMatches(historyItemViewModel, node.filterData);
|
|
808
|
+
templateData.label.setLabel(historyItem.message, undefined, { title, matches, descriptionMatches });
|
|
809
|
+
templateData.labelContainer.textContent = '';
|
|
810
|
+
if (historyItem.labels) {
|
|
811
|
+
for (const label of historyItem.labels) {
|
|
812
|
+
if (label.icon && ThemeIcon.isThemeIcon(label.icon)) {
|
|
813
|
+
const icon = append(templateData.labelContainer, $('div.label'));
|
|
814
|
+
icon.classList.add(...ThemeIcon.asClassNameArray(label.icon));
|
|
815
|
+
templateData.elementDisposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), icon, label.title));
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
renderCompressedElements(node, index, templateData, height) {
|
|
821
|
+
throw ( (new Error('Should never happen since node is incompressible')));
|
|
822
|
+
}
|
|
823
|
+
getTooltip(historyItemViewModel) {
|
|
824
|
+
const historyItem = historyItemViewModel.historyItem;
|
|
825
|
+
const markdown = ( (new MarkdownString('', { isTrusted: true, supportThemeIcons: true })));
|
|
826
|
+
if (historyItem.author) {
|
|
827
|
+
markdown.appendMarkdown(`$(account) **${historyItem.author}**\n\n`);
|
|
828
|
+
}
|
|
829
|
+
if (historyItem.timestamp) {
|
|
830
|
+
const dateFormatter = new Intl.DateTimeFormat(language, { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' });
|
|
831
|
+
markdown.appendMarkdown(`$(history) ${dateFormatter.format(historyItem.timestamp)}\n\n`);
|
|
832
|
+
}
|
|
833
|
+
markdown.appendMarkdown(historyItem.message);
|
|
834
|
+
return { markdown, markdownNotSupportedFallback: historyItem.message };
|
|
835
|
+
}
|
|
836
|
+
processMatches(historyItemViewModel, filterData) {
|
|
837
|
+
if (!filterData) {
|
|
838
|
+
return [undefined, undefined];
|
|
839
|
+
}
|
|
840
|
+
return [
|
|
841
|
+
historyItemViewModel.historyItem.message === filterData.label ? createMatches(filterData.score) : undefined,
|
|
842
|
+
historyItemViewModel.historyItem.author === filterData.label ? createMatches(filterData.score) : undefined
|
|
843
|
+
];
|
|
844
|
+
}
|
|
845
|
+
disposeElement(element, index, templateData, height) {
|
|
846
|
+
templateData.elementDisposables.clear();
|
|
847
|
+
}
|
|
848
|
+
disposeTemplate(templateData) {
|
|
849
|
+
templateData.disposables.dispose();
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
HistoryItem2Renderer = HistoryItem2Renderer_1 = ( (__decorate([
|
|
853
|
+
( (__param(0, IHoverService)))
|
|
854
|
+
], HistoryItem2Renderer)));
|
|
796
855
|
let HistoryItemChangeRenderer = class HistoryItemChangeRenderer {
|
|
797
856
|
static { HistoryItemChangeRenderer_1 = this; }
|
|
798
857
|
static { this.TEMPLATE_ID = 'historyItemChange'; }
|
|
@@ -849,10 +908,11 @@ let SeparatorRenderer = class SeparatorRenderer {
|
|
|
849
908
|
static { SeparatorRenderer_1 = this; }
|
|
850
909
|
static { this.TEMPLATE_ID = 'separator'; }
|
|
851
910
|
get templateId() { return SeparatorRenderer_1.TEMPLATE_ID; }
|
|
852
|
-
constructor(contextKeyService, contextMenuService, keybindingService, commandService, menuService, telemetryService) {
|
|
911
|
+
constructor(contextKeyService, contextMenuService, keybindingService, configurationService, commandService, menuService, telemetryService) {
|
|
853
912
|
this.contextKeyService = contextKeyService;
|
|
854
913
|
this.contextMenuService = contextMenuService;
|
|
855
914
|
this.keybindingService = keybindingService;
|
|
915
|
+
this.configurationService = configurationService;
|
|
856
916
|
this.commandService = commandService;
|
|
857
917
|
this.menuService = menuService;
|
|
858
918
|
this.telemetryService = telemetryService;
|
|
@@ -865,18 +925,20 @@ let SeparatorRenderer = class SeparatorRenderer {
|
|
|
865
925
|
const label = ( (new IconLabel(element, { supportIcons: true, })));
|
|
866
926
|
append(element, $('.separator'));
|
|
867
927
|
disposables.add(label);
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
928
|
+
if (this.configurationService.getValue('scm.experimental.showHistoryGraph') !== true) {
|
|
929
|
+
const toolBar = ( (new MenuWorkbenchToolBar(
|
|
930
|
+
append(element, $('.actions')),
|
|
931
|
+
MenuId.SCMChangesSeparator,
|
|
932
|
+
{ moreIcon: Codicon.gear },
|
|
933
|
+
this.menuService,
|
|
934
|
+
this.contextKeyService,
|
|
935
|
+
this.contextMenuService,
|
|
936
|
+
this.keybindingService,
|
|
937
|
+
this.commandService,
|
|
938
|
+
this.telemetryService
|
|
939
|
+
)));
|
|
940
|
+
disposables.add(toolBar);
|
|
941
|
+
}
|
|
880
942
|
return { label, disposables };
|
|
881
943
|
}
|
|
882
944
|
renderElement(element, index, templateData, height) {
|
|
@@ -893,9 +955,10 @@ SeparatorRenderer = SeparatorRenderer_1 = ( (__decorate([
|
|
|
893
955
|
( (__param(0, IContextKeyService))),
|
|
894
956
|
( (__param(1, IContextMenuService))),
|
|
895
957
|
( (__param(2, IKeybindingService))),
|
|
896
|
-
( (__param(3,
|
|
897
|
-
( (__param(4,
|
|
898
|
-
( (__param(5,
|
|
958
|
+
( (__param(3, IConfigurationService))),
|
|
959
|
+
( (__param(4, ICommandService))),
|
|
960
|
+
( (__param(5, IMenuService))),
|
|
961
|
+
( (__param(6, ITelemetryService)))
|
|
899
962
|
], SeparatorRenderer)));
|
|
900
963
|
class ListDelegate {
|
|
901
964
|
constructor(inputRenderer) {
|
|
@@ -934,6 +997,9 @@ class ListDelegate {
|
|
|
934
997
|
else if (isSCMHistoryItemTreeElement(element)) {
|
|
935
998
|
return HistoryItemRenderer.TEMPLATE_ID;
|
|
936
999
|
}
|
|
1000
|
+
else if (isSCMHistoryItemViewModelTreeElement(element)) {
|
|
1001
|
+
return HistoryItem2Renderer.TEMPLATE_ID;
|
|
1002
|
+
}
|
|
937
1003
|
else if (isSCMHistoryItemChangeTreeElement(element) || isSCMHistoryItemChangeNode(element)) {
|
|
938
1004
|
return HistoryItemChangeRenderer.TEMPLATE_ID;
|
|
939
1005
|
}
|
|
@@ -1002,6 +1068,9 @@ class SCMTreeSorter {
|
|
|
1002
1068
|
}
|
|
1003
1069
|
return 0;
|
|
1004
1070
|
}
|
|
1071
|
+
if (isSCMHistoryItemViewModelTreeElement(one)) {
|
|
1072
|
+
return isSCMHistoryItemViewModelTreeElement(other) ? 0 : 1;
|
|
1073
|
+
}
|
|
1005
1074
|
if (isSCMHistoryItemChangeTreeElement(one) || isSCMHistoryItemChangeNode(one)) {
|
|
1006
1075
|
if (this.viewMode() === ViewMode.List) {
|
|
1007
1076
|
if (!isSCMHistoryItemChangeTreeElement(other)) {
|
|
@@ -1064,6 +1133,9 @@ let SCMTreeKeyboardNavigationLabelProvider = class SCMTreeKeyboardNavigationLabe
|
|
|
1064
1133
|
else if (isSCMHistoryItemTreeElement(element)) {
|
|
1065
1134
|
return [element.message, element.author];
|
|
1066
1135
|
}
|
|
1136
|
+
else if (isSCMHistoryItemViewModelTreeElement(element)) {
|
|
1137
|
+
return [element.historyItemViewModel.historyItem.message, element.historyItemViewModel.historyItem.author];
|
|
1138
|
+
}
|
|
1067
1139
|
else if (isSCMViewSeparator(element)) {
|
|
1068
1140
|
return element.label;
|
|
1069
1141
|
}
|
|
@@ -1120,6 +1192,11 @@ function getSCMResourceId(element) {
|
|
|
1120
1192
|
const provider = historyItemGroup.repository.provider;
|
|
1121
1193
|
return `historyItem:${provider.id}/${historyItemGroup.id}/${element.id}/${element.parentIds.join(',')}`;
|
|
1122
1194
|
}
|
|
1195
|
+
else if (isSCMHistoryItemViewModelTreeElement(element)) {
|
|
1196
|
+
const provider = element.repository.provider;
|
|
1197
|
+
const historyItem = element.historyItemViewModel.historyItem;
|
|
1198
|
+
return `historyItem2:${provider.id}/${historyItem.id}/${historyItem.parentIds.join(',')}`;
|
|
1199
|
+
}
|
|
1123
1200
|
else if (isSCMHistoryItemChangeTreeElement(element)) {
|
|
1124
1201
|
const historyItem = element.historyItem;
|
|
1125
1202
|
const historyItemGroup = historyItem.historyItemGroup;
|
|
@@ -1174,6 +1251,10 @@ let SCMAccessibilityProvider = class SCMAccessibilityProvider {
|
|
|
1174
1251
|
else if (isSCMHistoryItemTreeElement(element)) {
|
|
1175
1252
|
return `${stripIcons(element.message).trim()}${element.author ? `, ${element.author}` : ''}`;
|
|
1176
1253
|
}
|
|
1254
|
+
else if (isSCMHistoryItemViewModelTreeElement(element)) {
|
|
1255
|
+
const historyItem = element.historyItemViewModel.historyItem;
|
|
1256
|
+
return `${stripIcons(historyItem.message).trim()}${historyItem.author ? `, ${historyItem.author}` : ''}`;
|
|
1257
|
+
}
|
|
1177
1258
|
else if (isSCMHistoryItemChangeTreeElement(element)) {
|
|
1178
1259
|
const result = [basename(element.uri)];
|
|
1179
1260
|
const path = this.labelService.getUriLabel(dirname(element.uri), { relative: true, noPrefix: true });
|
|
@@ -1249,7 +1330,8 @@ MenuRegistry.appendMenuItem(MenuId.SCMTitle, {
|
|
|
1249
1330
|
submenu: Menus.ChangesSettings,
|
|
1250
1331
|
when: ( (ContextKeyExpr.and(
|
|
1251
1332
|
(ContextKeyExpr.equals('view', VIEW_PANE_ID)),
|
|
1252
|
-
(ContextKeys.RepositoryCount.notEqualsTo(0))
|
|
1333
|
+
(ContextKeys.RepositoryCount.notEqualsTo(0)),
|
|
1334
|
+
(( (ContextKeyExpr.equals('config.scm.experimental.showHistoryGraph', true))).negate())
|
|
1253
1335
|
))),
|
|
1254
1336
|
group: '0_view&sort',
|
|
1255
1337
|
order: 2
|
|
@@ -1937,20 +2019,18 @@ let SCMInputWidget = class SCMInputWidget {
|
|
|
1937
2019
|
this.repositoryDisposables.add(this.keybindingService.onDidUpdateKeybindings(updatePlaceholderText));
|
|
1938
2020
|
updatePlaceholderText();
|
|
1939
2021
|
let commitTemplate = '';
|
|
1940
|
-
|
|
1941
|
-
if (
|
|
2022
|
+
this.repositoryDisposables.add(autorun(reader => {
|
|
2023
|
+
if (!input.visible) {
|
|
1942
2024
|
return;
|
|
1943
2025
|
}
|
|
1944
2026
|
const oldCommitTemplate = commitTemplate;
|
|
1945
|
-
commitTemplate = input.repository.provider.commitTemplate;
|
|
2027
|
+
commitTemplate = input.repository.provider.commitTemplate.read(reader);
|
|
1946
2028
|
const value = textModel.getValue();
|
|
1947
2029
|
if (value && value !== oldCommitTemplate) {
|
|
1948
2030
|
return;
|
|
1949
2031
|
}
|
|
1950
2032
|
textModel.setValue(commitTemplate);
|
|
1951
|
-
};
|
|
1952
|
-
this.repositoryDisposables.add(input.repository.provider.onDidChangeCommitTemplate(updateTemplate, this));
|
|
1953
|
-
updateTemplate();
|
|
2033
|
+
}));
|
|
1954
2034
|
const updateEnablement = (enabled) => {
|
|
1955
2035
|
this.inputEditor.updateOptions({ readOnly: !enabled });
|
|
1956
2036
|
};
|
|
@@ -2355,7 +2435,8 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
|
|
|
2355
2435
|
e.affectsConfiguration('scm.showActionButton') ||
|
|
2356
2436
|
e.affectsConfiguration('scm.showChangesSummary') ||
|
|
2357
2437
|
e.affectsConfiguration('scm.showIncomingChanges') ||
|
|
2358
|
-
e.affectsConfiguration('scm.showOutgoingChanges')
|
|
2438
|
+
e.affectsConfiguration('scm.showOutgoingChanges') ||
|
|
2439
|
+
e.affectsConfiguration('scm.experimental.showHistoryGraph'), this.visibilityDisposables)(() => this.updateChildren(), this, this.visibilityDisposables);
|
|
2359
2440
|
this.editorService.onDidActiveEditorChange(this.onDidActiveEditorChange, this, this.visibilityDisposables);
|
|
2360
2441
|
this.scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories, this, this.visibilityDisposables);
|
|
2361
2442
|
this.onDidChangeVisibleRepositories({ added: this.scmViewService.visibleRepositories, removed: Iterable.empty() });
|
|
@@ -2407,6 +2488,7 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
|
|
|
2407
2488
|
this.instantiationService.createInstance(ResourceRenderer, () => this.viewMode, this.listLabels, getActionViewItemProvider(this.instantiationService), resourceActionRunner),
|
|
2408
2489
|
this.instantiationService.createInstance(HistoryItemGroupRenderer, historyItemGroupActionRunner),
|
|
2409
2490
|
this.instantiationService.createInstance(HistoryItemRenderer, historyItemActionRunner, getActionViewItemProvider(this.instantiationService)),
|
|
2491
|
+
this.instantiationService.createInstance(HistoryItem2Renderer),
|
|
2410
2492
|
this.instantiationService.createInstance(HistoryItemChangeRenderer, () => this.viewMode, this.listLabels),
|
|
2411
2493
|
this.instantiationService.createInstance(SeparatorRenderer)
|
|
2412
2494
|
], treeDataSource, {
|
|
@@ -2522,6 +2604,22 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
|
|
|
2522
2604
|
this.scmViewService.focus(e.element.historyItemGroup.repository);
|
|
2523
2605
|
return;
|
|
2524
2606
|
}
|
|
2607
|
+
else if (isSCMHistoryItemViewModelTreeElement(e.element)) {
|
|
2608
|
+
const historyItem = e.element.historyItemViewModel.historyItem;
|
|
2609
|
+
const historyItemParentId = historyItem.parentIds.length > 0 ? historyItem.parentIds[0] : undefined;
|
|
2610
|
+
const historyProvider = e.element.repository.provider.historyProvider;
|
|
2611
|
+
const historyItemChanges = await historyProvider?.provideHistoryItemChanges(historyItem.id, historyItemParentId);
|
|
2612
|
+
if (historyItemChanges) {
|
|
2613
|
+
const title = `${historyItem.id.substring(0, 8)} - ${historyItem.message}`;
|
|
2614
|
+
const rootUri = e.element.repository.provider.rootUri;
|
|
2615
|
+
const multiDiffSourceUri = rootUri ?
|
|
2616
|
+
rootUri.with({ scheme: 'scm-history-item', path: `${rootUri.path}/${historyItem.id}` }) :
|
|
2617
|
+
{ scheme: 'scm-history-item', path: `${e.element.repository.provider.label}/${historyItem.id}` };
|
|
2618
|
+
await this.commandService.executeCommand('_workbench.openMultiDiffEditor', { title, multiDiffSourceUri, resources: historyItemChanges });
|
|
2619
|
+
}
|
|
2620
|
+
this.scmViewService.focus(e.element.repository);
|
|
2621
|
+
return;
|
|
2622
|
+
}
|
|
2525
2623
|
else if (isSCMHistoryItemChangeTreeElement(e.element)) {
|
|
2526
2624
|
if (e.element.originalUri && e.element.modifiedUri) {
|
|
2527
2625
|
await this.commandService.executeCommand(API_OPEN_DIFF_EDITOR_COMMAND_ID, ...toDiffEditorArguments(e.element.uri, e.element.originalUri, e.element.modifiedUri), e);
|
|
@@ -2786,8 +2884,8 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
|
|
|
2786
2884
|
this.areAllRepositoriesCollapsedContextKey.set(false);
|
|
2787
2885
|
return;
|
|
2788
2886
|
}
|
|
2789
|
-
this.isAnyRepositoryCollapsibleContextKey.set(( (this.scmViewService.visibleRepositories.some(r => this.tree.
|
|
2790
|
-
this.areAllRepositoriesCollapsedContextKey.set(this.scmViewService.visibleRepositories.every(r => this.tree.
|
|
2887
|
+
this.isAnyRepositoryCollapsibleContextKey.set(( (this.scmViewService.visibleRepositories.some(r => this.tree.hasNode(r) && this.tree.isCollapsible(r)))));
|
|
2888
|
+
this.areAllRepositoriesCollapsedContextKey.set(this.scmViewService.visibleRepositories.every(r => this.tree.hasNode(r) && (!this.tree.isCollapsible(r) || this.tree.isCollapsed(r))));
|
|
2791
2889
|
}
|
|
2792
2890
|
collapseAllRepositories() {
|
|
2793
2891
|
for (const repository of this.scmViewService.visibleRepositories) {
|
|
@@ -2969,6 +3067,9 @@ let SCMTreeDataSource = class SCMTreeDataSource {
|
|
|
2969
3067
|
else if (isSCMHistoryItemTreeElement(inputOrElement)) {
|
|
2970
3068
|
return true;
|
|
2971
3069
|
}
|
|
3070
|
+
else if (isSCMHistoryItemViewModelTreeElement(inputOrElement)) {
|
|
3071
|
+
return false;
|
|
3072
|
+
}
|
|
2972
3073
|
else if (isSCMHistoryItemChangeTreeElement(inputOrElement)) {
|
|
2973
3074
|
return false;
|
|
2974
3075
|
}
|
|
@@ -3021,6 +3122,13 @@ let SCMTreeDataSource = class SCMTreeDataSource {
|
|
|
3021
3122
|
children.push({ label, ariaLabel, repository: inputOrElement, type: 'separator' });
|
|
3022
3123
|
}
|
|
3023
3124
|
children.push(...historyItemGroups);
|
|
3125
|
+
const historyItems = await this.getHistoryItems2(inputOrElement);
|
|
3126
|
+
if (historyItems.length > 0) {
|
|
3127
|
+
const label = ( localizeWithPath(_moduleId, 34, "Incoming/Outgoing"));
|
|
3128
|
+
const ariaLabel = ( localizeWithPath(_moduleId, 35, "Incoming and outgoing changes"));
|
|
3129
|
+
children.push({ label, ariaLabel, repository: inputOrElement, type: 'separator' });
|
|
3130
|
+
}
|
|
3131
|
+
children.push(...historyItems);
|
|
3024
3132
|
return children;
|
|
3025
3133
|
}
|
|
3026
3134
|
else if (isSCMResourceGroup(inputOrElement)) {
|
|
@@ -3051,11 +3159,11 @@ let SCMTreeDataSource = class SCMTreeDataSource {
|
|
|
3051
3159
|
return [];
|
|
3052
3160
|
}
|
|
3053
3161
|
async getHistoryItemGroups(element) {
|
|
3054
|
-
const { showIncomingChanges, showOutgoingChanges } = this.getConfiguration();
|
|
3162
|
+
const { showIncomingChanges, showOutgoingChanges, showHistoryGraph } = this.getConfiguration();
|
|
3055
3163
|
const scmProvider = element.provider;
|
|
3056
3164
|
const historyProvider = scmProvider.historyProvider;
|
|
3057
3165
|
const currentHistoryItemGroup = historyProvider?.currentHistoryItemGroup;
|
|
3058
|
-
if (!historyProvider || !currentHistoryItemGroup || (showIncomingChanges === 'never' && showOutgoingChanges === 'never')) {
|
|
3166
|
+
if (!historyProvider || !currentHistoryItemGroup || (showIncomingChanges === 'never' && showOutgoingChanges === 'never') || showHistoryGraph) {
|
|
3059
3167
|
return [];
|
|
3060
3168
|
}
|
|
3061
3169
|
const children = [];
|
|
@@ -3063,18 +3171,18 @@ let SCMTreeDataSource = class SCMTreeDataSource {
|
|
|
3063
3171
|
let incomingHistoryItemGroup = historyProviderCacheEntry?.incomingHistoryItemGroup;
|
|
3064
3172
|
let outgoingHistoryItemGroup = historyProviderCacheEntry?.outgoingHistoryItemGroup;
|
|
3065
3173
|
if (!incomingHistoryItemGroup && !outgoingHistoryItemGroup) {
|
|
3066
|
-
const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor(currentHistoryItemGroup.id, currentHistoryItemGroup.
|
|
3174
|
+
const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor(currentHistoryItemGroup.id, currentHistoryItemGroup.remote?.id);
|
|
3067
3175
|
if (!ancestor) {
|
|
3068
3176
|
return [];
|
|
3069
3177
|
}
|
|
3070
|
-
incomingHistoryItemGroup = currentHistoryItemGroup.
|
|
3071
|
-
id: currentHistoryItemGroup.
|
|
3072
|
-
label: currentHistoryItemGroup.
|
|
3178
|
+
incomingHistoryItemGroup = currentHistoryItemGroup.remote ? {
|
|
3179
|
+
id: currentHistoryItemGroup.remote.id,
|
|
3180
|
+
label: currentHistoryItemGroup.remote.name,
|
|
3073
3181
|
ariaLabel: ( localizeWithPath(
|
|
3074
3182
|
_moduleId,
|
|
3075
3183
|
40,
|
|
3076
3184
|
"Incoming changes from {0}",
|
|
3077
|
-
currentHistoryItemGroup.
|
|
3185
|
+
currentHistoryItemGroup.remote.name
|
|
3078
3186
|
)),
|
|
3079
3187
|
icon: Codicon.arrowCircleDown,
|
|
3080
3188
|
direction: 'incoming',
|
|
@@ -3150,6 +3258,50 @@ let SCMTreeDataSource = class SCMTreeDataSource {
|
|
|
3150
3258
|
})))));
|
|
3151
3259
|
return children;
|
|
3152
3260
|
}
|
|
3261
|
+
async getHistoryItems2(element) {
|
|
3262
|
+
const { showHistoryGraph } = this.getConfiguration();
|
|
3263
|
+
const historyProvider = element.provider.historyProvider;
|
|
3264
|
+
const currentHistoryItemGroup = historyProvider?.currentHistoryItemGroup;
|
|
3265
|
+
if (!currentHistoryItemGroup || !showHistoryGraph) {
|
|
3266
|
+
return [];
|
|
3267
|
+
}
|
|
3268
|
+
const historyProviderCacheEntry = this.getHistoryProviderCacheEntry(element);
|
|
3269
|
+
let historyItemsElement = historyProviderCacheEntry.historyItems2.get(element.id);
|
|
3270
|
+
const historyItemsMap = historyProviderCacheEntry.historyItems2;
|
|
3271
|
+
if (!historyItemsElement) {
|
|
3272
|
+
const historyItemGroupIds = [
|
|
3273
|
+
currentHistoryItemGroup.id,
|
|
3274
|
+
...(currentHistoryItemGroup.remote ? [currentHistoryItemGroup.remote.id] : []),
|
|
3275
|
+
...(currentHistoryItemGroup.base ? [currentHistoryItemGroup.base.id] : []),
|
|
3276
|
+
];
|
|
3277
|
+
historyItemsElement = (await historyProvider.provideHistoryItems2({ historyItemGroupIds })) ?? [];
|
|
3278
|
+
this.historyProviderCache.set(element, {
|
|
3279
|
+
...historyProviderCacheEntry,
|
|
3280
|
+
historyItems2: historyItemsMap.set(element.id, historyItemsElement)
|
|
3281
|
+
});
|
|
3282
|
+
}
|
|
3283
|
+
if (historyItemsElement.length === 1 &&
|
|
3284
|
+
historyItemsElement[0].labels?.find(l => l.title === currentHistoryItemGroup.name)) {
|
|
3285
|
+
return [];
|
|
3286
|
+
}
|
|
3287
|
+
const colorMap = ( (new Map([
|
|
3288
|
+
[currentHistoryItemGroup.name, 0]
|
|
3289
|
+
])));
|
|
3290
|
+
if (currentHistoryItemGroup.remote) {
|
|
3291
|
+
colorMap.set(currentHistoryItemGroup.remote.name, 1);
|
|
3292
|
+
}
|
|
3293
|
+
if (currentHistoryItemGroup.base) {
|
|
3294
|
+
colorMap.set(currentHistoryItemGroup.base.name, 2);
|
|
3295
|
+
}
|
|
3296
|
+
return (
|
|
3297
|
+
(toISCMHistoryItemViewModelArray(historyItemsElement, colorMap)
|
|
3298
|
+
.map(historyItemViewModel => ({
|
|
3299
|
+
repository: element,
|
|
3300
|
+
historyItemViewModel,
|
|
3301
|
+
type: 'historyItem2'
|
|
3302
|
+
})))
|
|
3303
|
+
);
|
|
3304
|
+
}
|
|
3153
3305
|
async getHistoryItemChanges(element) {
|
|
3154
3306
|
const repository = element.historyItemGroup.repository;
|
|
3155
3307
|
const historyProvider = repository.provider.historyProvider;
|
|
@@ -3241,7 +3393,8 @@ let SCMTreeDataSource = class SCMTreeDataSource {
|
|
|
3241
3393
|
showActionButton: this.configurationService.getValue('scm.showActionButton'),
|
|
3242
3394
|
showChangesSummary: this.configurationService.getValue('scm.showChangesSummary'),
|
|
3243
3395
|
showIncomingChanges: this.configurationService.getValue('scm.showIncomingChanges'),
|
|
3244
|
-
showOutgoingChanges: this.configurationService.getValue('scm.showOutgoingChanges')
|
|
3396
|
+
showOutgoingChanges: this.configurationService.getValue('scm.showOutgoingChanges'),
|
|
3397
|
+
showHistoryGraph: this.configurationService.getValue('scm.experimental.showHistoryGraph')
|
|
3245
3398
|
};
|
|
3246
3399
|
}
|
|
3247
3400
|
onDidChangeVisibleRepositories({ added, removed }) {
|
|
@@ -3270,6 +3423,7 @@ let SCMTreeDataSource = class SCMTreeDataSource {
|
|
|
3270
3423
|
incomingHistoryItemGroup: undefined,
|
|
3271
3424
|
outgoingHistoryItemGroup: undefined,
|
|
3272
3425
|
historyItems: ( (new Map())),
|
|
3426
|
+
historyItems2: ( (new Map())),
|
|
3273
3427
|
historyItemChanges: ( (new Map()))
|
|
3274
3428
|
};
|
|
3275
3429
|
}
|
|
@@ -3358,5 +3512,26 @@ class SCMActionButton {
|
|
|
3358
3512
|
}
|
|
3359
3513
|
}
|
|
3360
3514
|
}
|
|
3515
|
+
registerThemingParticipant((theme, collector) => {
|
|
3516
|
+
const selectionBackgroundColor = theme.getColor(selectionBackground);
|
|
3517
|
+
if (selectionBackgroundColor) {
|
|
3518
|
+
const inputBackgroundColor = theme.getColor(inputBackground);
|
|
3519
|
+
if (inputBackgroundColor) {
|
|
3520
|
+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor .selected-text { background-color: ${( (inputBackgroundColor.transparent(0.4)))}; }`);
|
|
3521
|
+
}
|
|
3522
|
+
const inputForegroundColor = theme.getColor(inputForeground);
|
|
3523
|
+
if (inputForegroundColor) {
|
|
3524
|
+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor .view-line span.inline-selected-text { color: ${inputForegroundColor}; }`);
|
|
3525
|
+
}
|
|
3526
|
+
const backgroundColor = theme.getColor(inputBackground);
|
|
3527
|
+
if (backgroundColor) {
|
|
3528
|
+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor-background { background-color: ${backgroundColor}; } `);
|
|
3529
|
+
}
|
|
3530
|
+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor .focused .selected-text { background-color: ${selectionBackgroundColor}; }`);
|
|
3531
|
+
}
|
|
3532
|
+
else {
|
|
3533
|
+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor .focused .selected-text { background-color: ${theme.getColor(editorSelectionBackground)}; }`);
|
|
3534
|
+
}
|
|
3535
|
+
});
|
|
3361
3536
|
|
|
3362
3537
|
export { ActionButtonRenderer, ContextKeys, SCMAccessibilityProvider, SCMActionButton, SCMTreeKeyboardNavigationLabelProvider, SCMTreeSorter, SCMViewPane };
|
|
@@ -36,6 +36,9 @@ function isSCMHistoryItemTreeElement(element) {
|
|
|
36
36
|
return element.type === 'allChanges' ||
|
|
37
37
|
element.type === 'historyItem';
|
|
38
38
|
}
|
|
39
|
+
function isSCMHistoryItemViewModelTreeElement(element) {
|
|
40
|
+
return element.type === 'historyItem2';
|
|
41
|
+
}
|
|
39
42
|
function isSCMHistoryItemChangeTreeElement(element) {
|
|
40
43
|
return element.type === 'historyItemChange';
|
|
41
44
|
}
|
|
@@ -120,5 +123,8 @@ function getActionViewItemProvider(instaService) {
|
|
|
120
123
|
function getProviderKey(provider) {
|
|
121
124
|
return `${provider.contextValue}:${provider.label}${provider.rootUri ? `:${( provider.rootUri.toString())}` : ''}`;
|
|
122
125
|
}
|
|
126
|
+
function getRepositoryResourceCount(provider) {
|
|
127
|
+
return provider.groups.reduce((r, g) => r + g.resources.length, 0);
|
|
128
|
+
}
|
|
123
129
|
|
|
124
|
-
export { StatusBarAction, collectContextMenuActions, connectPrimaryMenu, connectPrimaryMenuToInlineActionBar, getActionViewItemProvider, getProviderKey, isSCMActionButton, isSCMHistoryItemChangeNode, isSCMHistoryItemChangeTreeElement, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMInput, isSCMRepository, isSCMResource, isSCMResourceGroup, isSCMResourceNode, isSCMViewSeparator, isSCMViewService, toDiffEditorArguments };
|
|
130
|
+
export { StatusBarAction, collectContextMenuActions, connectPrimaryMenu, connectPrimaryMenuToInlineActionBar, getActionViewItemProvider, getProviderKey, getRepositoryResourceCount, isSCMActionButton, isSCMHistoryItemChangeNode, isSCMHistoryItemChangeTreeElement, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMHistoryItemViewModelTreeElement, isSCMInput, isSCMRepository, isSCMResource, isSCMResourceGroup, isSCMResourceNode, isSCMViewSeparator, isSCMViewService, toDiffEditorArguments };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
2
|
+
import { Disposable, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
3
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
4
4
|
import { SCMInputChangeReason } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
5
5
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
@@ -11,8 +11,10 @@ import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
|
11
11
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
12
12
|
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
13
13
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
14
|
+
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
15
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
14
16
|
|
|
15
|
-
class SCMInput {
|
|
17
|
+
class SCMInput extends Disposable {
|
|
16
18
|
get value() {
|
|
17
19
|
return this._value;
|
|
18
20
|
}
|
|
@@ -51,6 +53,7 @@ class SCMInput {
|
|
|
51
53
|
this._onDidChangeValidateInput.fire();
|
|
52
54
|
}
|
|
53
55
|
constructor(repository, history) {
|
|
56
|
+
super();
|
|
54
57
|
this.repository = repository;
|
|
55
58
|
this.history = history;
|
|
56
59
|
this._value = '';
|
|
@@ -75,7 +78,7 @@ class SCMInput {
|
|
|
75
78
|
this.didChangeHistory = false;
|
|
76
79
|
if (this.repository.provider.rootUri) {
|
|
77
80
|
this.historyNavigator = history.getHistory(this.repository.provider.label, this.repository.provider.rootUri);
|
|
78
|
-
this.history.onWillSaveHistory(event => {
|
|
81
|
+
this._register(this.history.onWillSaveHistory(event => {
|
|
79
82
|
if (this.historyNavigator.isAtEnd()) {
|
|
80
83
|
this.saveValue();
|
|
81
84
|
}
|
|
@@ -83,7 +86,7 @@ class SCMInput {
|
|
|
83
86
|
event.historyDidIndeedChange();
|
|
84
87
|
}
|
|
85
88
|
this.didChangeHistory = false;
|
|
86
|
-
});
|
|
89
|
+
}));
|
|
87
90
|
}
|
|
88
91
|
else {
|
|
89
92
|
this.historyNavigator = ( new HistoryNavigator2([''], 100));
|
|
@@ -95,7 +98,7 @@ class SCMInput {
|
|
|
95
98
|
return;
|
|
96
99
|
}
|
|
97
100
|
if (!transient) {
|
|
98
|
-
this.historyNavigator.
|
|
101
|
+
this.historyNavigator.replaceLast(this._value);
|
|
99
102
|
this.historyNavigator.add(value);
|
|
100
103
|
this.didChangeHistory = true;
|
|
101
104
|
}
|
|
@@ -264,8 +267,9 @@ SCMInputHistory = ( __decorate([
|
|
|
264
267
|
let SCMService = class SCMService {
|
|
265
268
|
get repositories() { return ( this._repositories.values()); }
|
|
266
269
|
get repositoryCount() { return this._repositories.size; }
|
|
267
|
-
constructor(logService, workspaceContextService, contextKeyService, storageService) {
|
|
270
|
+
constructor(logService, workspaceContextService, contextKeyService, storageService, uriIdentityService) {
|
|
268
271
|
this.logService = logService;
|
|
272
|
+
this.uriIdentityService = uriIdentityService;
|
|
269
273
|
this._repositories = ( new Map());
|
|
270
274
|
this._onDidAddProvider = ( new Emitter());
|
|
271
275
|
this.onDidAddRepository = this._onDidAddProvider.event;
|
|
@@ -290,15 +294,36 @@ let SCMService = class SCMService {
|
|
|
290
294
|
this.providerCount.set(this._repositories.size);
|
|
291
295
|
return repository;
|
|
292
296
|
}
|
|
293
|
-
getRepository(
|
|
294
|
-
|
|
297
|
+
getRepository(idOrResource) {
|
|
298
|
+
if (typeof idOrResource === 'string') {
|
|
299
|
+
return this._repositories.get(idOrResource);
|
|
300
|
+
}
|
|
301
|
+
if (idOrResource.scheme !== Schemas.file &&
|
|
302
|
+
idOrResource.scheme !== Schemas.vscodeRemote) {
|
|
303
|
+
return undefined;
|
|
304
|
+
}
|
|
305
|
+
let bestRepository = undefined;
|
|
306
|
+
let bestMatchLength = Number.POSITIVE_INFINITY;
|
|
307
|
+
for (const repository of this.repositories) {
|
|
308
|
+
const root = repository.provider.rootUri;
|
|
309
|
+
if (!root) {
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
const path = this.uriIdentityService.extUri.relativePath(root, idOrResource);
|
|
313
|
+
if (path && !/^\.\./.test(path) && path.length < bestMatchLength) {
|
|
314
|
+
bestRepository = repository;
|
|
315
|
+
bestMatchLength = path.length;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return bestRepository;
|
|
295
319
|
}
|
|
296
320
|
};
|
|
297
321
|
SCMService = ( __decorate([
|
|
298
322
|
( __param(0, ILogService)),
|
|
299
323
|
( __param(1, IWorkspaceContextService)),
|
|
300
324
|
( __param(2, IContextKeyService)),
|
|
301
|
-
( __param(3, IStorageService))
|
|
325
|
+
( __param(3, IStorageService)),
|
|
326
|
+
( __param(4, IUriIdentityService))
|
|
302
327
|
], SCMService));
|
|
303
328
|
|
|
304
329
|
export { SCMService };
|