Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bdc326b9
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,发现更多精彩内容 >>
提交
bdc326b9
编写于
6月 12, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #25780:
Remove ArraySet and move to native Set
上级
1cc8f3ce
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
35 addition
and
62 deletion
+35
-62
src/vs/base/common/history.ts
src/vs/base/common/history.ts
+19
-8
src/vs/base/common/set.ts
src/vs/base/common/set.ts
+0
-38
src/vs/workbench/parts/markers/browser/markersPanel.ts
src/vs/workbench/parts/markers/browser/markersPanel.ts
+6
-7
src/vs/workbench/parts/search/common/searchModel.ts
src/vs/workbench/parts/search/common/searchModel.ts
+4
-5
src/vs/workbench/services/telemetry/common/workspaceStats.ts
src/vs/workbench/services/telemetry/common/workspaceStats.ts
+6
-4
未找到文件。
src/vs/base/common/history.ts
浏览文件 @
bdc326b9
...
...
@@ -3,28 +3,27 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ArraySet
}
from
'
vs/base/common/set
'
;
import
{
INavigator
,
ArrayNavigator
}
from
'
vs/base/common/iterator
'
;
export
class
HistoryNavigator
<
T
>
implements
INavigator
<
T
>
{
private
_history
:
Array
Set
<
T
>
;
private
_history
:
Set
<
T
>
;
private
_limit
:
number
;
private
_navigator
:
ArrayNavigator
<
T
>
;
constructor
(
history
:
T
[]
=
[],
limit
:
number
=
10
)
{
this
.
_
history
=
new
ArraySet
(
history
);
this
.
_
initialize
(
history
);
this
.
_limit
=
limit
;
this
.
_onChange
();
}
public
add
(
t
:
T
)
{
this
.
_history
.
set
(
t
);
this
.
_history
.
add
(
t
);
this
.
_onChange
();
}
public
addIfNotPresent
(
t
:
T
)
{
if
(
!
this
.
_history
.
contain
s
(
t
))
{
if
(
!
this
.
_history
.
ha
s
(
t
))
{
this
.
add
(
t
);
}
}
...
...
@@ -63,15 +62,27 @@ export class HistoryNavigator<T> implements INavigator<T> {
private
_onChange
()
{
this
.
_reduceToLimit
();
this
.
_navigator
=
new
ArrayNavigator
(
this
.
_
history
.
elements
);
this
.
_navigator
=
new
ArrayNavigator
(
this
.
_elements
);
this
.
_navigator
.
last
();
}
private
_reduceToLimit
()
{
let
data
=
this
.
_
history
.
elements
;
let
data
=
this
.
_elements
;
if
(
data
.
length
>
this
.
_limit
)
{
this
.
_
history
=
new
ArraySet
<
T
>
(
data
.
slice
(
data
.
length
-
this
.
_limit
));
this
.
_
initialize
(
data
.
slice
(
data
.
length
-
this
.
_limit
));
}
}
private
_initialize
(
history
:
T
[]):
void
{
this
.
_history
=
new
Set
();
for
(
const
entry
of
history
)
{
this
.
_history
.
add
(
entry
);
}
}
private
get
_elements
():
T
[]
{
const
elements
:
T
[]
=
[];
this
.
_history
.
forEach
(
e
=>
elements
.
push
(
e
));
return
elements
;
}
}
\ No newline at end of file
src/vs/base/common/set.ts
已删除
100644 → 0
浏览文件 @
1cc8f3ce
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export
class
ArraySet
<
T
>
{
private
_elements
:
T
[];
constructor
(
elements
:
T
[]
=
[])
{
this
.
_elements
=
elements
.
slice
();
}
get
size
():
number
{
return
this
.
_elements
.
length
;
}
set
(
element
:
T
):
void
{
this
.
unset
(
element
);
this
.
_elements
.
push
(
element
);
}
contains
(
element
:
T
):
boolean
{
return
this
.
_elements
.
indexOf
(
element
)
>
-
1
;
}
unset
(
element
:
T
):
void
{
const
index
=
this
.
_elements
.
indexOf
(
element
);
if
(
index
>
-
1
)
{
this
.
_elements
.
splice
(
index
,
1
);
}
}
get
elements
():
T
[]
{
return
this
.
_elements
.
slice
();
}
}
\ No newline at end of file
src/vs/workbench/parts/markers/browser/markersPanel.ts
浏览文件 @
bdc326b9
...
...
@@ -6,7 +6,6 @@
import
'
vs/css!./media/markers
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
*
as
Set
from
'
vs/base/common/set
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Delayer
}
from
'
vs/base/common/async
'
;
...
...
@@ -53,7 +52,7 @@ export class MarkersPanel extends Panel {
private
hasToAutoReveal
:
boolean
;
private
tree
:
Tree
.
ITree
;
private
autoExpanded
:
Set
.
ArraySet
<
string
>
;
private
autoExpanded
:
Set
<
string
>
;
private
rangeHighlightDecorations
:
RangeHighlightDecorations
;
private
actions
:
IAction
[];
...
...
@@ -81,7 +80,7 @@ export class MarkersPanel extends Panel {
super
(
Constants
.
MARKERS_PANEL_ID
,
telemetryService
,
themeService
);
this
.
toDispose
=
[];
this
.
delayedRefresh
=
new
Delayer
<
void
>
(
500
);
this
.
autoExpanded
=
new
Set
.
ArraySet
<
string
>
();
this
.
autoExpanded
=
new
Set
<
string
>
();
this
.
markerFocusContextKey
=
Constants
.
MarkerFocusContextKey
.
bindTo
(
contextKeyService
);
}
...
...
@@ -188,7 +187,7 @@ export class MarkersPanel extends Panel {
public
updateFilter
(
filter
:
string
)
{
this
.
markersModel
.
update
(
new
FilterOptions
(
filter
));
this
.
autoExpanded
=
new
Set
.
ArraySet
<
string
>
();
this
.
autoExpanded
=
new
Set
<
string
>
();
this
.
refreshPanel
();
this
.
autoReveal
();
}
...
...
@@ -304,7 +303,7 @@ export class MarkersPanel extends Panel {
bulkUpdater
.
done
();
for
(
const
resource
of
resources
)
{
if
(
!
this
.
markersModel
.
hasResource
(
resource
))
{
this
.
autoExpanded
.
unset
(
resource
.
toString
());
this
.
autoExpanded
.
delete
(
resource
.
toString
());
}
}
}
...
...
@@ -326,9 +325,9 @@ export class MarkersPanel extends Panel {
private
autoExpand
():
void
{
for
(
const
resource
of
this
.
markersModel
.
filteredResources
)
{
const
resourceUri
=
resource
.
uri
.
toString
();
if
(
!
this
.
autoExpanded
.
contain
s
(
resourceUri
))
{
if
(
!
this
.
autoExpanded
.
ha
s
(
resourceUri
))
{
this
.
tree
.
expand
(
resource
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
autoExpanded
.
set
(
resourceUri
);
this
.
autoExpanded
.
add
(
resourceUri
);
}
}
}
...
...
src/vs/workbench/parts/search/common/searchModel.ts
浏览文件 @
bdc326b9
...
...
@@ -12,7 +12,6 @@ import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import
{
TPromise
,
PPromise
}
from
'
vs/base/common/winjs.base
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
SimpleMap
}
from
'
vs/base/common/map
'
;
import
{
ArraySet
}
from
'
vs/base/common/set
'
;
import
Event
,
{
Emitter
,
fromPromise
,
stopwatch
,
any
}
from
'
vs/base/common/event
'
;
import
{
ISearchService
,
ISearchProgressItem
,
ISearchComplete
,
ISearchQuery
,
IPatternInfo
,
IFileMatch
}
from
'
vs/platform/search/common/search
'
;
import
{
ReplacePattern
}
from
'
vs/platform/search/common/replace
'
;
...
...
@@ -127,7 +126,7 @@ export class FileMatch extends Disposable {
private
_model
:
IModel
;
private
_modelListener
:
IDisposable
;
private
_matches
:
SimpleMap
<
string
,
Match
>
;
private
_removedMatches
:
Array
Set
<
string
>
;
private
_removedMatches
:
Set
<
string
>
;
private
_selectedMatch
:
Match
;
private
_updateScheduler
:
RunOnceScheduler
;
...
...
@@ -138,7 +137,7 @@ export class FileMatch extends Disposable {
super
();
this
.
_resource
=
this
.
rawMatch
.
resource
;
this
.
_matches
=
new
SimpleMap
<
string
,
Match
>
();
this
.
_removedMatches
=
new
Array
Set
<
string
>
();
this
.
_removedMatches
=
new
Set
<
string
>
();
this
.
_updateScheduler
=
new
RunOnceScheduler
(
this
.
updateMatchesForModel
.
bind
(
this
),
250
);
this
.
createMatches
();
...
...
@@ -222,7 +221,7 @@ export class FileMatch extends Disposable {
private
updateMatches
(
matches
:
FindMatch
[],
modelChange
:
boolean
)
{
matches
.
forEach
(
m
=>
{
let
match
=
new
Match
(
this
,
this
.
_model
.
getLineContent
(
m
.
range
.
startLineNumber
),
m
.
range
.
startLineNumber
-
1
,
m
.
range
.
startColumn
-
1
,
m
.
range
.
endColumn
-
m
.
range
.
startColumn
);
if
(
!
this
.
_removedMatches
.
contain
s
(
match
.
id
()))
{
if
(
!
this
.
_removedMatches
.
ha
s
(
match
.
id
()))
{
this
.
add
(
match
);
if
(
this
.
isMatchSelected
(
match
))
{
this
.
_selectedMatch
=
match
;
...
...
@@ -263,7 +262,7 @@ export class FileMatch extends Disposable {
public
remove
(
match
:
Match
):
void
{
this
.
removeMatch
(
match
);
this
.
_removedMatches
.
set
(
match
.
id
());
this
.
_removedMatches
.
add
(
match
.
id
());
this
.
_onChange
.
fire
(
false
);
}
...
...
src/vs/workbench/services/telemetry/common/workspaceStats.ts
浏览文件 @
bdc326b9
...
...
@@ -8,7 +8,6 @@
import
winjs
=
require
(
'
vs/base/common/winjs.base
'
);
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
{
ArraySet
}
from
'
vs/base/common/set
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
@@ -60,12 +59,12 @@ function extractDomain(url: string): string {
}
export
function
getDomainsOfRemotes
(
text
:
string
,
whitelist
:
string
[]):
string
[]
{
let
domains
=
new
Array
Set
<
string
>
();
let
domains
=
new
Set
<
string
>
();
let
match
:
RegExpExecArray
;
while
(
match
=
RemoteMatcher
.
exec
(
text
))
{
let
domain
=
extractDomain
(
match
[
1
]);
if
(
domain
)
{
domains
.
set
(
domain
);
domains
.
add
(
domain
);
}
}
...
...
@@ -74,7 +73,10 @@ export function getDomainsOfRemotes(text: string, whitelist: string[]): string[]
return
map
;
},
Object
.
create
(
null
));
return
domains
.
elements
const
elements
:
string
[]
=
[];
domains
.
forEach
(
e
=>
elements
.
push
(
e
));
return
elements
.
map
(
key
=>
whitemap
[
key
]
?
key
:
key
.
replace
(
AnyButDot
,
'
a
'
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录