6
6
import { Barrier } from 'vs/base/common/async' ;
7
7
import { URI , UriComponents } from 'vs/base/common/uri' ;
8
8
import { Event , Emitter } from 'vs/base/common/event' ;
9
- import { derivedOpts , observableValue , observableValueOpts } from 'vs/base/common/observable' ;
9
+ import { derived , observableValue , observableValueOpts } from 'vs/base/common/observable' ;
10
10
import { IDisposable , DisposableStore , combinedDisposable , dispose , Disposable } from 'vs/base/common/lifecycle' ;
11
11
import { ISCMService , ISCMRepository , ISCMProvider , ISCMResource , ISCMResourceGroup , ISCMResourceDecorations , IInputValidation , ISCMViewService , InputValidationType , ISCMActionButtonDescriptor } from 'vs/workbench/contrib/scm/common/scm' ;
12
12
import { ExtHostContext , MainThreadSCMShape , ExtHostSCMShape , SCMProviderFeatures , SCMRawResourceSplices , SCMGroupFeatures , MainContext , SCMHistoryItemGroupDto , SCMHistoryItemDto } from '../common/extHost.protocol' ;
@@ -17,7 +17,7 @@ import { MarshalledId } from 'vs/base/common/marshallingIds';
17
17
import { ThemeIcon } from 'vs/base/common/themables' ;
18
18
import { IMarkdownString } from 'vs/base/common/htmlContent' ;
19
19
import { IQuickDiffService , QuickDiffProvider } from 'vs/workbench/contrib/scm/common/quickDiff' ;
20
- import { ISCMHistoryItem , ISCMHistoryItemChange , ISCMHistoryItemGroup , ISCMHistoryItemGroupWithRevision , ISCMHistoryOptions , ISCMHistoryProvider } from 'vs/workbench/contrib/scm/common/history' ;
20
+ import { ISCMHistoryItem , ISCMHistoryItemChange , ISCMHistoryItemGroup , ISCMHistoryOptions , ISCMHistoryProvider } from 'vs/workbench/contrib/scm/common/history' ;
21
21
import { ResourceTree } from 'vs/base/common/resourceTree' ;
22
22
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity' ;
23
23
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
@@ -49,12 +49,6 @@ function toISCMHistoryItem(historyItemDto: SCMHistoryItemDto): ISCMHistoryItem {
49
49
return { ...historyItemDto , icon, labels } ;
50
50
}
51
51
52
- function historyItemGroupEquals ( a : ISCMHistoryItemGroup | undefined , b : ISCMHistoryItemGroup | undefined ) : boolean {
53
- return a ?. id === b ?. id && a ?. name === b ?. name &&
54
- a ?. base ?. id === b ?. base ?. id && a ?. base ?. name === b ?. base ?. name &&
55
- a ?. remote ?. id === b ?. remote ?. id && a ?. remote ?. name === b ?. remote ?. name ;
56
- }
57
-
58
52
class SCMInputBoxContentProvider extends Disposable implements ITextModelContentProvider {
59
53
constructor (
60
54
textModelService : ITextModelService ,
@@ -171,26 +165,18 @@ class MainThreadSCMHistoryProvider implements ISCMHistoryProvider {
171
165
private _onDidChangeCurrentHistoryItemGroup = new Emitter < void > ( ) ;
172
166
readonly onDidChangeCurrentHistoryItemGroup = this . _onDidChangeCurrentHistoryItemGroup . event ;
173
167
174
- private _currentHistoryItemGroup : ISCMHistoryItemGroupWithRevision | undefined ;
175
- get currentHistoryItemGroup ( ) : ISCMHistoryItemGroupWithRevision | undefined { return this . _currentHistoryItemGroup ; }
176
- set currentHistoryItemGroup ( historyItemGroup : ISCMHistoryItemGroupWithRevision | undefined ) {
168
+ private _currentHistoryItemGroup : ISCMHistoryItemGroup | undefined ;
169
+ get currentHistoryItemGroup ( ) : ISCMHistoryItemGroup | undefined { return this . _currentHistoryItemGroup ; }
170
+ set currentHistoryItemGroup ( historyItemGroup : ISCMHistoryItemGroup | undefined ) {
177
171
this . _currentHistoryItemGroup = historyItemGroup ;
178
172
this . _onDidChangeCurrentHistoryItemGroup . fire ( ) ;
179
173
}
180
174
181
- /**
182
- * Changes when the id/name changes for the current, remote, or base history item group
183
- */
184
- private readonly _currentHistoryItemGroupObs = derivedOpts < ISCMHistoryItemGroup | undefined > ( {
185
- owner : this , equalsFn : historyItemGroupEquals ,
186
- } , reader => this . _currentHistoryItemGroupWithRevisionObs . read ( reader ) ) ;
187
- get currentHistoryItemGroupObs ( ) { return this . _currentHistoryItemGroupObs ; }
175
+ readonly currentHistoryItemGroupIdObs = derived < string | undefined > ( this , reader => this . currentHistoryItemGroup ?. id ) ;
176
+ readonly currentHistoryItemGroupNameObs = derived < string | undefined > ( this , reader => this . currentHistoryItemGroup ?. name ) ;
188
177
189
- /**
190
- * Changes when the id/name/revision changes for the current, remote, or base history item group
191
- */
192
- private readonly _currentHistoryItemGroupWithRevisionObs = observableValueOpts < ISCMHistoryItemGroupWithRevision | undefined > ( { owner : this , equalsFn : structuralEquals } , undefined ) ;
193
- get currentHistoryItemGroupWithRevisionObs ( ) { return this . _currentHistoryItemGroupWithRevisionObs ; }
178
+ private readonly _currentHistoryItemGroupObs = observableValueOpts < ISCMHistoryItemGroup | undefined > ( { owner : this , equalsFn : structuralEquals } , undefined ) ;
179
+ get currentHistoryItemGroupObs ( ) { return this . _currentHistoryItemGroupObs ; }
194
180
195
181
constructor ( private readonly proxy : ExtHostSCMShape , private readonly handle : number ) { }
196
182
@@ -227,8 +213,8 @@ class MainThreadSCMHistoryProvider implements ISCMHistoryProvider {
227
213
} ) ) ;
228
214
}
229
215
230
- $onDidChangeCurrentHistoryItemGroup ( historyItemGroup : ISCMHistoryItemGroupWithRevision | undefined ) : void {
231
- this . _currentHistoryItemGroupWithRevisionObs . set ( historyItemGroup , undefined ) ;
216
+ $onDidChangeCurrentHistoryItemGroup ( historyItemGroup : ISCMHistoryItemGroup | undefined ) : void {
217
+ this . _currentHistoryItemGroupObs . set ( historyItemGroup , undefined ) ;
232
218
}
233
219
}
234
220
0 commit comments