Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
188c29a4
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
188c29a4
编写于
8月 18, 2021
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change forceExtensionHostSearch strategy for easier testing
上级
3673539e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
20 addition
and
20 deletion
+20
-20
src/vs/workbench/api/browser/mainThreadSearch.ts
src/vs/workbench/api/browser/mainThreadSearch.ts
+8
-1
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-0
src/vs/workbench/api/common/extHostSearch.ts
src/vs/workbench/api/common/extHostSearch.ts
+2
-0
src/vs/workbench/api/node/extHostSearch.ts
src/vs/workbench/api/node/extHostSearch.ts
+1
-5
src/vs/workbench/services/search/common/searchService.ts
src/vs/workbench/services/search/common/searchService.ts
+1
-1
src/vs/workbench/services/search/electron-browser/searchService.ts
...rkbench/services/search/electron-browser/searchService.ts
+1
-4
src/vs/workbench/test/electron-browser/api/extHostSearch.test.ts
...workbench/test/electron-browser/api/extHostSearch.test.ts
+6
-9
未找到文件。
src/vs/workbench/api/browser/mainThreadSearch.ts
浏览文件 @
188c29a4
...
...
@@ -6,6 +6,7 @@
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
dispose
,
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
IFileMatch
,
IFileQuery
,
IRawFileMatch2
,
ISearchComplete
,
ISearchCompleteStats
,
ISearchProgressItem
,
ISearchResultProvider
,
ISearchService
,
ITextQuery
,
QueryType
,
SearchProviderType
}
from
'
vs/workbench/services/search/common/search
'
;
...
...
@@ -20,9 +21,15 @@ export class MainThreadSearch implements MainThreadSearchShape {
constructor
(
extHostContext
:
IExtHostContext
,
@
ISearchService
private
readonly
_searchService
:
ISearchService
,
@
ITelemetryService
private
readonly
_telemetryService
:
ITelemetryService
@
ITelemetryService
private
readonly
_telemetryService
:
ITelemetryService
,
@
IConfigurationService
_configurationService
:
IConfigurationService
,
)
{
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostSearch
);
const
forceEHSearch
=
_configurationService
.
getValue
(
'
search.experimental.forceExtensionHostSearch
'
);
if
(
forceEHSearch
)
{
this
.
_proxy
.
$enableExtensionHostSearch
();
}
}
dispose
():
void
{
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
188c29a4
...
...
@@ -1314,6 +1314,7 @@ export interface ExtHostSecretStateShape {
}
export
interface
ExtHostSearchShape
{
$enableExtensionHostSearch
():
void
;
$provideFileSearchResults
(
handle
:
number
,
session
:
number
,
query
:
search
.
IRawQuery
,
token
:
CancellationToken
):
Promise
<
search
.
ISearchCompleteStats
>
;
$provideTextSearchResults
(
handle
:
number
,
session
:
number
,
query
:
search
.
IRawTextQuery
,
token
:
CancellationToken
):
Promise
<
search
.
ISearchCompleteStats
>
;
$clearCache
(
cacheKey
:
string
):
Promise
<
void
>
;
...
...
src/vs/workbench/api/common/extHostSearch.ts
浏览文件 @
188c29a4
...
...
@@ -105,6 +105,8 @@ export class ExtHostSearch implements ExtHostSearchShape {
return
engine
.
search
(
progress
=>
this
.
_proxy
.
$handleTextMatch
(
handle
,
session
,
progress
),
token
);
}
$enableExtensionHostSearch
():
void
{
}
protected
createTextSearchManager
(
query
:
ITextQuery
,
provider
:
vscode
.
TextSearchProvider
):
TextSearchManager
{
return
new
TextSearchManager
(
query
,
provider
,
{
readdir
:
resource
=>
Promise
.
resolve
([]),
// TODO@rob implement
...
...
src/vs/workbench/api/node/extHostSearch.ts
浏览文件 @
188c29a4
...
...
@@ -8,7 +8,6 @@ import { Schemas } from 'vs/base/common/network';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/extHostRpcService
'
;
import
{
ExtHostSearch
,
reviveQuery
}
from
'
vs/workbench/api/common/extHostSearch
'
;
import
{
IURITransformerService
}
from
'
vs/workbench/api/common/extHostUriTransformerService
'
;
...
...
@@ -29,7 +28,6 @@ export class NativeExtHostSearch extends ExtHostSearch {
constructor
(
@
IExtHostRpcService
extHostRpc
:
IExtHostRpcService
,
@
IExtHostInitDataService
initData
:
IExtHostInitDataService
,
@
IURITransformerService
_uriTransformer
:
IURITransformerService
,
@
ILogService
_logService
:
ILogService
,
)
{
...
...
@@ -37,11 +35,9 @@ export class NativeExtHostSearch extends ExtHostSearch {
const
outputChannel
=
new
OutputChannel
(
'
RipgrepSearchUD
'
,
this
.
_logService
);
this
.
registerTextSearchProvider
(
Schemas
.
userData
,
new
RipgrepSearchProvider
(
outputChannel
));
this
.
_registerEHSearchProviders
();
}
private
_registerEHSearchProviders
():
void
{
override
$enableExtensionHostSearch
():
void
{
const
outputChannel
=
new
OutputChannel
(
'
RipgrepSearchEH
'
,
this
.
_logService
);
this
.
registerTextSearchProvider
(
Schemas
.
file
,
new
RipgrepSearchProvider
(
outputChannel
));
this
.
registerInternalFileSearchProvider
(
Schemas
.
file
,
new
SearchService
());
...
...
src/vs/workbench/services/search/common/searchService.ts
浏览文件 @
188c29a4
...
...
@@ -209,7 +209,7 @@ export class SearchService extends Disposable implements ISearchService {
this
.
fileSearchProviders
.
get
(
scheme
)
:
this
.
textSearchProviders
.
get
(
scheme
);
if
(
scheme
===
Schemas
.
file
&&
(
!
provider
||
this
.
diskSearch
)
)
{
if
(
!
provider
&&
scheme
===
Schemas
.
file
)
{
diskSearchQueries
.
push
(...
schemeFQs
);
}
else
{
if
(
!
provider
)
{
...
...
src/vs/workbench/services/search/electron-browser/searchService.ts
浏览文件 @
188c29a4
...
...
@@ -44,10 +44,7 @@ export class LocalSearchService extends SearchService {
)
{
super
(
modelService
,
editorService
,
telemetryService
,
logService
,
extensionService
,
fileService
,
uriIdentityService
);
const
forceEHSearch
=
configurationService
.
getValue
(
'
search.experimental.forceExtensionHostSearch
'
);
if
(
!
forceEHSearch
)
{
this
.
diskSearch
=
instantiationService
.
createInstance
(
DiskSearch
,
!
environmentService
.
isBuilt
||
environmentService
.
verbose
,
parseSearchPort
(
environmentService
.
args
,
environmentService
.
isBuilt
));
}
this
.
diskSearch
=
instantiationService
.
createInstance
(
DiskSearch
,
!
environmentService
.
isBuilt
||
environmentService
.
verbose
,
parseSearchPort
(
environmentService
.
args
,
environmentService
.
isBuilt
));
}
}
...
...
src/vs/workbench/test/electron-browser/api/extHostSearch.test.ts
浏览文件 @
188c29a4
...
...
@@ -5,25 +5,23 @@
import
*
as
assert
from
'
assert
'
;
import
{
mapArrayOrNot
}
from
'
vs/base/common/arrays
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
{
isPromiseCanceledError
}
from
'
vs/base/common/errors
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
MainContext
,
MainThreadSearchShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
NativeExtHostSearch
}
from
'
vs/workbench/api/node/extHostSearch
'
;
import
{
Range
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
IFileMatch
,
IFileQuery
,
IPatternInfo
,
IRawFileMatch2
,
ISearchCompleteStats
,
ISearchQuery
,
ITextQuery
,
QueryType
,
resultIsMatch
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
TestRPCProtocol
}
from
'
vs/workbench/test/browser/api/testRPCProtocol
'
;
import
type
*
as
vscode
from
'
vscode
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
URITransformerService
}
from
'
vs/workbench/api/common/extHostUriTransformerService
'
;
import
{
mock
}
from
'
vs/base/test/common/mock
'
;
import
{
I
ExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
import
{
NativeExtHostSearch
}
from
'
vs/workbench/api/node/extHostSearch
'
;
import
{
I
FileMatch
,
IFileQuery
,
IPatternInfo
,
IRawFileMatch2
,
ISearchCompleteStats
,
ISearchQuery
,
ITextQuery
,
QueryType
,
resultIsMatch
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
TextSearchManager
}
from
'
vs/workbench/services/search/common/textSearchManager
'
;
import
{
NativeTextSearchManager
}
from
'
vs/workbench/services/search/node/textSearchManager
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
TestRPCProtocol
}
from
'
vs/workbench/test/browser/api/testRPCProtocol
'
;
import
type
*
as
vscode
from
'
vscode
'
;
let
rpcProtocol
:
TestRPCProtocol
;
let
extHostSearch
:
NativeExtHostSearch
;
...
...
@@ -141,7 +139,6 @@ suite('ExtHostSearch', () => {
constructor
()
{
super
(
rpcProtocol
,
new
class
extends
mock
<
IExtHostInitDataService
>
()
{
override
remote
=
{
isRemote
:
false
,
authority
:
undefined
,
connectionData
:
null
};
},
new
URITransformerService
(
null
),
logService
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录