Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e9c80f03
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,发现更多精彩内容 >>
提交
e9c80f03
编写于
8月 12, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some renamed in Map land
上级
f29f71d1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
31 addition
and
31 deletion
+31
-31
src/vs/base/common/filters.ts
src/vs/base/common/filters.ts
+2
-2
src/vs/base/common/glob.ts
src/vs/base/common/glob.ts
+2
-2
src/vs/base/common/map.ts
src/vs/base/common/map.ts
+3
-3
src/vs/base/common/strings.ts
src/vs/base/common/strings.ts
+2
-2
src/vs/base/test/common/map.test.ts
src/vs/base/test/common/map.test.ts
+7
-7
src/vs/test/utils/instantiationTestUtils.ts
src/vs/test/utils/instantiationTestUtils.ts
+3
-3
src/vs/workbench/parts/markers/common/markersModel.ts
src/vs/workbench/parts/markers/common/markersModel.ts
+2
-2
src/vs/workbench/parts/search/browser/replaceService.ts
src/vs/workbench/parts/search/browser/replaceService.ts
+2
-2
src/vs/workbench/parts/search/common/searchModel.ts
src/vs/workbench/parts/search/common/searchModel.ts
+8
-8
未找到文件。
src/vs/base/common/filters.ts
浏览文件 @
e9c80f03
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
{
LinkedMap
}
from
'
vs/base/common/map
'
;
import
{
Bounded
LinkedMap
}
from
'
vs/base/common/map
'
;
export
interface
IFilter
{
// Returns null if word doesn't match.
...
...
@@ -299,7 +299,7 @@ export enum SubstringMatching {
export
const
fuzzyContiguousFilter
=
or
(
matchesPrefix
,
matchesCamelCase
,
matchesContiguousSubString
);
const
fuzzySeparateFilter
=
or
(
matchesPrefix
,
matchesCamelCase
,
matchesSubString
);
const
fuzzyRegExpCache
=
new
LinkedMap
<
RegExp
>
(
10000
);
// bounded to 10000 elements
const
fuzzyRegExpCache
=
new
Bounded
LinkedMap
<
RegExp
>
(
10000
);
// bounded to 10000 elements
export
function
matchesFuzzy
(
word
:
string
,
wordToMatchAgainst
:
string
,
enableSeparateSubstringMatching
=
false
):
IMatch
[]
{
if
(
typeof
word
!==
'
string
'
||
typeof
wordToMatchAgainst
!==
'
string
'
)
{
...
...
src/vs/base/common/glob.ts
浏览文件 @
e9c80f03
...
...
@@ -6,7 +6,7 @@
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
{
LinkedMap
}
from
'
vs/base/common/map
'
;
import
{
Bounded
LinkedMap
}
from
'
vs/base/common/map
'
;
export
interface
IExpression
{
[
pattern
:
string
]:
boolean
|
SiblingClause
|
any
;
...
...
@@ -222,7 +222,7 @@ interface IParsedPattern {
trivia
?:
Trivia
;
}
const
CACHE
=
new
LinkedMap
<
IParsedPattern
>
(
10000
);
// bounded to 10000 elements
const
CACHE
=
new
Bounded
LinkedMap
<
IParsedPattern
>
(
10000
);
// bounded to 10000 elements
function
parsePattern
(
pattern
:
string
):
IParsedPattern
{
if
(
!
pattern
)
{
...
...
src/vs/base/common/map.ts
浏览文件 @
e9c80f03
...
...
@@ -20,7 +20,7 @@ export interface Entry<K, T> {
* A simple map to store value by a key object. Key can be any object that has toString() function to get
* string value of the key.
*/
export
class
Simple
Map
<
K
extends
Key
,
T
>
{
export
class
Linked
Map
<
K
extends
Key
,
T
>
{
protected
map
:
{
[
key
:
string
]:
Entry
<
K
,
T
>
};
protected
_size
:
number
;
...
...
@@ -114,7 +114,7 @@ export class SimpleMap<K extends Key, T> {
* the cache will remove the entry that was last recently added. Or, if a ratio is provided below 1,
* all elements will be removed until the ratio is full filled (e.g. 0.75 to remove 25% of old elements).
*/
export
class
LinkedMap
<
T
>
{
export
class
Bounded
LinkedMap
<
T
>
{
protected
map
:
{
[
key
:
string
]:
Entry
<
string
,
T
>
};
private
head
:
Entry
<
string
,
T
>
;
private
tail
:
Entry
<
string
,
T
>
;
...
...
@@ -252,7 +252,7 @@ export class LinkedMap<T> {
* maximum number of elements in the cache, it helps to remove those
* entries from the cache that are LRU.
*/
export
class
LRUCache
<
T
>
extends
LinkedMap
<
T
>
{
export
class
LRUCache
<
T
>
extends
Bounded
LinkedMap
<
T
>
{
constructor
(
limit
:
number
)
{
super
(
limit
);
...
...
src/vs/base/common/strings.ts
浏览文件 @
e9c80f03
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
LinkedMap
}
from
'
vs/base/common/map
'
;
import
{
Bounded
LinkedMap
}
from
'
vs/base/common/map
'
;
/**
* The empty string.
...
...
@@ -221,7 +221,7 @@ export function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {
*/
export
let
canNormalize
=
typeof
((
<
any
>
''
).
normalize
)
===
'
function
'
;
const
nonAsciiCharactersPattern
=
/
[^\u
0000-
\u
0080
]
/
;
const
normalizedCache
=
new
LinkedMap
<
string
>
(
10000
);
// bounded to 10000 elements
const
normalizedCache
=
new
Bounded
LinkedMap
<
string
>
(
10000
);
// bounded to 10000 elements
export
function
normalizeNFC
(
str
:
string
):
string
{
if
(
!
canNormalize
||
!
str
)
{
return
str
;
...
...
src/vs/base/test/common/map.test.ts
浏览文件 @
e9c80f03
...
...
@@ -5,12 +5,12 @@
'
use strict
'
;
import
{
LinkedMap
,
LRUCache
}
from
'
vs/base/common/map
'
;
import
{
Bounded
LinkedMap
,
LRUCache
}
from
'
vs/base/common/map
'
;
import
*
as
assert
from
'
assert
'
;
suite
(
'
Map
'
,
()
=>
{
test
(
'
LinkedMap - basics
'
,
function
()
{
const
map
=
new
LinkedMap
<
any
>
();
test
(
'
Bounded
LinkedMap - basics
'
,
function
()
{
const
map
=
new
Bounded
LinkedMap
<
any
>
();
assert
.
equal
(
map
.
size
,
0
);
...
...
@@ -66,8 +66,8 @@ suite('Map', () => {
assert
.
ok
(
!
map
.
has
(
'
1
'
));
});
test
(
'
LinkedMap - bounded
'
,
function
()
{
const
map
=
new
LinkedMap
<
number
>
(
5
);
test
(
'
Bounded
LinkedMap - bounded
'
,
function
()
{
const
map
=
new
Bounded
LinkedMap
<
number
>
(
5
);
assert
.
equal
(
0
,
map
.
size
);
...
...
@@ -135,8 +135,8 @@ suite('Map', () => {
assert
.
equal
(
map
.
get
(
'
14
'
),
14
);
});
test
(
'
LinkedMap - bounded with ratio
'
,
function
()
{
const
map
=
new
LinkedMap
<
number
>
(
6
,
0.5
);
test
(
'
Bounded
LinkedMap - bounded with ratio
'
,
function
()
{
const
map
=
new
Bounded
LinkedMap
<
number
>
(
6
,
0.5
);
assert
.
equal
(
0
,
map
.
size
);
...
...
src/vs/test/utils/instantiationTestUtils.ts
浏览文件 @
e9c80f03
...
...
@@ -5,7 +5,7 @@
import
*
as
sinon
from
'
sinon
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Simple
Map
}
from
'
vs/base/common/map
'
;
import
{
Linked
Map
}
from
'
vs/base/common/map
'
;
import
{
InstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -34,12 +34,12 @@ interface IServiceMock<T> {
export
class
TestInstantiationService
extends
InstantiationService
{
private
_servciesMap
:
Simple
Map
<
ServiceIdentifier
<
any
>
,
any
>
;
private
_servciesMap
:
Linked
Map
<
ServiceIdentifier
<
any
>
,
any
>
;
constructor
(
private
_serviceCollection
:
ServiceCollection
=
new
ServiceCollection
())
{
super
(
_serviceCollection
);
this
.
_servciesMap
=
new
Simple
Map
<
ServiceIdentifier
<
any
>
,
any
>
();
this
.
_servciesMap
=
new
Linked
Map
<
ServiceIdentifier
<
any
>
,
any
>
();
this
.
_servciesMap
.
set
(
ITelemetryService
,
NullTelemetryService
);
this
.
_servciesMap
.
set
(
IEventService
,
EventService
);
this
.
_servciesMap
.
set
(
ISearchService
,
SearchService
);
...
...
src/vs/workbench/parts/markers/common/markersModel.ts
浏览文件 @
e9c80f03
...
...
@@ -88,14 +88,14 @@ export class FilterOptions {
export
class
MarkersModel
{
private
markersByResource
:
Map
.
Simple
Map
<
URI
,
IMarker
[]
>
;
private
markersByResource
:
Map
.
Linked
Map
<
URI
,
IMarker
[]
>
;
private
_filteredResources
:
Resource
[];
private
_nonFilteredResources
:
Resource
[];
private
_filterOptions
:
FilterOptions
;
constructor
(
markers
:
IMarker
[]
=
[])
{
this
.
markersByResource
=
new
Map
.
Simple
Map
<
URI
,
IMarker
[]
>
();
this
.
markersByResource
=
new
Map
.
Linked
Map
<
URI
,
IMarker
[]
>
();
this
.
_filterOptions
=
new
FilterOptions
();
this
.
update
(
markers
);
}
...
...
src/vs/workbench/parts/search/browser/replaceService.ts
浏览文件 @
e9c80f03
...
...
@@ -25,11 +25,11 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
class
EditorInputCache
{
private
cache
:
Map
.
Simple
Map
<
URI
,
TPromise
<
DiffEditorInput
>>
;
private
cache
:
Map
.
Linked
Map
<
URI
,
TPromise
<
DiffEditorInput
>>
;
constructor
(
private
replaceService
:
ReplaceService
,
private
editorService
:
IWorkbenchEditorService
,
private
modelService
:
IModelService
)
{
this
.
cache
=
new
Map
.
Simple
Map
<
URI
,
TPromise
<
DiffEditorInput
>>
();
this
.
cache
=
new
Map
.
Linked
Map
<
URI
,
TPromise
<
DiffEditorInput
>>
();
}
public
hasInput
(
fileMatch
:
FileMatch
):
boolean
{
...
...
src/vs/workbench/parts/search/common/searchModel.ts
浏览文件 @
e9c80f03
...
...
@@ -11,7 +11,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
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
{
Simple
Map
}
from
'
vs/base/common/map
'
;
import
{
Linked
Map
}
from
'
vs/base/common/map
'
;
import
{
ArraySet
}
from
'
vs/base/common/set
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
*
as
Search
from
'
vs/platform/search/common/search
'
;
...
...
@@ -100,7 +100,7 @@ export class FileMatch extends Disposable {
private
_resource
:
URI
;
private
_model
:
IModel
;
private
_modelListener
:
IDisposable
;
private
_matches
:
Simple
Map
<
string
,
Match
>
;
private
_matches
:
Linked
Map
<
string
,
Match
>
;
private
_removedMatches
:
ArraySet
<
string
>
;
private
_selectedMatch
:
Match
;
...
...
@@ -111,7 +111,7 @@ export class FileMatch extends Disposable {
@
IModelService
private
modelService
:
IModelService
,
@
IReplaceService
private
replaceService
:
IReplaceService
)
{
super
();
this
.
_resource
=
this
.
rawMatch
.
resource
;
this
.
_matches
=
new
Simple
Map
<
string
,
Match
>
();
this
.
_matches
=
new
Linked
Map
<
string
,
Match
>
();
this
.
_removedMatches
=
new
ArraySet
<
string
>
();
this
.
_updateScheduler
=
new
RunOnceScheduler
(
this
.
updateMatches
.
bind
(
this
),
250
);
...
...
@@ -172,7 +172,7 @@ export class FileMatch extends Disposable {
if
(
!
this
.
_model
)
{
return
;
}
this
.
_matches
=
new
Simple
Map
<
string
,
Match
>
();
this
.
_matches
=
new
Linked
Map
<
string
,
Match
>
();
let
matches
=
this
.
_model
.
findMatches
(
this
.
_query
.
pattern
,
this
.
_model
.
getFullModelRange
(),
this
.
_query
.
isRegExp
,
this
.
_query
.
isCaseSensitive
,
this
.
_query
.
isWordMatch
);
...
...
@@ -298,8 +298,8 @@ export class SearchResult extends Disposable {
private
_onChange
=
this
.
_register
(
new
Emitter
<
IChangeEvent
>
());
public
onChange
:
Event
<
IChangeEvent
>
=
this
.
_onChange
.
event
;
private
_fileMatches
:
Simple
Map
<
URI
,
FileMatch
>
;
private
_unDisposedFileMatches
:
Simple
Map
<
URI
,
FileMatch
>
;
private
_fileMatches
:
Linked
Map
<
URI
,
FileMatch
>
;
private
_unDisposedFileMatches
:
Linked
Map
<
URI
,
FileMatch
>
;
private
_query
:
Search
.
IPatternInfo
=
null
;
private
_showHighlights
:
boolean
;
private
_replacingAll
:
boolean
=
false
;
...
...
@@ -307,8 +307,8 @@ export class SearchResult extends Disposable {
constructor
(
private
_searchModel
:
SearchModel
,
@
IReplaceService
private
replaceService
:
IReplaceService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
super
();
this
.
_fileMatches
=
new
Simple
Map
<
URI
,
FileMatch
>
();
this
.
_unDisposedFileMatches
=
new
Simple
Map
<
URI
,
FileMatch
>
();
this
.
_fileMatches
=
new
Linked
Map
<
URI
,
FileMatch
>
();
this
.
_unDisposedFileMatches
=
new
Linked
Map
<
URI
,
FileMatch
>
();
}
public
set
query
(
query
:
Search
.
IPatternInfo
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录