Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
fe94af83
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,发现更多精彩内容 >>
提交
fe94af83
编写于
9月 13, 2019
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove URI from resource tree
上级
7f159d00
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
13 addition
and
14 deletion
+13
-14
src/vs/base/common/resourceTree.ts
src/vs/base/common/resourceTree.ts
+4
-7
src/vs/base/test/common/resourceTree.test.ts
src/vs/base/test/common/resourceTree.test.ts
+3
-4
src/vs/workbench/contrib/scm/browser/scmViewlet.ts
src/vs/workbench/contrib/scm/browser/scmViewlet.ts
+6
-3
未找到文件。
src/vs/base/common/resourceTree.ts
浏览文件 @
fe94af83
...
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
*
as
paths
from
'
vs/base/common/path
'
;
import
{
Iterator
}
from
'
vs/base/common/iterator
'
;
...
...
@@ -74,10 +73,8 @@ export class ResourceTree<T extends NonNullable<any>> {
readonly
root
=
new
BranchNode
<
T
>
(
''
);
constructor
()
{
}
add
(
uri
:
URI
,
element
:
T
):
void
{
const
parts
=
uri
.
fsPath
.
split
(
/
[\\\/]
/
).
filter
(
p
=>
!!
p
);
add
(
key
:
string
,
element
:
T
):
void
{
const
parts
=
key
.
split
(
/
[\\\/]
/
).
filter
(
p
=>
!!
p
);
let
node
=
this
.
root
;
let
path
=
this
.
root
.
path
;
...
...
@@ -114,8 +111,8 @@ export class ResourceTree<T extends NonNullable<any>> {
}
}
delete
(
uri
:
URI
):
T
|
undefined
{
const
parts
=
uri
.
fsPath
.
split
(
/
[\\\/]
/
).
filter
(
p
=>
!!
p
);
delete
(
key
:
string
):
T
|
undefined
{
const
parts
=
key
.
split
(
/
[\\\/]
/
).
filter
(
p
=>
!!
p
);
return
this
.
_delete
(
this
.
root
,
parts
,
0
);
}
...
...
src/vs/base/test/common/resourceTree.test.ts
浏览文件 @
fe94af83
...
...
@@ -5,7 +5,6 @@
import
*
as
assert
from
'
assert
'
;
import
{
ResourceTree
,
IBranchNode
,
ILeafNode
,
isBranchNode
}
from
'
vs/base/common/resourceTree
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
suite
(
'
ResourceTree
'
,
function
()
{
test
(
'
ctor
'
,
function
()
{
...
...
@@ -17,7 +16,7 @@ suite('ResourceTree', function () {
test
(
'
simple
'
,
function
()
{
const
tree
=
new
ResourceTree
<
string
>
();
tree
.
add
(
URI
.
file
(
'
/foo/bar.txt
'
)
,
'
bar contents
'
);
tree
.
add
(
'
/foo/bar.txt
'
,
'
bar contents
'
);
assert
(
isBranchNode
(
tree
.
root
));
assert
.
equal
(
tree
.
root
.
size
,
1
);
...
...
@@ -31,7 +30,7 @@ suite('ResourceTree', function () {
assert
(
!
isBranchNode
(
bar
));
assert
.
equal
(
bar
.
element
,
'
bar contents
'
);
tree
.
add
(
URI
.
file
(
'
/hello.txt
'
)
,
'
hello contents
'
);
tree
.
add
(
'
/hello.txt
'
,
'
hello contents
'
);
assert
.
equal
(
tree
.
root
.
size
,
2
);
let
hello
=
tree
.
root
.
get
(
'
hello.txt
'
)
as
ILeafNode
<
string
>
;
...
...
@@ -39,7 +38,7 @@ suite('ResourceTree', function () {
assert
(
!
isBranchNode
(
hello
));
assert
.
equal
(
hello
.
element
,
'
hello contents
'
);
tree
.
delete
(
URI
.
file
(
'
/foo/bar.txt
'
)
);
tree
.
delete
(
'
/foo/bar.txt
'
);
assert
.
equal
(
tree
.
root
.
size
,
1
);
hello
=
tree
.
root
.
get
(
'
hello.txt
'
)
as
ILeafNode
<
string
>
;
assert
(
hello
);
...
...
src/vs/workbench/contrib/scm/browser/scmViewlet.ts
浏览文件 @
fe94af83
...
...
@@ -7,7 +7,7 @@ import 'vs/css!./media/scmViewlet';
import
{
localize
}
from
'
vs/nls
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
import
{
basename
}
from
'
vs/base/common/resources
'
;
import
{
basename
,
relativePath
}
from
'
vs/base/common/resources
'
;
import
{
IDisposable
,
dispose
,
Disposable
,
DisposableStore
,
combinedDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ViewletPanel
,
IViewletPanelOptions
}
from
'
vs/workbench/browser/parts/views/panelViewlet
'
;
import
{
append
,
$
,
addClass
,
toggleClass
,
trackFocus
,
removeClass
,
addClasses
}
from
'
vs/base/browser/dom
'
;
...
...
@@ -56,6 +56,7 @@ import { ObjectTree, ICompressibleTreeRenderer } from 'vs/base/browser/ui/tree/o
import
{
Iterator
}
from
'
vs/base/common/iterator
'
;
import
*
as
paths
from
'
vs/base/common/path
'
;
import
{
ICompressedTreeNode
,
ICompressedTreeElement
}
from
'
vs/base/browser/ui/tree/compressedObjectTreeModel
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
interface
ISpliceEvent
<
T
>
{
index
:
number
;
...
...
@@ -732,14 +733,16 @@ class ResourceGroupSplicer {
}
private
onDidSpliceGroup
(
item
:
IGroupItem
,
{
start
,
deleteCount
,
toInsert
}:
ISplice
<
ISCMResource
>
):
void
{
const
root
=
item
.
group
.
provider
.
rootUri
||
URI
.
file
(
'
/
'
);
for
(
const
resource
of
toInsert
)
{
item
.
tree
.
add
(
re
source
.
sourceUri
,
resource
);
item
.
tree
.
add
(
re
lativePath
(
root
,
resource
.
sourceUri
)
||
resource
.
sourceUri
.
fsPath
,
resource
);
}
const
deleted
=
item
.
resources
.
splice
(
start
,
deleteCount
,
...
toInsert
);
for
(
const
resource
of
deleted
)
{
item
.
tree
.
delete
(
re
source
.
sourceUri
);
item
.
tree
.
delete
(
re
lativePath
(
root
,
resource
.
sourceUri
)
||
resource
.
sourceUri
.
fsPath
);
}
this
.
fullRefresh
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录