Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bf5e12e9
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 搜索 >>
未验证
提交
bf5e12e9
编写于
3月 08, 2019
作者:
S
SteVen Batten
提交者:
GitHub
3月 08, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
consolidate search into common (#69614)
上级
85d98339
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
206 addition
and
225 deletion
+206
-225
src/vs/workbench/api/node/extHostSearch.ts
src/vs/workbench/api/node/extHostSearch.ts
+1
-2
src/vs/workbench/services/search/common/search.ts
src/vs/workbench/services/search/common/search.ts
+195
-0
src/vs/workbench/services/search/node/fileSearch.ts
src/vs/workbench/services/search/node/fileSearch.ts
+1
-2
src/vs/workbench/services/search/node/fileSearchManager.ts
src/vs/workbench/services/search/node/fileSearchManager.ts
+1
-2
src/vs/workbench/services/search/node/rawSearchService.ts
src/vs/workbench/services/search/node/rawSearchService.ts
+1
-2
src/vs/workbench/services/search/node/search.ts
src/vs/workbench/services/search/node/search.ts
+0
-203
src/vs/workbench/services/search/node/searchIpc.ts
src/vs/workbench/services/search/node/searchIpc.ts
+1
-2
src/vs/workbench/services/search/node/searchService.ts
src/vs/workbench/services/search/node/searchService.ts
+1
-2
src/vs/workbench/services/search/node/textSearchAdapter.ts
src/vs/workbench/services/search/node/textSearchAdapter.ts
+1
-2
src/vs/workbench/services/search/node/textSearchManager.ts
src/vs/workbench/services/search/node/textSearchManager.ts
+1
-2
src/vs/workbench/services/search/test/node/rawSearchService.test.ts
...kbench/services/search/test/node/rawSearchService.test.ts
+1
-2
src/vs/workbench/services/search/test/node/search.test.ts
src/vs/workbench/services/search/test/node/search.test.ts
+1
-2
src/vs/workbench/services/search/test/node/textSearch.integrationTest.ts
...h/services/search/test/node/textSearch.integrationTest.ts
+1
-2
未找到文件。
src/vs/workbench/api/node/extHostSearch.ts
浏览文件 @
bf5e12e9
...
...
@@ -8,12 +8,11 @@ import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
*
as
extfs
from
'
vs/base/node/extfs
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IFileQuery
,
IFolderQuery
,
IRawFileQuery
,
IRawQuery
,
IRawTextQuery
,
ISearchCompleteStats
,
ITextQuery
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IFileQuery
,
IFolderQuery
,
IRawFileQuery
,
IRawQuery
,
IRawTextQuery
,
ISearchCompleteStats
,
ITextQuery
,
isSerializedFileMatch
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
FileSearchManager
}
from
'
vs/workbench/services/search/node/fileSearchManager
'
;
import
{
SearchService
}
from
'
vs/workbench/services/search/node/rawSearchService
'
;
import
{
RipgrepSearchProvider
}
from
'
vs/workbench/services/search/node/ripgrepSearchProvider
'
;
import
{
OutputChannel
}
from
'
vs/workbench/services/search/node/ripgrepSearchUtils
'
;
import
{
isSerializedFileMatch
}
from
'
vs/workbench/services/search/node/search
'
;
import
{
TextSearchManager
}
from
'
vs/workbench/services/search/node/textSearchManager
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
ExtHostSearchShape
,
IMainContext
,
MainContext
,
MainThreadSearchShape
}
from
'
./extHost.protocol
'
;
...
...
src/vs/workbench/services/search/common/search.ts
浏览文件 @
bf5e12e9
...
...
@@ -13,6 +13,8 @@ import { getNLines } from 'vs/base/common/strings';
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
IFilesConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
export
const
VIEW_ID
=
'
workbench.view.search
'
;
...
...
@@ -381,3 +383,196 @@ export function serializeSearchError(searchError: SearchError): Error {
const
details
=
{
message
:
searchError
.
message
,
code
:
searchError
.
code
};
return
new
Error
(
JSON
.
stringify
(
details
));
}
export
interface
ITelemetryEvent
{
eventName
:
string
;
data
:
ITelemetryData
;
}
export
interface
IRawSearchService
{
fileSearch
(
search
:
IRawFileQuery
):
Event
<
ISerializedSearchProgressItem
|
ISerializedSearchComplete
>
;
textSearch
(
search
:
IRawTextQuery
):
Event
<
ISerializedSearchProgressItem
|
ISerializedSearchComplete
>
;
clearCache
(
cacheKey
:
string
):
Promise
<
void
>
;
}
export
interface
IRawFileMatch
{
base
?:
string
;
relativePath
:
string
;
basename
:
string
;
size
?:
number
;
}
export
interface
ISearchEngine
<
T
>
{
search
:
(
onResult
:
(
matches
:
T
)
=>
void
,
onProgress
:
(
progress
:
IProgress
)
=>
void
,
done
:
(
error
:
Error
|
null
,
complete
:
ISearchEngineSuccess
)
=>
void
)
=>
void
;
cancel
:
()
=>
void
;
}
export
interface
ISerializedSearchSuccess
{
type
:
'
success
'
;
limitHit
:
boolean
;
stats
:
IFileSearchStats
|
ITextSearchStats
|
null
;
}
export
interface
ISearchEngineSuccess
{
limitHit
:
boolean
;
stats
:
ISearchEngineStats
;
}
export
interface
ISerializedSearchError
{
type
:
'
error
'
;
error
:
{
message
:
string
,
stack
:
string
};
}
export
type
ISerializedSearchComplete
=
ISerializedSearchSuccess
|
ISerializedSearchError
;
export
function
isSerializedSearchComplete
(
arg
:
ISerializedSearchProgressItem
|
ISerializedSearchComplete
):
arg
is
ISerializedSearchComplete
{
if
((
arg
as
any
).
type
===
'
error
'
)
{
return
true
;
}
else
if
((
arg
as
any
).
type
===
'
success
'
)
{
return
true
;
}
else
{
return
false
;
}
}
export
function
isSerializedSearchSuccess
(
arg
:
ISerializedSearchComplete
):
arg
is
ISerializedSearchSuccess
{
return
arg
.
type
===
'
success
'
;
}
export
function
isSerializedFileMatch
(
arg
:
ISerializedSearchProgressItem
):
arg
is
ISerializedFileMatch
{
return
!!
(
<
ISerializedFileMatch
>
arg
).
path
;
}
export
interface
ISerializedFileMatch
{
path
?:
string
;
results
?:
ITextSearchResult
[];
numMatches
?:
number
;
}
// Type of the possible values for progress calls from the engine
export
type
ISerializedSearchProgressItem
=
ISerializedFileMatch
|
ISerializedFileMatch
[]
|
IProgress
;
export
type
IFileSearchProgressItem
=
IRawFileMatch
|
IRawFileMatch
[]
|
IProgress
;
export
class
SerializableFileMatch
implements
ISerializedFileMatch
{
path
:
string
;
results
:
ITextSearchMatch
[];
constructor
(
path
:
string
)
{
this
.
path
=
path
;
this
.
results
=
[];
}
addMatch
(
match
:
ITextSearchMatch
):
void
{
this
.
results
.
push
(
match
);
}
serialize
():
ISerializedFileMatch
{
return
{
path
:
this
.
path
,
results
:
this
.
results
,
numMatches
:
this
.
results
.
length
};
}
}
/**
* Computes the patterns that the provider handles. Discards sibling clauses and 'false' patterns
*/
export
function
resolvePatternsForProvider
(
globalPattern
:
glob
.
IExpression
|
undefined
,
folderPattern
:
glob
.
IExpression
|
undefined
):
string
[]
{
const
merged
=
{
...(
globalPattern
||
{}),
...(
folderPattern
||
{})
};
return
Object
.
keys
(
merged
)
.
filter
(
key
=>
{
const
value
=
merged
[
key
];
return
typeof
value
===
'
boolean
'
&&
value
;
});
}
export
class
QueryGlobTester
{
private
_excludeExpression
:
glob
.
IExpression
;
private
_parsedExcludeExpression
:
glob
.
ParsedExpression
;
private
_parsedIncludeExpression
:
glob
.
ParsedExpression
;
constructor
(
config
:
ISearchQuery
,
folderQuery
:
IFolderQuery
)
{
this
.
_excludeExpression
=
{
...(
config
.
excludePattern
||
{}),
...(
folderQuery
.
excludePattern
||
{})
};
this
.
_parsedExcludeExpression
=
glob
.
parse
(
this
.
_excludeExpression
);
// Empty includeExpression means include nothing, so no {} shortcuts
let
includeExpression
:
glob
.
IExpression
|
undefined
=
config
.
includePattern
;
if
(
folderQuery
.
includePattern
)
{
if
(
includeExpression
)
{
includeExpression
=
{
...
includeExpression
,
...
folderQuery
.
includePattern
};
}
else
{
includeExpression
=
folderQuery
.
includePattern
;
}
}
if
(
includeExpression
)
{
this
.
_parsedIncludeExpression
=
glob
.
parse
(
includeExpression
);
}
}
/**
* Guaranteed sync - siblingsFn should not return a promise.
*/
includedInQuerySync
(
testPath
:
string
,
basename
?:
string
,
hasSibling
?:
(
name
:
string
)
=>
boolean
):
boolean
{
if
(
this
.
_parsedExcludeExpression
&&
this
.
_parsedExcludeExpression
(
testPath
,
basename
,
hasSibling
))
{
return
false
;
}
if
(
this
.
_parsedIncludeExpression
&&
!
this
.
_parsedIncludeExpression
(
testPath
,
basename
,
hasSibling
))
{
return
false
;
}
return
true
;
}
/**
* Guaranteed async.
*/
includedInQuery
(
testPath
:
string
,
basename
?:
string
,
hasSibling
?:
(
name
:
string
)
=>
boolean
|
Promise
<
boolean
>
):
Promise
<
boolean
>
{
const
excludeP
=
this
.
_parsedExcludeExpression
?
Promise
.
resolve
(
this
.
_parsedExcludeExpression
(
testPath
,
basename
,
hasSibling
)).
then
(
result
=>
!!
result
)
:
Promise
.
resolve
(
false
);
return
excludeP
.
then
(
excluded
=>
{
if
(
excluded
)
{
return
false
;
}
return
this
.
_parsedIncludeExpression
?
Promise
.
resolve
(
this
.
_parsedIncludeExpression
(
testPath
,
basename
,
hasSibling
)).
then
(
result
=>
!!
result
)
:
Promise
.
resolve
(
true
);
}).
then
(
included
=>
{
return
included
;
});
}
hasSiblingExcludeClauses
():
boolean
{
return
hasSiblingClauses
(
this
.
_excludeExpression
);
}
}
function
hasSiblingClauses
(
pattern
:
glob
.
IExpression
):
boolean
{
for
(
const
key
in
pattern
)
{
if
(
typeof
pattern
[
key
]
!==
'
boolean
'
)
{
return
true
;
}
}
return
false
;
}
src/vs/workbench/services/search/node/fileSearch.ts
浏览文件 @
bf5e12e9
...
...
@@ -21,8 +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
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IRawFileMatch
,
ISearchEngine
,
ISearchEngineSuccess
}
from
'
vs/workbench/services/search/node/search
'
;
import
{
IFileQuery
,
IFolderQuery
,
IProgress
,
ISearchEngineStats
,
IRawFileMatch
,
ISearchEngine
,
ISearchEngineSuccess
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
spawnRipgrepCmd
}
from
'
./ripgrepFileSearch
'
;
interface
IDirectoryEntry
{
...
...
src/vs/workbench/services/search/node/fileSearchManager.ts
浏览文件 @
bf5e12e9
...
...
@@ -10,8 +10,7 @@ import * as glob from 'vs/base/common/glob';
import
*
as
resources
from
'
vs/base/common/resources
'
;
import
{
StopWatch
}
from
'
vs/base/common/stopwatch
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IFileMatch
,
IFileSearchProviderStats
,
IFolderQuery
,
ISearchCompleteStats
,
IFileQuery
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
QueryGlobTester
,
resolvePatternsForProvider
}
from
'
vs/workbench/services/search/node/search
'
;
import
{
IFileMatch
,
IFileSearchProviderStats
,
IFolderQuery
,
ISearchCompleteStats
,
IFileQuery
,
QueryGlobTester
,
resolvePatternsForProvider
}
from
'
vs/workbench/services/search/common/search
'
;
import
*
as
vscode
from
'
vscode
'
;
export
interface
IInternalFileMatch
{
...
...
src/vs/workbench/services/search/node/rawSearchService.ts
浏览文件 @
bf5e12e9
...
...
@@ -17,10 +17,9 @@ 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/files
'
;
import
{
ICachedSearchStats
,
IFileQuery
,
IFileSearchStats
,
IFolderQuery
,
IProgress
,
IRawFileQuery
,
IRawQuery
,
IRawTextQuery
,
ITextQuery
}
from
'
vs/workbench/services/search/common/search
'
;
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
{
Engine
as
FileSearchEngine
}
from
'
vs/workbench/services/search/node/fileSearch
'
;
import
{
TextSearchEngineAdapter
}
from
'
vs/workbench/services/search/node/textSearchAdapter
'
;
import
{
IFileSearchProgressItem
,
IRawFileMatch
,
IRawSearchService
,
ISearchEngine
,
ISearchEngineSuccess
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
ISerializedSearchSuccess
}
from
'
./search
'
;
gracefulFs
.
gracefulify
(
fs
);
...
...
src/vs/workbench/services/search/node/search.ts
已删除
100644 → 0
浏览文件 @
85d98339
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Event
}
from
'
vs/base/common/event
'
;
import
*
as
glob
from
'
vs/base/common/glob
'
;
import
{
IFileSearchStats
,
IFolderQuery
,
IProgress
,
IRawFileQuery
,
IRawTextQuery
,
ISearchEngineStats
,
ISearchQuery
,
ITextSearchMatch
,
ITextSearchStats
,
ITextSearchResult
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
export
interface
ITelemetryEvent
{
eventName
:
string
;
data
:
ITelemetryData
;
}
export
interface
IRawSearchService
{
fileSearch
(
search
:
IRawFileQuery
):
Event
<
ISerializedSearchProgressItem
|
ISerializedSearchComplete
>
;
textSearch
(
search
:
IRawTextQuery
):
Event
<
ISerializedSearchProgressItem
|
ISerializedSearchComplete
>
;
clearCache
(
cacheKey
:
string
):
Promise
<
void
>
;
}
export
interface
IRawFileMatch
{
base
?:
string
;
relativePath
:
string
;
basename
:
string
;
size
?:
number
;
}
export
interface
ISearchEngine
<
T
>
{
search
:
(
onResult
:
(
matches
:
T
)
=>
void
,
onProgress
:
(
progress
:
IProgress
)
=>
void
,
done
:
(
error
:
Error
|
null
,
complete
:
ISearchEngineSuccess
)
=>
void
)
=>
void
;
cancel
:
()
=>
void
;
}
export
interface
ISerializedSearchSuccess
{
type
:
'
success
'
;
limitHit
:
boolean
;
stats
:
IFileSearchStats
|
ITextSearchStats
|
null
;
}
export
interface
ISearchEngineSuccess
{
limitHit
:
boolean
;
stats
:
ISearchEngineStats
;
}
export
interface
ISerializedSearchError
{
type
:
'
error
'
;
error
:
{
message
:
string
,
stack
:
string
};
}
export
type
ISerializedSearchComplete
=
ISerializedSearchSuccess
|
ISerializedSearchError
;
export
function
isSerializedSearchComplete
(
arg
:
ISerializedSearchProgressItem
|
ISerializedSearchComplete
):
arg
is
ISerializedSearchComplete
{
if
((
arg
as
any
).
type
===
'
error
'
)
{
return
true
;
}
else
if
((
arg
as
any
).
type
===
'
success
'
)
{
return
true
;
}
else
{
return
false
;
}
}
export
function
isSerializedSearchSuccess
(
arg
:
ISerializedSearchComplete
):
arg
is
ISerializedSearchSuccess
{
return
arg
.
type
===
'
success
'
;
}
export
function
isSerializedFileMatch
(
arg
:
ISerializedSearchProgressItem
):
arg
is
ISerializedFileMatch
{
return
!!
(
<
ISerializedFileMatch
>
arg
).
path
;
}
export
interface
ISerializedFileMatch
{
path
?:
string
;
results
?:
ITextSearchResult
[];
numMatches
?:
number
;
}
// Type of the possible values for progress calls from the engine
export
type
ISerializedSearchProgressItem
=
ISerializedFileMatch
|
ISerializedFileMatch
[]
|
IProgress
;
export
type
IFileSearchProgressItem
=
IRawFileMatch
|
IRawFileMatch
[]
|
IProgress
;
export
class
FileMatch
implements
ISerializedFileMatch
{
path
:
string
;
results
:
ITextSearchMatch
[];
constructor
(
path
:
string
)
{
this
.
path
=
path
;
this
.
results
=
[];
}
addMatch
(
match
:
ITextSearchMatch
):
void
{
this
.
results
.
push
(
match
);
}
serialize
():
ISerializedFileMatch
{
return
{
path
:
this
.
path
,
results
:
this
.
results
,
numMatches
:
this
.
results
.
length
};
}
}
/**
* Computes the patterns that the provider handles. Discards sibling clauses and 'false' patterns
*/
export
function
resolvePatternsForProvider
(
globalPattern
:
glob
.
IExpression
|
undefined
,
folderPattern
:
glob
.
IExpression
|
undefined
):
string
[]
{
const
merged
=
{
...(
globalPattern
||
{}),
...(
folderPattern
||
{})
};
return
Object
.
keys
(
merged
)
.
filter
(
key
=>
{
const
value
=
merged
[
key
];
return
typeof
value
===
'
boolean
'
&&
value
;
});
}
export
class
QueryGlobTester
{
private
_excludeExpression
:
glob
.
IExpression
;
private
_parsedExcludeExpression
:
glob
.
ParsedExpression
;
private
_parsedIncludeExpression
:
glob
.
ParsedExpression
;
constructor
(
config
:
ISearchQuery
,
folderQuery
:
IFolderQuery
)
{
this
.
_excludeExpression
=
{
...(
config
.
excludePattern
||
{}),
...(
folderQuery
.
excludePattern
||
{})
};
this
.
_parsedExcludeExpression
=
glob
.
parse
(
this
.
_excludeExpression
);
// Empty includeExpression means include nothing, so no {} shortcuts
let
includeExpression
:
glob
.
IExpression
|
undefined
=
config
.
includePattern
;
if
(
folderQuery
.
includePattern
)
{
if
(
includeExpression
)
{
includeExpression
=
{
...
includeExpression
,
...
folderQuery
.
includePattern
};
}
else
{
includeExpression
=
folderQuery
.
includePattern
;
}
}
if
(
includeExpression
)
{
this
.
_parsedIncludeExpression
=
glob
.
parse
(
includeExpression
);
}
}
/**
* Guaranteed sync - siblingsFn should not return a promise.
*/
includedInQuerySync
(
testPath
:
string
,
basename
?:
string
,
hasSibling
?:
(
name
:
string
)
=>
boolean
):
boolean
{
if
(
this
.
_parsedExcludeExpression
&&
this
.
_parsedExcludeExpression
(
testPath
,
basename
,
hasSibling
))
{
return
false
;
}
if
(
this
.
_parsedIncludeExpression
&&
!
this
.
_parsedIncludeExpression
(
testPath
,
basename
,
hasSibling
))
{
return
false
;
}
return
true
;
}
/**
* Guaranteed async.
*/
includedInQuery
(
testPath
:
string
,
basename
?:
string
,
hasSibling
?:
(
name
:
string
)
=>
boolean
|
Promise
<
boolean
>
):
Promise
<
boolean
>
{
const
excludeP
=
this
.
_parsedExcludeExpression
?
Promise
.
resolve
(
this
.
_parsedExcludeExpression
(
testPath
,
basename
,
hasSibling
)).
then
(
result
=>
!!
result
)
:
Promise
.
resolve
(
false
);
return
excludeP
.
then
(
excluded
=>
{
if
(
excluded
)
{
return
false
;
}
return
this
.
_parsedIncludeExpression
?
Promise
.
resolve
(
this
.
_parsedIncludeExpression
(
testPath
,
basename
,
hasSibling
)).
then
(
result
=>
!!
result
)
:
Promise
.
resolve
(
true
);
}).
then
(
included
=>
{
return
included
;
});
}
hasSiblingExcludeClauses
():
boolean
{
return
hasSiblingClauses
(
this
.
_excludeExpression
);
}
}
function
hasSiblingClauses
(
pattern
:
glob
.
IExpression
):
boolean
{
for
(
const
key
in
pattern
)
{
if
(
typeof
pattern
[
key
]
!==
'
boolean
'
)
{
return
true
;
}
}
return
false
;
}
src/vs/workbench/services/search/node/searchIpc.ts
浏览文件 @
bf5e12e9
...
...
@@ -5,8 +5,7 @@
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
IChannel
,
IServerChannel
}
from
'
vs/base/parts/ipc/node/ipc
'
;
import
{
IRawFileQuery
,
IRawTextQuery
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IRawSearchService
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
}
from
'
./search
'
;
import
{
IRawFileQuery
,
IRawTextQuery
,
IRawSearchService
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
}
from
'
vs/workbench/services/search/common/search
'
;
export
class
SearchChannel
implements
IServerChannel
{
...
...
src/vs/workbench/services/search/node/searchService.ts
浏览文件 @
bf5e12e9
...
...
@@ -20,13 +20,12 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import
{
IDebugParams
,
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
deserializeSearchError
,
FileMatch
,
ICachedSearchStats
,
IFileMatch
,
IFileQuery
,
IFileSearchStats
,
IFolderQuery
,
IProgress
,
ISearchComplete
,
ISearchEngineStats
,
ISearchProgressItem
,
ISearchQuery
,
ISearchResultProvider
,
ISearchService
,
ITextQuery
,
pathIncludedInQuery
,
QueryType
,
SearchError
,
SearchErrorCode
,
SearchProviderType
,
ISearchConfiguration
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
deserializeSearchError
,
FileMatch
,
ICachedSearchStats
,
IFileMatch
,
IFileQuery
,
IFileSearchStats
,
IFolderQuery
,
IProgress
,
ISearchComplete
,
ISearchEngineStats
,
ISearchProgressItem
,
ISearchQuery
,
ISearchResultProvider
,
ISearchService
,
ITextQuery
,
pathIncludedInQuery
,
QueryType
,
SearchError
,
SearchErrorCode
,
SearchProviderType
,
ISearchConfiguration
,
IRawSearchService
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
isSerializedSearchComplete
,
isSerializedSearchSuccess
}
from
'
vs/workbench/services/search/common/search
'
;
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
{
addContextToEditorMatches
,
editorMatchesToTextSearchResults
}
from
'
vs/workbench/services/search/common/searchHelpers
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IRawSearchService
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
isSerializedSearchComplete
,
isSerializedSearchSuccess
}
from
'
./search
'
;
import
{
SearchChannelClient
}
from
'
./searchIpc
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
...
...
src/vs/workbench/services/search/node/textSearchAdapter.ts
浏览文件 @
bf5e12e9
...
...
@@ -5,10 +5,9 @@
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
*
as
extfs
from
'
vs/base/node/extfs
'
;
import
{
IFileMatch
,
IProgress
,
ITextQuery
,
ITextSearchStats
,
ITextSearchMatch
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IFileMatch
,
IProgress
,
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
'
;
import
{
ISerializedFileMatch
,
ISerializedSearchSuccess
}
from
'
./search
'
;
export
class
TextSearchEngineAdapter
{
...
...
src/vs/workbench/services/search/node/textSearchManager.ts
浏览文件 @
bf5e12e9
...
...
@@ -12,8 +12,7 @@ import * as resources from 'vs/base/common/resources';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
toCanonicalName
}
from
'
vs/base/node/encoding
'
;
import
*
as
extfs
from
'
vs/base/node/extfs
'
;
import
{
IExtendedExtensionSearchOptions
,
IFileMatch
,
IFolderQuery
,
IPatternInfo
,
ISearchCompleteStats
,
ITextQuery
,
ITextSearchContext
,
ITextSearchMatch
,
ITextSearchResult
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
QueryGlobTester
,
resolvePatternsForProvider
}
from
'
vs/workbench/services/search/node/search
'
;
import
{
IExtendedExtensionSearchOptions
,
IFileMatch
,
IFolderQuery
,
IPatternInfo
,
ISearchCompleteStats
,
ITextQuery
,
ITextSearchContext
,
ITextSearchMatch
,
ITextSearchResult
,
QueryGlobTester
,
resolvePatternsForProvider
}
from
'
vs/workbench/services/search/common/search
'
;
import
*
as
vscode
from
'
vscode
'
;
export
class
TextSearchManager
{
...
...
src/vs/workbench/services/search/test/node/rawSearchService.test.ts
浏览文件 @
bf5e12e9
...
...
@@ -9,9 +9,8 @@ import { getPathFromAmdModule } from 'vs/base/common/amd';
import
{
CancelablePromise
,
createCancelablePromise
}
from
'
vs/base/common/async
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IFileQuery
,
IFileSearchStats
,
IFolderQuery
,
IProgress
,
ISearchEngineStats
,
QueryType
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IFileQuery
,
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
{
IRawFileMatch
,
ISearchEngine
,
ISearchEngineSuccess
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
ISerializedSearchSuccess
}
from
'
vs/workbench/services/search/node/search
'
;
import
{
DiskSearch
}
from
'
vs/workbench/services/search/node/searchService
'
;
const
TEST_FOLDER_QUERIES
=
[
...
...
src/vs/workbench/services/search/test/node/search.test.ts
浏览文件 @
bf5e12e9
...
...
@@ -9,9 +9,8 @@ import { getPathFromAmdModule } from 'vs/base/common/amd';
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IFolderQuery
,
QueryType
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IFolderQuery
,
QueryType
,
IRawFileMatch
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
Engine
as
FileSearchEngine
,
FileWalker
}
from
'
vs/workbench/services/search/node/fileSearch
'
;
import
{
IRawFileMatch
}
from
'
vs/workbench/services/search/node/search
'
;
const
TEST_FIXTURES
=
path
.
normalize
(
getPathFromAmdModule
(
require
,
'
./fixtures
'
));
const
EXAMPLES_FIXTURES
=
URI
.
file
(
path
.
join
(
TEST_FIXTURES
,
'
examples
'
));
...
...
src/vs/workbench/services/search/test/node/textSearch.integrationTest.ts
浏览文件 @
bf5e12e9
...
...
@@ -9,8 +9,7 @@ import { getPathFromAmdModule } from 'vs/base/common/amd';
import
{
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
*
as
glob
from
'
vs/base/common/glob
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
deserializeSearchError
,
IFolderQuery
,
ISearchRange
,
ITextQuery
,
ITextSearchContext
,
ITextSearchMatch
,
QueryType
,
SearchErrorCode
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
ISerializedFileMatch
}
from
'
vs/workbench/services/search/node/search
'
;
import
{
deserializeSearchError
,
IFolderQuery
,
ISearchRange
,
ITextQuery
,
ITextSearchContext
,
ITextSearchMatch
,
QueryType
,
SearchErrorCode
,
ISerializedFileMatch
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
TextSearchEngineAdapter
}
from
'
vs/workbench/services/search/node/textSearchAdapter
'
;
const
TEST_FIXTURES
=
path
.
normalize
(
getPathFromAmdModule
(
require
,
'
./fixtures
'
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录