Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e1869c57
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,发现更多精彩内容 >>
提交
e1869c57
编写于
5月 05, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make ResourceMap a real ES6 map, #93368
fyi @bpasero
上级
effb1787
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
49 addition
and
30 deletion
+49
-30
src/vs/base/common/map.ts
src/vs/base/common/map.ts
+31
-15
src/vs/base/test/common/map.test.ts
src/vs/base/test/common/map.test.ts
+6
-3
src/vs/platform/configuration/common/configurationModels.ts
src/vs/platform/configuration/common/configurationModels.ts
+1
-1
src/vs/workbench/contrib/markers/browser/markers.ts
src/vs/workbench/contrib/markers/browser/markers.ts
+1
-1
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
.../workbench/contrib/notebook/common/notebookEditorModel.ts
+1
-1
src/vs/workbench/contrib/search/common/searchModel.ts
src/vs/workbench/contrib/search/common/searchModel.ts
+3
-3
src/vs/workbench/services/backup/common/backupFileService.ts
src/vs/workbench/services/backup/common/backupFileService.ts
+1
-1
src/vs/workbench/services/bulkEdit/browser/conflicts.ts
src/vs/workbench/services/bulkEdit/browser/conflicts.ts
+1
-1
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+1
-1
src/vs/workbench/services/search/common/searchService.ts
src/vs/workbench/services/search/common/searchService.ts
+2
-2
src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts
...ch/services/textfile/common/textFileEditorModelManager.ts
+1
-1
未找到文件。
src/vs/base/common/map.ts
浏览文件 @
e1869c57
...
...
@@ -481,7 +481,9 @@ export class TernarySearchTree<K, V> {
}
}
export
class
ResourceMap
<
T
>
{
export
class
ResourceMap
<
T
>
implements
Map
<
URI
,
T
>
{
readonly
[
Symbol
.
toStringTag
]
=
'
ResourceMap
'
;
protected
readonly
map
:
Map
<
string
,
T
>
;
protected
readonly
ignoreCase
?:
boolean
;
...
...
@@ -491,8 +493,9 @@ export class ResourceMap<T> {
this
.
ignoreCase
=
false
;
// in the future this should be an uri-comparator
}
set
(
resource
:
URI
,
value
:
T
):
void
{
set
(
resource
:
URI
,
value
:
T
):
this
{
this
.
map
.
set
(
this
.
toKey
(
resource
),
value
);
return
this
;
}
get
(
resource
:
URI
):
T
|
undefined
{
...
...
@@ -515,33 +518,46 @@ export class ResourceMap<T> {
return
this
.
map
.
delete
(
this
.
toKey
(
resource
));
}
forEach
(
clb
:
(
value
:
T
,
key
:
URI
)
=>
void
):
void
{
this
.
map
.
forEach
((
value
,
index
)
=>
clb
(
value
,
URI
.
parse
(
index
)));
forEach
(
clb
:
(
value
:
T
,
key
:
URI
,
map
:
Map
<
URI
,
T
>
)
=>
void
,
thisArg
?:
any
):
void
{
if
(
typeof
thisArg
!==
'
undefined
'
)
{
clb
=
clb
.
bind
(
thisArg
);
}
for
(
let
[
index
,
value
]
of
this
.
map
)
{
clb
(
value
,
URI
.
parse
(
index
),
<
any
>
this
);
}
}
values
():
T
[]
{
return
values
(
this
.
map
);
values
():
IterableIterator
<
T
>
{
return
this
.
map
.
values
(
);
}
private
toKey
(
resource
:
URI
):
string
{
let
key
=
resource
.
toString
();
if
(
this
.
ignoreCase
)
{
key
=
key
.
toLowerCase
();
*
keys
():
IterableIterator
<
URI
>
{
for
(
let
key
of
this
.
map
.
keys
())
{
yield
URI
.
parse
(
key
);
}
return
key
;
}
keys
():
URI
[]
{
return
keys
(
this
.
map
).
map
(
k
=>
URI
.
parse
(
k
));
*
entries
():
IterableIterator
<
[
URI
,
T
]
>
{
for
(
let
tuple
of
this
.
map
.
entries
())
{
yield
[
URI
.
parse
(
tuple
[
0
]),
tuple
[
1
]];
}
}
*
[
Symbol
.
iterator
]():
Iterator
<
[
URI
,
T
]
>
{
*
[
Symbol
.
iterator
]():
Itera
bleItera
tor
<
[
URI
,
T
]
>
{
for
(
let
item
of
this
.
map
)
{
yield
[
URI
.
parse
(
item
[
0
]),
item
[
1
]];
}
}
private
toKey
(
resource
:
URI
):
string
{
let
key
=
resource
.
toString
();
if
(
this
.
ignoreCase
)
{
key
=
key
.
toLowerCase
();
}
return
key
;
}
clone
():
ResourceMap
<
T
>
{
const
resourceMap
=
new
ResourceMap
<
T
>
();
...
...
src/vs/base/test/common/map.test.ts
浏览文件 @
e1869c57
...
...
@@ -656,18 +656,21 @@ suite('Map', () => {
assert
.
equal
(
map
.
size
,
0
);
map
.
set
(
resource1
,
1
);
let
res
=
map
.
set
(
resource1
,
1
);
assert
.
ok
(
res
===
map
);
map
.
set
(
resource2
,
'
2
'
);
map
.
set
(
resource3
,
true
);
const
values
=
map
.
values
()
;
const
values
=
[...
map
.
values
()]
;
assert
.
equal
(
values
[
0
],
1
);
assert
.
equal
(
values
[
1
],
'
2
'
);
assert
.
equal
(
values
[
2
],
true
);
let
counter
=
0
;
map
.
forEach
(
value
=>
{
map
.
forEach
(
(
value
,
key
,
mapObj
)
=>
{
assert
.
equal
(
value
,
values
[
counter
++
]);
assert
.
ok
(
URI
.
isUri
(
key
));
assert
.
ok
(
map
===
mapObj
);
});
const
obj
=
Object
.
create
(
null
);
...
...
src/vs/platform/configuration/common/configurationModels.ts
浏览文件 @
e1869c57
...
...
@@ -677,7 +677,7 @@ export class Configuration {
overrides
:
this
.
_workspaceConfiguration
.
overrides
,
keys
:
this
.
_workspaceConfiguration
.
keys
},
folders
:
this
.
_folderConfigurations
.
keys
()
.
reduce
<
[
UriComponents
,
IConfigurationModel
][]
>
((
result
,
folder
)
=>
{
folders
:
[...
this
.
_folderConfigurations
.
keys
()]
.
reduce
<
[
UriComponents
,
IConfigurationModel
][]
>
((
result
,
folder
)
=>
{
const
{
contents
,
overrides
,
keys
}
=
this
.
_folderConfigurations
.
get
(
folder
)
!
;
result
.
push
([
folder
,
{
contents
,
overrides
,
keys
}]);
return
result
;
...
...
src/vs/workbench/contrib/markers/browser/markers.ts
浏览文件 @
e1869c57
...
...
@@ -40,7 +40,7 @@ export class MarkersWorkbenchService extends Disposable implements IMarkersWorkb
resourcesMap
=
resourcesMap
?
resourcesMap
:
new
ResourceMap
<
URI
>
();
resources
.
forEach
(
resource
=>
resourcesMap
!
.
set
(
resource
,
resource
));
return
resourcesMap
;
},
0
)(
resourcesMap
=>
this
.
onMarkerChanged
(
resourcesMap
.
values
()
)));
},
0
)(
resourcesMap
=>
this
.
onMarkerChanged
(
[...
resourcesMap
.
values
()]
)));
}
private
onMarkerChanged
(
resources
:
URI
[]):
void
{
...
...
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
浏览文件 @
e1869c57
...
...
@@ -101,7 +101,7 @@ export class NotebookEditorModelManager extends Disposable implements INotebookE
// private readonly modelLoadQueue = this._register(new ResourceQueue());
get
models
():
NotebookEditorModel
[]
{
return
this
.
mapResourceToModel
.
values
()
;
return
[...
this
.
mapResourceToModel
.
values
()]
;
}
constructor
(
@
IInstantiationService
readonly
instantiationService
:
IInstantiationService
...
...
src/vs/workbench/contrib/search/common/searchModel.ts
浏览文件 @
e1869c57
...
...
@@ -563,7 +563,7 @@ export class FolderMatch extends Disposable {
}
matches
():
FileMatch
[]
{
return
this
.
_fileMatches
.
values
()
;
return
[...
this
.
_fileMatches
.
values
()]
;
}
isEmpty
():
boolean
{
...
...
@@ -621,8 +621,8 @@ export class FolderMatch extends Disposable {
}
private
disposeMatches
():
void
{
this
.
_fileMatches
.
values
()
.
forEach
((
fileMatch
:
FileMatch
)
=>
fileMatch
.
dispose
());
this
.
_unDisposedFileMatches
.
values
()
.
forEach
((
fileMatch
:
FileMatch
)
=>
fileMatch
.
dispose
());
[...
this
.
_fileMatches
.
values
()]
.
forEach
((
fileMatch
:
FileMatch
)
=>
fileMatch
.
dispose
());
[...
this
.
_unDisposedFileMatches
.
values
()]
.
forEach
((
fileMatch
:
FileMatch
)
=>
fileMatch
.
dispose
());
this
.
_fileMatches
.
clear
();
this
.
_unDisposedFileMatches
.
clear
();
}
...
...
src/vs/workbench/services/backup/common/backupFileService.ts
浏览文件 @
e1869c57
...
...
@@ -95,7 +95,7 @@ export class BackupFilesModel implements IBackupFilesModel {
}
get
():
URI
[]
{
return
this
.
cache
.
keys
()
;
return
[...
this
.
cache
.
keys
()]
;
}
remove
(
resource
:
URI
):
void
{
...
...
src/vs/workbench/services/bulkEdit/browser/conflicts.ts
浏览文件 @
e1869c57
...
...
@@ -87,7 +87,7 @@ export class ConflictDetector {
}
list
():
URI
[]
{
return
this
.
_conflicts
.
keys
()
;
return
[...
this
.
_conflicts
.
keys
()]
;
}
hasConflicts
():
boolean
{
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
e1869c57
...
...
@@ -190,7 +190,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
}
// Handle no longer visible out of workspace resources
this
.
activeOutOfWorkspaceWatchers
.
keys
()
.
forEach
(
resource
=>
{
[...
this
.
activeOutOfWorkspaceWatchers
.
keys
()]
.
forEach
(
resource
=>
{
if
(
!
visibleOutOfWorkspaceResources
.
get
(
resource
))
{
dispose
(
this
.
activeOutOfWorkspaceWatchers
.
get
(
resource
));
this
.
activeOutOfWorkspaceWatchers
.
delete
(
resource
);
...
...
src/vs/workbench/services/search/common/searchService.ts
浏览文件 @
e1869c57
...
...
@@ -74,7 +74,7 @@ export class SearchService extends Disposable implements ISearchService {
const
localResults
=
this
.
getLocalResults
(
query
);
if
(
onProgress
)
{
arrays
.
coalesce
(
localResults
.
results
.
values
()
).
forEach
(
onProgress
);
arrays
.
coalesce
(
[...
localResults
.
results
.
values
()]
).
forEach
(
onProgress
);
}
const
onProviderProgress
=
(
progress
:
ISearchProgressItem
)
=>
{
...
...
@@ -99,7 +99,7 @@ export class SearchService extends Disposable implements ISearchService {
...{
limitHit
:
otherResults
.
limitHit
||
localResults
.
limitHit
},
results
:
[...
otherResults
.
results
,
...
arrays
.
coalesce
(
localResults
.
results
.
values
()
)]
results
:
[...
otherResults
.
results
,
...
arrays
.
coalesce
(
[...
localResults
.
results
.
values
()]
)]
};
}
...
...
src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts
浏览文件 @
e1869c57
...
...
@@ -68,7 +68,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
})();
get
models
():
TextFileEditorModel
[]
{
return
this
.
mapResourceToModel
.
values
()
;
return
[...
this
.
mapResourceToModel
.
values
()]
;
}
constructor
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录