Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d83b859b
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d83b859b
编写于
11月 20, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
introduce ISequence
上级
cbb12ecc
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
29 addition
and
23 deletion
+29
-23
src/vs/base/common/arrays.ts
src/vs/base/common/arrays.ts
+5
-1
src/vs/base/common/sequence.ts
src/vs/base/common/sequence.ts
+10
-3
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
+8
-8
src/vs/workbench/parts/scm/electron-browser/scmActivity.ts
src/vs/workbench/parts/scm/electron-browser/scmActivity.ts
+1
-1
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+3
-3
src/vs/workbench/services/scm/common/scm.ts
src/vs/workbench/services/scm/common/scm.ts
+2
-7
未找到文件。
src/vs/base/common/arrays.ts
浏览文件 @
d83b859b
...
...
@@ -125,11 +125,15 @@ export function groupBy<T>(data: T[], compare: (a: T, b: T) => number): T[][] {
return
result
;
}
interface
IMutableSplice
<
T
>
extends
ISplice
<
T
>
{
deleteCount
:
number
;
}
/**
* Diffs two *sorted* arrays and computes the splices which apply the diff.
*/
export
function
sortedDiff
<
T
>
(
before
:
T
[],
after
:
T
[],
compare
:
(
a
:
T
,
b
:
T
)
=>
number
):
ISplice
<
T
>
[]
{
const
result
:
ISplice
<
T
>
[]
=
[];
const
result
:
I
Mutable
Splice
<
T
>
[]
=
[];
function
pushSplice
(
start
:
number
,
deleteCount
:
number
,
toInsert
:
T
[]):
void
{
if
(
deleteCount
===
0
&&
toInsert
.
length
===
0
)
{
...
...
src/vs/base/common/sequence.ts
浏览文件 @
d83b859b
...
...
@@ -5,12 +5,19 @@
'
use strict
'
;
import
Event
from
'
vs/base/common/event
'
;
export
interface
ISplice
<
T
>
{
start
:
number
;
deleteCount
:
number
;
toInsert
:
T
[];
readonly
start
:
number
;
readonly
deleteCount
:
number
;
readonly
toInsert
:
T
[];
}
export
interface
ISpliceable
<
T
>
{
splice
(
start
:
number
,
deleteCount
:
number
,
toInsert
:
T
[]):
void
;
}
export
interface
ISequence
<
T
>
{
readonly
elements
:
T
[];
readonly
onDidSplice
:
Event
<
ISplice
<
T
>>
;
}
\ No newline at end of file
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
浏览文件 @
d83b859b
...
...
@@ -10,28 +10,28 @@ import URI from 'vs/base/common/uri';
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ISCMService
,
ISCMRepository
,
ISCMProvider
,
ISCMResource
,
ISCMResourceGroup
,
ISCMResourceDecorations
,
ISCMResourceCollection
}
from
'
vs/workbench/services/scm/common/scm
'
;
import
{
ISCMService
,
ISCMRepository
,
ISCMProvider
,
ISCMResource
,
ISCMResourceGroup
,
ISCMResourceDecorations
}
from
'
vs/workbench/services/scm/common/scm
'
;
import
{
ExtHostContext
,
MainThreadSCMShape
,
ExtHostSCMShape
,
SCMProviderFeatures
,
SCMRawResourceSplices
,
SCMGroupFeatures
,
MainContext
,
IExtHostContext
}
from
'
../node/extHost.protocol
'
;
import
{
Command
}
from
'
vs/editor/common/modes
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
ISplice
}
from
'
vs/base/common/sequence
'
;
import
{
ISplice
,
ISequence
}
from
'
vs/base/common/sequence
'
;
class
MainThreadSCMResourceCollection
implements
IS
CMResourceCollection
{
class
MainThreadSCMResourceCollection
implements
IS
equence
<
ISCMResource
>
{
readonly
resource
s
:
ISCMResource
[]
=
[];
readonly
element
s
:
ISCMResource
[]
=
[];
private
_onDidSplice
=
new
Emitter
<
ISplice
<
ISCMResource
>>
();
readonly
onDidSplice
=
this
.
_onDidSplice
.
event
;
splice
(
start
:
number
,
deleteCount
:
number
,
toInsert
:
ISCMResource
[])
{
this
.
resource
s
.
splice
(
start
,
deleteCount
,
...
toInsert
);
this
.
element
s
.
splice
(
start
,
deleteCount
,
...
toInsert
);
this
.
_onDidSplice
.
fire
({
start
,
deleteCount
,
toInsert
});
}
}
class
MainThreadSCMResourceGroup
implements
ISCMResourceGroup
{
readonly
resource
Collection
=
new
MainThreadSCMResourceCollection
();
readonly
resource
s
=
new
MainThreadSCMResourceCollection
();
get
hideWhenEmpty
():
boolean
{
return
this
.
features
.
hideWhenEmpty
;
}
constructor
(
...
...
@@ -89,7 +89,7 @@ class MainThreadSCMProvider implements ISCMProvider {
get
resources
():
ISCMResourceGroup
[]
{
return
this
.
_groups
.
filter
(
g
=>
g
.
resource
Collection
.
resource
s
.
length
>
0
||
!
g
.
features
.
hideWhenEmpty
);
.
filter
(
g
=>
g
.
resource
s
.
element
s
.
length
>
0
||
!
g
.
features
.
hideWhenEmpty
);
}
private
_onDidChangeResources
=
new
Emitter
<
void
>
();
...
...
@@ -206,7 +206,7 @@ class MainThreadSCMProvider implements ISCMProvider {
);
});
group
.
resource
Collection
.
splice
(
start
,
deleteCount
,
resources
);
group
.
resource
s
.
splice
(
start
,
deleteCount
,
resources
);
}
}
...
...
src/vs/workbench/parts/scm/electron-browser/scmActivity.ts
浏览文件 @
d83b859b
...
...
@@ -58,7 +58,7 @@ export class StatusUpdater implements IWorkbenchContribution {
if
(
typeof
repository
.
provider
.
count
===
'
number
'
)
{
return
r
+
repository
.
provider
.
count
;
}
else
{
return
r
+
repository
.
provider
.
resources
.
reduce
<
number
>
((
r
,
g
)
=>
r
+
g
.
resource
Collection
.
resource
s
.
length
,
0
);
return
r
+
repository
.
provider
.
resources
.
reduce
<
number
>
((
r
,
g
)
=>
r
+
g
.
resource
s
.
element
s
.
length
,
0
);
}
},
0
);
...
...
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
d83b859b
...
...
@@ -371,7 +371,7 @@ class ResourceGroupRenderer implements IRenderer<ISCMResourceGroup, ResourceGrou
renderElement
(
group
:
ISCMResourceGroup
,
index
:
number
,
template
:
ResourceGroupTemplate
):
void
{
template
.
name
.
textContent
=
group
.
label
;
template
.
count
.
setCount
(
group
.
resource
Collection
.
resource
s
.
length
);
template
.
count
.
setCount
(
group
.
resource
s
.
element
s
.
length
);
template
.
actionBar
.
clear
();
template
.
actionBar
.
context
=
group
;
template
.
actionBar
.
push
(
this
.
scmMenus
.
getResourceGroupActions
(
group
),
{
icon
:
true
,
label
:
false
});
...
...
@@ -681,11 +681,11 @@ export class RepositoryPanel extends ViewletPanel {
private
updateList
():
void
{
const
elements
=
this
.
repository
.
provider
.
resources
.
reduce
<
(
ISCMResourceGroup
|
ISCMResource
)[]
>
((
r
,
g
)
=>
{
if
(
g
.
resource
Collection
.
resource
s
.
length
===
0
&&
g
.
hideWhenEmpty
)
{
if
(
g
.
resource
s
.
element
s
.
length
===
0
&&
g
.
hideWhenEmpty
)
{
return
r
;
}
return
[...
r
,
g
,
...
g
.
resource
Collection
.
resource
s
];
return
[...
r
,
g
,
...
g
.
resource
s
.
element
s
];
},
[]);
this
.
list
.
splice
(
0
,
this
.
list
.
length
,
elements
);
...
...
src/vs/workbench/services/scm/common/scm.ts
浏览文件 @
d83b859b
...
...
@@ -12,7 +12,7 @@ import Event from 'vs/base/common/event';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Command
}
from
'
vs/editor/common/modes
'
;
import
{
ColorIdentifier
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IS
pli
ce
}
from
'
vs/base/common/sequence
'
;
import
{
IS
equen
ce
}
from
'
vs/base/common/sequence
'
;
export
interface
IBaselineResourceProvider
{
getBaselineResource
(
resource
:
URI
):
TPromise
<
URI
>
;
...
...
@@ -32,11 +32,6 @@ export interface ISCMResourceDecorations {
color
?:
ColorIdentifier
;
}
export
interface
ISCMResourceCollection
{
readonly
resources
:
ISCMResource
[];
readonly
onDidSplice
:
Event
<
ISplice
<
ISCMResource
>>
;
}
export
interface
ISCMResource
{
readonly
resourceGroup
:
ISCMResourceGroup
;
readonly
sourceUri
:
URI
;
...
...
@@ -48,7 +43,7 @@ export interface ISCMResourceGroup {
readonly
provider
:
ISCMProvider
;
readonly
label
:
string
;
readonly
id
:
string
;
readonly
resource
Collection
:
ISCMResourceCollection
;
readonly
resource
s
:
ISequence
<
ISCMResource
>
;
readonly
hideWhenEmpty
:
boolean
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录