Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
809ccf9a
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 搜索 >>
提交
809ccf9a
编写于
3月 21, 2019
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #70912 - fix noImplicitAny errors in search land
上级
7502b13a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
56 addition
and
49 deletion
+56
-49
src/vs/workbench/services/search/common/search.ts
src/vs/workbench/services/search/common/search.ts
+13
-7
src/vs/workbench/services/search/node/fileSearch.ts
src/vs/workbench/services/search/node/fileSearch.ts
+5
-5
src/vs/workbench/services/search/node/fileSearchManager.ts
src/vs/workbench/services/search/node/fileSearchManager.ts
+1
-1
src/vs/workbench/services/search/node/rawSearchService.ts
src/vs/workbench/services/search/node/rawSearchService.ts
+7
-7
src/vs/workbench/services/search/node/ripgrepSearchUtils.ts
src/vs/workbench/services/search/node/ripgrepSearchUtils.ts
+1
-1
src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts
...workbench/services/search/node/ripgrepTextSearchEngine.ts
+4
-3
src/vs/workbench/services/search/node/searchService.ts
src/vs/workbench/services/search/node/searchService.ts
+8
-8
src/vs/workbench/services/search/node/textSearchAdapter.ts
src/vs/workbench/services/search/node/textSearchAdapter.ts
+3
-3
src/vs/workbench/services/search/test/node/rawSearchService.test.ts
...kbench/services/search/test/node/rawSearchService.test.ts
+10
-10
src/vs/workbench/services/search/test/node/ripgrepTextSearchEngine.test.ts
...services/search/test/node/ripgrepTextSearchEngine.test.ts
+4
-4
未找到文件。
src/vs/workbench/services/search/common/search.ts
浏览文件 @
809ccf9a
...
...
@@ -181,13 +181,19 @@ export function resultIsMatch(result: ITextSearchResult): result is ITextSearchM
return
!!
(
<
ITextSearchMatch
>
result
).
preview
;
}
export
interface
IProgress
{
total
?:
number
;
worked
?:
number
;
export
interface
IProgressMessage
{
message
?:
string
;
}
export
type
ISearchProgressItem
=
IFileMatch
|
IProgress
;
export
type
ISearchProgressItem
=
IFileMatch
|
IProgressMessage
;
export
function
isFileMatch
(
p
:
ISearchProgressItem
):
p
is
IFileMatch
{
return
!!
(
<
IFileMatch
>
p
).
resource
;
}
export
function
isProgressMessage
(
p
:
ISearchProgressItem
):
p
is
IProgressMessage
{
return
!
isFileMatch
(
p
);
}
export
interface
ISearchCompleteStats
{
limitHit
?:
boolean
;
...
...
@@ -410,7 +416,7 @@ export interface IRawFileMatch {
}
export
interface
ISearchEngine
<
T
>
{
search
:
(
onResult
:
(
matches
:
T
)
=>
void
,
onProgress
:
(
progress
:
IProgress
)
=>
void
,
done
:
(
error
:
Error
|
null
,
complete
:
ISearchEngineSuccess
)
=>
void
)
=>
void
;
search
:
(
onResult
:
(
matches
:
T
)
=>
void
,
onProgress
:
(
progress
:
IProgress
Message
)
=>
void
,
done
:
(
error
:
Error
|
null
,
complete
:
ISearchEngineSuccess
)
=>
void
)
=>
void
;
cancel
:
()
=>
void
;
}
...
...
@@ -460,8 +466,8 @@ export interface ISerializedFileMatch {
}
// Type of the possible values for progress calls from the engine
export
type
ISerializedSearchProgressItem
=
ISerializedFileMatch
|
ISerializedFileMatch
[]
|
IProgress
;
export
type
IFileSearchProgressItem
=
IRawFileMatch
|
IRawFileMatch
[]
|
IProgress
;
export
type
ISerializedSearchProgressItem
=
ISerializedFileMatch
|
ISerializedFileMatch
[]
|
IProgress
Message
;
export
type
IFileSearchProgressItem
=
IRawFileMatch
|
IRawFileMatch
[]
|
IProgress
Message
;
export
class
SerializableFileMatch
implements
ISerializedFileMatch
{
...
...
src/vs/workbench/services/search/node/fileSearch.ts
浏览文件 @
809ccf9a
...
...
@@ -21,7 +21,7 @@ import * as types from 'vs/base/common/types';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
extfs
from
'
vs/base/node/extfs
'
;
import
*
as
flow
from
'
vs/base/node/flow
'
;
import
{
IFileQuery
,
IFolderQuery
,
IProgress
,
ISearchEngineStats
,
IRawFileMatch
,
ISearchEngine
,
ISearchEngineSuccess
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IFileQuery
,
IFolderQuery
,
IProgress
Message
,
ISearchEngineStats
,
IRawFileMatch
,
ISearchEngine
,
ISearchEngineSuccess
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
spawnRipgrepCmd
}
from
'
./ripgrepFileSearch
'
;
interface
IDirectoryEntry
{
...
...
@@ -106,7 +106,7 @@ export class FileWalker {
this
.
isCanceled
=
true
;
}
walk
(
folderQueries
:
IFolderQuery
[],
extraFiles
:
URI
[],
onResult
:
(
result
:
IRawFileMatch
)
=>
void
,
onMessage
:
(
message
:
IProgress
)
=>
void
,
done
:
(
error
:
Error
|
null
,
isLimitHit
:
boolean
)
=>
void
):
void
{
walk
(
folderQueries
:
IFolderQuery
[],
extraFiles
:
URI
[],
onResult
:
(
result
:
IRawFileMatch
)
=>
void
,
onMessage
:
(
message
:
IProgress
Message
)
=>
void
,
done
:
(
error
:
Error
|
null
,
isLimitHit
:
boolean
)
=>
void
):
void
{
this
.
fileWalkSW
=
StopWatch
.
create
(
false
);
// Support that the file pattern is a full path to a file that exists
...
...
@@ -154,7 +154,7 @@ export class FileWalker {
}
}
private
cmdTraversal
(
folderQuery
:
IFolderQuery
,
onResult
:
(
result
:
IRawFileMatch
)
=>
void
,
onMessage
:
(
message
:
IProgress
)
=>
void
,
cb
:
(
err
?:
Error
)
=>
void
):
void
{
private
cmdTraversal
(
folderQuery
:
IFolderQuery
,
onResult
:
(
result
:
IRawFileMatch
)
=>
void
,
onMessage
:
(
message
:
IProgress
Message
)
=>
void
,
cb
:
(
err
?:
Error
)
=>
void
):
void
{
const
rootFolder
=
folderQuery
.
folder
.
fsPath
;
const
isMac
=
platform
.
isMacintosh
;
let
cmd
:
childProcess
.
ChildProcess
;
...
...
@@ -285,7 +285,7 @@ export class FileWalker {
});
}
private
collectStdout
(
cmd
:
childProcess
.
ChildProcess
,
encoding
:
string
,
onMessage
:
(
message
:
IProgress
)
=>
void
,
cb
:
(
err
:
Error
|
null
,
stdout
?:
string
,
last
?:
boolean
)
=>
void
):
void
{
private
collectStdout
(
cmd
:
childProcess
.
ChildProcess
,
encoding
:
string
,
onMessage
:
(
message
:
IProgress
Message
)
=>
void
,
cb
:
(
err
:
Error
|
null
,
stdout
?:
string
,
last
?:
boolean
)
=>
void
):
void
{
let
onData
=
(
err
:
Error
|
null
,
stdout
?:
string
,
last
?:
boolean
)
=>
{
if
(
err
||
last
)
{
onData
=
()
=>
{
};
...
...
@@ -590,7 +590,7 @@ export class Engine implements ISearchEngine<IRawFileMatch> {
this
.
walker
=
new
FileWalker
(
config
);
}
search
(
onResult
:
(
result
:
IRawFileMatch
)
=>
void
,
onProgress
:
(
progress
:
IProgress
)
=>
void
,
done
:
(
error
:
Error
,
complete
:
ISearchEngineSuccess
)
=>
void
):
void
{
search
(
onResult
:
(
result
:
IRawFileMatch
)
=>
void
,
onProgress
:
(
progress
:
IProgress
Message
)
=>
void
,
done
:
(
error
:
Error
,
complete
:
ISearchEngineSuccess
)
=>
void
):
void
{
this
.
walker
.
walk
(
this
.
folderQueries
,
this
.
extraFiles
,
onResult
,
onProgress
,
(
err
:
Error
,
isLimitHit
:
boolean
)
=>
{
done
(
err
,
{
limitHit
:
isLimitHit
,
...
...
src/vs/workbench/services/search/node/fileSearchManager.ts
浏览文件 @
809ccf9a
...
...
@@ -344,7 +344,7 @@ export class FileSearchManager {
engine
.
cancel
();
});
const
_onResult
=
match
=>
{
const
_onResult
=
(
match
:
IInternalFileMatch
)
=>
{
if
(
match
)
{
batch
.
push
(
match
);
if
(
batchSize
>
0
&&
batch
.
length
>=
batchSize
)
{
...
...
src/vs/workbench/services/search/node/rawSearchService.ts
浏览文件 @
809ccf9a
...
...
@@ -17,14 +17,14 @@ import * as strings from 'vs/base/common/strings';
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
compareItemsByScore
,
IItemAccessor
,
prepareQuery
,
ScorerCache
}
from
'
vs/base/parts/quickopen/common/quickOpenScorer
'
;
import
{
MAX_FILE_SIZE
}
from
'
vs/platform/files/node/fileConstants
'
;
import
{
ICachedSearchStats
,
IFileQuery
,
IFileSearchStats
,
IFolderQuery
,
IProgress
,
IRawFileQuery
,
IRawQuery
,
IRawTextQuery
,
ITextQuery
,
IFileSearchProgressItem
,
IRawFileMatch
,
IRawSearchService
,
ISearchEngine
,
ISearchEngineSuccess
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
ISerializedSearchSuccess
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
ICachedSearchStats
,
IFileQuery
,
IFileSearchStats
,
IFolderQuery
,
IProgress
Message
,
IRawFileQuery
,
IRawQuery
,
IRawTextQuery
,
ITextQuery
,
IFileSearchProgressItem
,
IRawFileMatch
,
IRawSearchService
,
ISearchEngine
,
ISearchEngineSuccess
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
ISerializedSearchSuccess
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
Engine
as
FileSearchEngine
}
from
'
vs/workbench/services/search/node/fileSearch
'
;
import
{
TextSearchEngineAdapter
}
from
'
vs/workbench/services/search/node/textSearchAdapter
'
;
gracefulFs
.
gracefulify
(
fs
);
type
IProgressCallback
=
(
p
:
ISerializedSearchProgressItem
)
=>
void
;
type
IFileProgressCallback
=
(
p
:
IFileSearchProgressItem
)
=>
void
;
export
type
IProgressCallback
=
(
p
:
ISerializedSearchProgressItem
)
=>
void
;
export
type
IFileProgressCallback
=
(
p
:
IFileSearchProgressItem
)
=>
void
;
export
class
SearchService
implements
IRawSearchService
{
...
...
@@ -97,7 +97,7 @@ export class SearchService implements IRawSearchService {
resultCount
++
;
progressCallback
(
this
.
rawMatchToSearchItem
(
<
IRawFileMatch
>
progress
));
}
else
{
progressCallback
(
<
IProgress
>
progress
);
progressCallback
(
<
IProgress
Message
>
progress
);
}
};
...
...
@@ -383,13 +383,13 @@ export class SearchService implements IRawSearchService {
cancel
()
{
// Do nothing
}
then
(
resolve
,
reject
)
{
then
(
resolve
:
any
,
reject
:
any
)
{
return
promise
.
then
(
resolve
,
reject
);
}
catch
(
reject
?)
{
catch
(
reject
?
:
any
)
{
return
this
.
then
(
undefined
,
reject
);
}
finally
(
onFinally
)
{
finally
(
onFinally
:
any
)
{
return
promise
.
finally
(
onFinally
);
}
};
...
...
src/vs/workbench/services/search/node/ripgrepSearchUtils.ts
浏览文件 @
809ccf9a
...
...
@@ -42,7 +42,7 @@ function searchRangeToRange(range: SearchRange): Range {
}
export
class
Position
{
constructor
(
readonly
line
,
readonly
charact
er
)
{
}
constructor
(
readonly
line
:
number
,
readonly
character
:
numb
er
)
{
}
isBefore
(
other
:
Position
):
boolean
{
return
false
;
}
isBeforeOrEqual
(
other
:
Position
):
boolean
{
return
false
;
}
...
...
src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts
浏览文件 @
809ccf9a
...
...
@@ -165,10 +165,11 @@ export class RipgrepParser extends EventEmitter {
}
on
(
event
:
'
result
'
,
listener
:
(
result
:
vscode
.
TextSearchResult
)
=>
void
);
on
(
event
:
'
hitLimit
'
,
listener
:
()
=>
void
);
on
(
event
:
string
,
listener
:
(...
args
:
any
[])
=>
void
)
{
on
(
event
:
'
result
'
,
listener
:
(
result
:
vscode
.
TextSearchResult
)
=>
void
)
:
this
;
on
(
event
:
'
hitLimit
'
,
listener
:
()
=>
void
)
:
this
;
on
(
event
:
string
,
listener
:
(...
args
:
any
[])
=>
void
)
:
this
{
super
.
on
(
event
,
listener
);
return
this
;
}
handleData
(
data
:
Buffer
|
string
):
void
{
...
...
src/vs/workbench/services/search/node/searchService.ts
浏览文件 @
809ccf9a
...
...
@@ -26,7 +26,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
deserializeSearchError
,
FileMatch
,
ICachedSearchStats
,
IFileMatch
,
IFileQuery
,
IFileSearchStats
,
IFolderQuery
,
IProgress
,
IRawSearchService
,
ISearchComplete
,
ISearchConfiguration
,
ISearchEngineStats
,
ISearchProgressItem
,
ISearchQuery
,
ISearchResultProvider
,
ISearchService
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
isSerializedSearchComplete
,
isSerializedSearchSuccess
,
ITextQuery
,
pathIncludedInQuery
,
QueryType
,
SearchError
,
SearchErrorCode
,
SearchProviderTyp
e
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
deserializeSearchError
,
FileMatch
,
ICachedSearchStats
,
IFileMatch
,
IFileQuery
,
IFileSearchStats
,
IFolderQuery
,
IProgress
Message
,
IRawSearchService
,
ISearchComplete
,
ISearchConfiguration
,
ISearchEngineStats
,
ISearchProgressItem
,
ISearchQuery
,
ISearchResultProvider
,
ISearchService
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
isSerializedSearchComplete
,
isSerializedSearchSuccess
,
ITextQuery
,
pathIncludedInQuery
,
QueryType
,
SearchError
,
SearchErrorCode
,
SearchProviderType
,
isFileMatch
,
isProgressMessag
e
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
addContextToEditorMatches
,
editorMatchesToTextSearchResults
}
from
'
vs/workbench/services/search/common/searchHelpers
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
SearchChannelClient
}
from
'
./searchIpc
'
;
...
...
@@ -78,18 +78,18 @@ export class SearchService extends Disposable implements ISearchService {
arrays
.
coalesce
(
localResults
.
values
()).
forEach
(
onProgress
);
}
const
onProviderProgress
=
progress
=>
{
if
(
progress
.
resource
)
{
const
onProviderProgress
=
(
progress
:
ISearchProgressItem
)
=>
{
if
(
isFileMatch
(
progress
)
)
{
// Match
if
(
!
localResults
.
has
(
progress
.
resource
)
&&
onProgress
)
{
// don't override local results
onProgress
(
progress
);
}
}
else
if
(
onProgress
)
{
// Progress
onProgress
(
<
IProgress
>
progress
);
onProgress
(
<
IProgress
Message
>
progress
);
}
if
(
progress
.
message
)
{
if
(
isProgressMessage
(
progress
)
)
{
this
.
logService
.
debug
(
'
SearchService#search
'
,
progress
.
message
);
}
};
...
...
@@ -142,7 +142,7 @@ export class SearchService extends Disposable implements ISearchService {
return
<
ISearchComplete
>
{
limitHit
:
completes
[
0
]
&&
completes
[
0
].
limitHit
,
stats
:
completes
[
0
].
stats
,
results
:
arrays
.
flatten
(
completes
.
map
(
c
=>
c
.
results
))
results
:
arrays
.
flatten
(
completes
.
map
(
(
c
:
ISearchComplete
)
=>
c
.
results
))
};
});
...
...
@@ -497,7 +497,7 @@ export class DiskSearch implements ISearchResultProvider {
let
event
:
Event
<
ISerializedSearchProgressItem
|
ISerializedSearchComplete
>
;
event
=
this
.
raw
.
fileSearch
(
query
);
const
onProgress
=
(
p
:
IProgress
)
=>
{
const
onProgress
=
(
p
:
IProgress
Message
)
=>
{
if
(
p
.
message
)
{
// Should only be for logs
this
.
logService
.
debug
(
'
SearchService#search
'
,
p
.
message
);
...
...
@@ -561,7 +561,7 @@ export class DiskSearch implements ISearchResultProvider {
// Progress
else
if
(
onProgress
)
{
onProgress
(
<
IProgress
>
ev
);
onProgress
(
<
IProgress
Message
>
ev
);
}
}
});
...
...
src/vs/workbench/services/search/node/textSearchAdapter.ts
浏览文件 @
809ccf9a
...
...
@@ -5,7 +5,7 @@
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
*
as
extfs
from
'
vs/base/node/extfs
'
;
import
{
IFileMatch
,
IProgress
,
ITextQuery
,
ITextSearchStats
,
ITextSearchMatch
,
ISerializedFileMatch
,
ISerializedSearchSuccess
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IFileMatch
,
IProgress
Message
,
ITextQuery
,
ITextSearchStats
,
ITextSearchMatch
,
ISerializedFileMatch
,
ISerializedSearchSuccess
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
RipgrepTextSearchEngine
}
from
'
vs/workbench/services/search/node/ripgrepTextSearchEngine
'
;
import
{
TextSearchManager
}
from
'
vs/workbench/services/search/node/textSearchManager
'
;
...
...
@@ -14,7 +14,7 @@ export class TextSearchEngineAdapter {
constructor
(
private
query
:
ITextQuery
)
{
}
search
(
token
:
CancellationToken
,
onResult
:
(
matches
:
ISerializedFileMatch
[])
=>
void
,
onMessage
:
(
message
:
IProgress
)
=>
void
):
Promise
<
ISerializedSearchSuccess
>
{
search
(
token
:
CancellationToken
,
onResult
:
(
matches
:
ISerializedFileMatch
[])
=>
void
,
onMessage
:
(
message
:
IProgress
Message
)
=>
void
):
Promise
<
ISerializedSearchSuccess
>
{
if
((
!
this
.
query
.
folderQueries
||
!
this
.
query
.
folderQueries
.
length
)
&&
(
!
this
.
query
.
extraFileResources
||
!
this
.
query
.
extraFileResources
.
length
))
{
return
Promise
.
resolve
(
<
ISerializedSearchSuccess
>
{
type
:
'
success
'
,
...
...
@@ -26,7 +26,7 @@ export class TextSearchEngineAdapter {
}
const
pretendOutputChannel
=
{
appendLine
(
msg
)
{
appendLine
(
msg
:
string
)
{
onMessage
({
message
:
msg
});
}
};
...
...
src/vs/workbench/services/search/test/node/rawSearchService.test.ts
浏览文件 @
809ccf9a
...
...
@@ -4,13 +4,13 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
{
getPathFromAmdModule
}
from
'
vs/base/common/amd
'
;
import
{
CancelablePromise
,
createCancelablePromise
}
from
'
vs/base/common/async
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IFile
Query
,
IFileSearchStats
,
IFolderQuery
,
IProgress
,
ISearchEngineStats
,
QueryType
,
IRawFileMatch
,
ISearchEngine
,
ISearchEngineSuccess
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
ISerializedSearchSuccess
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
SearchService
as
RawSearchService
}
from
'
vs/workbench/services/search/node/rawSearchService
'
;
import
{
IFile
Match
,
IFileQuery
,
IFileSearchStats
,
IFolderQuery
,
IProgressMessage
,
IRawFileMatch
,
ISearchEngine
,
ISearchEngineStats
,
ISearchEngineSuccess
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
ISerializedSearchSuccess
,
QueryType
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IProgressCallback
,
SearchService
as
RawSearchService
}
from
'
vs/workbench/services/search/node/rawSearchService
'
;
import
{
DiskSearch
}
from
'
vs/workbench/services/search/node/searchService
'
;
const
TEST_FOLDER_QUERIES
=
[
...
...
@@ -40,7 +40,7 @@ class TestSearchEngine implements ISearchEngine<IRawFileMatch> {
TestSearchEngine
.
last
=
this
;
}
search
(
onResult
:
(
match
:
IRawFileMatch
)
=>
void
,
onProgress
:
(
progress
:
IProgress
)
=>
void
,
done
:
(
error
:
Error
,
complete
:
ISearchEngineSuccess
)
=>
void
):
void
{
search
(
onResult
:
(
match
:
IRawFileMatch
)
=>
void
,
onProgress
:
(
progress
:
IProgress
Message
)
=>
void
,
done
:
(
error
:
Error
,
complete
:
ISearchEngineSuccess
)
=>
void
):
void
{
const
self
=
this
;
(
function
next
()
{
process
.
nextTick
(()
=>
{
...
...
@@ -157,7 +157,7 @@ suite('RawSearchService', () => {
}
const
progressResults
:
any
[]
=
[];
const
onProgress
=
match
=>
{
const
onProgress
=
(
match
:
IFileMatch
)
=>
{
assert
.
strictEqual
(
match
.
resource
.
path
,
uriPath
);
progressResults
.
push
(
match
);
};
...
...
@@ -217,7 +217,7 @@ suite('RawSearchService', () => {
const
service
=
new
RawSearchService
();
const
results
:
any
[]
=
[];
const
cb
=
value
=>
{
const
cb
:
IProgressCallback
=
value
=>
{
if
(
Array
.
isArray
(
value
))
{
results
.
push
(...
value
.
map
(
v
=>
v
.
path
));
}
else
{
...
...
@@ -243,7 +243,7 @@ suite('RawSearchService', () => {
const
service
=
new
RawSearchService
();
const
results
:
number
[]
=
[];
const
cb
=
value
=>
{
const
cb
:
IProgressCallback
=
value
=>
{
if
(
Array
.
isArray
(
value
))
{
value
.
forEach
(
m
=>
{
assert
.
deepStrictEqual
(
m
,
match
);
...
...
@@ -276,7 +276,7 @@ suite('RawSearchService', () => {
const
service
=
new
RawSearchService
();
const
results
:
any
[]
=
[];
const
cb
=
value
=>
{
const
cb
:
IProgressCallback
=
value
=>
{
if
(
Array
.
isArray
(
value
))
{
results
.
push
(...
value
.
map
(
v
=>
v
.
path
));
}
else
{
...
...
@@ -294,7 +294,7 @@ suite('RawSearchService', () => {
assert
.
deepStrictEqual
(
results
,
[
path
.
normalize
(
'
/some/where/bcb
'
),
path
.
normalize
(
'
/some/where/bbc
'
),
path
.
normalize
(
'
/some/where/aab
'
)]);
}).
then
(
async
()
=>
{
const
results
:
any
[]
=
[];
const
cb
=
value
=>
{
const
cb
:
IProgressCallback
=
value
=>
{
if
(
Array
.
isArray
(
value
))
{
results
.
push
(...
value
.
map
(
v
=>
v
.
path
));
}
else
{
...
...
@@ -323,7 +323,7 @@ suite('RawSearchService', () => {
size
:
3
});
const
results
:
any
[]
=
[];
const
cb
=
value
=>
{
const
cb
:
IProgressCallback
=
value
=>
{
if
(
Array
.
isArray
(
value
))
{
results
.
push
(...
value
.
map
(
v
=>
v
.
path
));
}
else
{
...
...
src/vs/workbench/services/search/test/node/ripgrepTextSearchEngine.test.ts
浏览文件 @
809ccf9a
...
...
@@ -42,7 +42,7 @@ suite('RipgrepTextSearchEngine', () => {
});
test
(
'
fixRegexCRMatchingWhitespaceClass
'
,
()
=>
{
function
testFixRegexCRMatchingWhitespaceClass
([
inputReg
,
isMultiline
,
testStr
,
shouldMatch
]):
void
{
function
testFixRegexCRMatchingWhitespaceClass
([
inputReg
,
isMultiline
,
testStr
,
shouldMatch
]
:
[
string
,
boolean
,
string
,
boolean
]
):
void
{
const
fixed
=
fixRegexCRMatchingWhitespaceClass
(
inputReg
,
isMultiline
);
const
reg
=
new
RegExp
(
fixed
);
assert
.
equal
(
reg
.
test
(
testStr
),
shouldMatch
,
`
${
inputReg
}
=>
${
reg
}
,
${
testStr
}
,
${
shouldMatch
}
`
);
...
...
@@ -66,7 +66,7 @@ suite('RipgrepTextSearchEngine', () => {
});
test
(
'
fixRegexCRMatchingNonWordClass
'
,
()
=>
{
function
testRegexCRMatchingNonWordClass
([
inputReg
,
isMultiline
,
testStr
,
shouldMatch
]):
void
{
function
testRegexCRMatchingNonWordClass
([
inputReg
,
isMultiline
,
testStr
,
shouldMatch
]
:
[
string
,
boolean
,
string
,
boolean
]
):
void
{
const
fixed
=
fixRegexCRMatchingNonWordClass
(
inputReg
,
isMultiline
);
const
reg
=
new
RegExp
(
fixed
);
assert
.
equal
(
reg
.
test
(
testStr
),
shouldMatch
,
`
${
inputReg
}
=>
${
reg
}
,
${
testStr
}
,
${
shouldMatch
}
`
);
...
...
@@ -90,7 +90,7 @@ suite('RipgrepTextSearchEngine', () => {
});
test
(
'
fixRegexNewline
'
,
()
=>
{
function
testFixRegexNewline
([
inputReg
,
testStr
,
shouldMatch
]):
void
{
function
testFixRegexNewline
([
inputReg
,
testStr
,
shouldMatch
]
:
[
string
,
string
,
boolean
]
):
void
{
const
fixed
=
fixRegexNewline
(
inputReg
);
const
reg
=
new
RegExp
(
fixed
);
assert
.
equal
(
reg
.
test
(
testStr
),
shouldMatch
,
`
${
inputReg
}
=>
${
reg
}
,
${
testStr
}
,
${
shouldMatch
}
`
);
...
...
@@ -111,7 +111,7 @@ suite('RipgrepTextSearchEngine', () => {
});
test
(
'
fixNewline
'
,
()
=>
{
function
testFixNewline
([
inputReg
,
testStr
,
shouldMatch
=
true
]):
void
{
function
testFixNewline
([
inputReg
,
testStr
,
shouldMatch
=
true
]
:
[
string
,
string
,
boolean
]
):
void
{
const
fixed
=
fixNewline
(
inputReg
);
const
reg
=
new
RegExp
(
fixed
);
assert
.
equal
(
reg
.
test
(
testStr
),
shouldMatch
,
`
${
inputReg
}
=>
${
reg
}
,
${
testStr
}
,
${
shouldMatch
}
`
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录