Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
35b91522
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,发现更多精彩内容 >>
提交
35b91522
编写于
10月 03, 2017
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Check search.useRipgrep for file searches (#34999)
上级
08133231
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
43 addition
and
25 deletion
+43
-25
src/vs/platform/telemetry/common/experiments.ts
src/vs/platform/telemetry/common/experiments.ts
+4
-6
src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts
src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts
+9
-4
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+4
-2
src/vs/workbench/api/node/extHostExtensionService.ts
src/vs/workbench/api/node/extHostExtensionService.ts
+8
-2
src/vs/workbench/node/extensionHostMain.ts
src/vs/workbench/node/extensionHostMain.ts
+15
-3
src/vs/workbench/parts/search/browser/openFileHandler.ts
src/vs/workbench/parts/search/browser/openFileHandler.ts
+0
-3
src/vs/workbench/parts/search/browser/search.contribution.ts
src/vs/workbench/parts/search/browser/search.contribution.ts
+1
-1
src/vs/workbench/parts/search/common/queryBuilder.ts
src/vs/workbench/parts/search/common/queryBuilder.ts
+1
-1
src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
...h/test/electron-browser/quickopen.perf.integrationTest.ts
+1
-3
未找到文件。
src/vs/platform/telemetry/common/experiments.ts
浏览文件 @
35b91522
...
...
@@ -14,7 +14,6 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
}
*/
export
interface
IExperiments
{
ripgrepQuickSearch
:
boolean
;
}
export
const
IExperimentService
=
createDecorator
<
IExperimentService
>
(
'
experimentService
'
);
...
...
@@ -30,7 +29,7 @@ export class ExperimentService implements IExperimentService {
_serviceBrand
:
any
;
private
experiments
:
IExperiments
;
private
experiments
:
IExperiments
=
{};
// Shortcut while there are no experiments.
constructor
(
@
IStorageService
private
storageService
:
IStorageService
,
...
...
@@ -47,7 +46,6 @@ export class ExperimentService implements IExperimentService {
function
loadExperiments
(
storageService
:
IStorageService
,
configurationService
:
IConfigurationService
):
IExperiments
{
const
experiments
=
splitExperimentsRandomness
(
storageService
);
experiments
.
ripgrepQuickSearch
=
true
;
return
applyOverrides
(
experiments
,
configurationService
);
}
...
...
@@ -63,12 +61,12 @@ function applyOverrides(experiments: IExperiments, configurationService: IConfig
function
splitExperimentsRandomness
(
storageService
:
IStorageService
):
IExperiments
{
const
random1
=
getExperimentsRandomness
(
storageService
);
const
[
random2
,
ripgrepQuickSearch
]
=
splitRandom
(
random1
);
const
[
/* random3 */
,
/* deployToAzureQuickLink */
]
=
splitRandom
(
random2
);
const
[
/* random2 */
,
/* ripgrepQuickSearch */
]
=
splitRandom
(
random1
);
//
const [/* random3 */, /* deployToAzureQuickLink */] = splitRandom(random2);
// const [random4, /* mergeQuickLinks */] = splitRandom(random3);
// const [random5, /* enableWelcomePage */] = splitRandom(random4);
return
{
ripgrepQuickSearch
,
//
ripgrepQuickSearch,
};
}
...
...
src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts
浏览文件 @
35b91522
...
...
@@ -6,7 +6,7 @@
import
{
isPromiseCanceledError
}
from
'
vs/base/common/errors
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
ISearchService
,
QueryType
,
ISearchQuery
,
IFolderQuery
}
from
'
vs/platform/search/common/search
'
;
import
{
ISearchService
,
QueryType
,
ISearchQuery
,
IFolderQuery
,
ISearchConfiguration
}
from
'
vs/platform/search/common/search
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
...
...
@@ -14,7 +14,7 @@ import { MainThreadWorkspaceShape, ExtHostWorkspaceShape, ExtHostContext, MainCo
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
I
ExperimentService
}
from
'
vs/platform/telemetry/common/experiments
'
;
import
{
I
ConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IRelativePattern
}
from
'
vs/base/common/glob
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadWorkspace
)
...
...
@@ -29,7 +29,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
@
ISearchService
private
readonly
_searchService
:
ISearchService
,
@
IWorkspaceContextService
private
readonly
_contextService
:
IWorkspaceContextService
,
@
ITextFileService
private
readonly
_textFileService
:
ITextFileService
,
@
I
ExperimentService
private
_experimentService
:
IExperiment
Service
,
@
I
ConfigurationService
private
_configurationService
:
IConfiguration
Service
,
@
IFileService
private
readonly
_fileService
:
IFileService
)
{
this
.
_proxy
=
extHostContext
.
get
(
ExtHostContext
.
ExtHostWorkspace
);
...
...
@@ -67,13 +67,18 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
folderQueries
=
[{
folder
:
URI
.
file
(
include
.
base
)
}];
// relative pattern: search only in base folder
}
const
useRipgrep
=
folderQueries
.
every
(
folderQuery
=>
{
const
folderConfig
=
this
.
_configurationService
.
getConfiguration
<
ISearchConfiguration
>
(
undefined
,
{
resource
:
folderQuery
.
folder
});
return
folderConfig
.
search
.
useRipgrep
;
});
const
query
:
ISearchQuery
=
{
folderQueries
,
type
:
QueryType
.
File
,
maxResults
,
includePattern
:
{
[
typeof
include
===
'
string
'
?
include
:
!!
include
?
include
.
pattern
:
undefined
]:
true
},
excludePattern
:
{
[
typeof
exclude
===
'
string
'
?
exclude
:
!!
exclude
?
exclude
.
pattern
:
undefined
]:
true
},
useRipgrep
:
this
.
_experimentService
.
getExperiments
().
ripgrepQuickSearch
useRipgrep
};
this
.
_searchService
.
extendQuery
(
query
);
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
35b91522
...
...
@@ -76,6 +76,8 @@ function proposedApiFunction<T>(extension: IExtensionDescription, fn: T): T {
export
function
createApiFactory
(
initData
:
IInitData
,
threadService
:
ExtHostThreadService
,
extHostWorkspace
:
ExtHostWorkspace
,
extHostConfiguration
:
ExtHostConfiguration
,
extensionService
:
ExtHostExtensionService
):
IExtensionApiFactory
{
...
...
@@ -90,9 +92,9 @@ export function createApiFactory(
const
extHostEditors
=
threadService
.
set
(
ExtHostContext
.
ExtHostEditors
,
new
ExtHostEditors
(
threadService
,
extHostDocumentsAndEditors
));
const
extHostCommands
=
threadService
.
set
(
ExtHostContext
.
ExtHostCommands
,
new
ExtHostCommands
(
threadService
,
extHostHeapService
));
const
extHostTreeViews
=
threadService
.
set
(
ExtHostContext
.
ExtHostTreeViews
,
new
ExtHostTreeViews
(
threadService
.
get
(
MainContext
.
MainThreadTreeViews
),
extHostCommands
));
const
extHostWorkspace
=
threadService
.
set
(
ExtHostContext
.
ExtHostWorkspace
,
new
ExtHostWorkspace
(
threadService
,
initData
.
workspace
)
);
threadService
.
set
(
ExtHostContext
.
ExtHostWorkspace
,
extHostWorkspace
);
const
extHostDebugService
=
threadService
.
set
(
ExtHostContext
.
ExtHostDebugService
,
new
ExtHostDebugService
(
threadService
,
extHostWorkspace
));
const
extHostConfiguration
=
threadService
.
set
(
ExtHostContext
.
ExtHostConfiguration
,
new
ExtHostConfiguration
(
threadService
.
get
(
MainContext
.
MainThreadConfiguration
),
extHostWorkspace
,
initData
.
configuration
)
);
threadService
.
set
(
ExtHostContext
.
ExtHostConfiguration
,
extHostConfiguration
);
const
extHostDiagnostics
=
threadService
.
set
(
ExtHostContext
.
ExtHostDiagnostics
,
new
ExtHostDiagnostics
(
threadService
));
const
languageFeatures
=
threadService
.
set
(
ExtHostContext
.
ExtHostLanguageFeatures
,
new
ExtHostLanguageFeatures
(
threadService
,
extHostDocuments
,
extHostCommands
,
extHostHeapService
,
extHostDiagnostics
));
const
extHostFileSystem
=
threadService
.
set
(
ExtHostContext
.
ExtHostFileSystem
,
new
ExtHostFileSystem
(
threadService
));
...
...
src/vs/workbench/api/node/extHostExtensionService.ts
浏览文件 @
35b91522
...
...
@@ -17,6 +17,8 @@ import { MainContext, MainThreadExtensionServiceShape, IWorkspaceData, IEnvironm
import
{
IExtensionMemento
,
ExtensionsActivator
,
ActivatedExtension
,
IExtensionAPI
,
IExtensionContext
,
EmptyExtension
,
IExtensionModule
,
ExtensionActivationTimesBuilder
,
ExtensionActivationTimes
}
from
'
vs/workbench/api/node/extHostExtensionActivator
'
;
import
{
Barrier
}
from
'
vs/workbench/services/extensions/node/barrier
'
;
import
{
ExtHostThreadService
}
from
'
vs/workbench/services/thread/node/extHostThreadService
'
;
import
{
ExtHostConfiguration
}
from
'
vs/workbench/api/node/extHostConfiguration
'
;
import
{
ExtHostWorkspace
}
from
'
vs/workbench/api/node/extHostWorkspace
'
;
import
{
realpath
}
from
'
fs
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
...
...
@@ -120,7 +122,11 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
/**
* This class is constructed manually because it is a service, so it doesn't use any ctor injection
*/
constructor
(
initData
:
IInitData
,
threadService
:
ExtHostThreadService
)
{
constructor
(
initData
:
IInitData
,
threadService
:
ExtHostThreadService
,
extHostWorkspace
:
ExtHostWorkspace
,
extHostConfiguration
:
ExtHostConfiguration
)
{
this
.
_barrier
=
new
Barrier
();
this
.
_registry
=
new
ExtensionDescriptionRegistry
(
initData
.
extensions
);
this
.
_threadService
=
threadService
;
...
...
@@ -131,7 +137,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
this
.
_activator
=
null
;
// initialize API first (i.e. do not release barrier until the API is initialized)
const
apiFactory
=
createApiFactory
(
initData
,
threadService
,
this
);
const
apiFactory
=
createApiFactory
(
initData
,
threadService
,
extHostWorkspace
,
extHostConfiguration
,
this
);
initializeExtensionApi
(
this
,
apiFactory
).
then
(()
=>
{
...
...
src/vs/workbench/node/extensionHostMain.ts
浏览文件 @
35b91522
...
...
@@ -12,6 +12,8 @@ import { join } from 'path';
import
{
RPCProtocol
}
from
'
vs/workbench/services/extensions/node/rpcProtocol
'
;
import
{
ExtHostExtensionService
}
from
'
vs/workbench/api/node/extHostExtensionService
'
;
import
{
ExtHostThreadService
}
from
'
vs/workbench/services/thread/node/extHostThreadService
'
;
import
{
ExtHostConfiguration
}
from
'
vs/workbench/api/node/extHostConfiguration
'
;
import
{
ExtHostWorkspace
}
from
'
vs/workbench/api/node/extHostWorkspace
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
QueryType
,
ISearchQuery
}
from
'
vs/platform/search/common/search
'
;
import
{
DiskSearch
}
from
'
vs/workbench/services/search/node/searchService
'
;
...
...
@@ -58,6 +60,7 @@ export class ExtensionHostMain {
private
_workspace
:
IWorkspaceData
;
private
_environment
:
IEnvironment
;
private
_extensionService
:
ExtHostExtensionService
;
private
_extHostConfiguration
:
ExtHostConfiguration
;
constructor
(
rpcProtocol
:
RPCProtocol
,
initData
:
IInitData
)
{
this
.
_environment
=
initData
.
environment
;
...
...
@@ -65,7 +68,9 @@ export class ExtensionHostMain {
// services
const
threadService
=
new
ExtHostThreadService
(
rpcProtocol
);
this
.
_extensionService
=
new
ExtHostExtensionService
(
initData
,
threadService
);
const
extHostWorkspace
=
new
ExtHostWorkspace
(
threadService
,
initData
.
workspace
);
this
.
_extHostConfiguration
=
new
ExtHostConfiguration
(
threadService
.
get
(
MainContext
.
MainThreadConfiguration
),
extHostWorkspace
,
initData
.
configuration
);
this
.
_extensionService
=
new
ExtHostExtensionService
(
initData
,
threadService
,
extHostWorkspace
,
this
.
_extHostConfiguration
);
// error forwarding and stack trace scanning
const
extensionErrors
=
new
WeakMap
<
Error
,
IExtensionDescription
>
();
...
...
@@ -218,11 +223,18 @@ export class ExtensionHostMain {
includes
[
globPattern
]
=
true
;
});
const
folderQueries
=
this
.
_workspace
.
folders
.
map
(
folder
=>
({
folder
:
folder
.
uri
}));
const
useRipgrep
=
folderQueries
.
every
(
folderQuery
=>
{
const
folderConfig
=
this
.
_extHostConfiguration
.
getConfiguration
(
'
search
'
,
folderQuery
.
folder
);
return
folderConfig
.
get
(
'
useRipgrep
'
,
true
);
});
const
query
:
ISearchQuery
=
{
folderQueries
:
this
.
_workspace
.
folders
.
map
(
folder
=>
({
folder
:
folder
.
uri
}))
,
folderQueries
,
type
:
QueryType
.
File
,
maxResults
:
1
,
includePattern
:
includes
includePattern
:
includes
,
useRipgrep
};
let
result
=
await
this
.
_diskSearch
.
search
(
query
);
...
...
src/vs/workbench/parts/search/browser/openFileHandler.ts
浏览文件 @
35b91522
...
...
@@ -32,7 +32,6 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
getOutOfWorkspaceEditorResources
}
from
'
vs/workbench/parts/search/common/search
'
;
import
{
IExperimentService
}
from
'
vs/platform/telemetry/common/experiments
'
;
export
class
FileQuickOpenModel
extends
QuickOpenModel
{
...
...
@@ -123,7 +122,6 @@ export class OpenFileHandler extends QuickOpenHandler {
@
IWorkbenchThemeService
private
themeService
:
IWorkbenchThemeService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
ISearchService
private
searchService
:
ISearchService
,
@
IExperimentService
private
experimentService
:
IExperimentService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
super
();
...
...
@@ -196,7 +194,6 @@ export class OpenFileHandler extends QuickOpenHandler {
cacheKey
:
cacheKey
,
maxResults
:
0
,
sortByScore
:
true
,
useRipgrep
:
this
.
experimentService
.
getExperiments
().
ripgrepQuickSearch
};
const
folderResources
=
this
.
contextService
.
getWorkspace
().
folders
.
map
(
folder
=>
folder
.
uri
);
...
...
src/vs/workbench/parts/search/browser/search.contribution.ts
浏览文件 @
35b91522
...
...
@@ -359,7 +359,7 @@ configurationRegistry.registerConfiguration({
},
'
search.useRipgrep
'
:
{
'
type
'
:
'
boolean
'
,
'
description
'
:
nls
.
localize
(
'
useRipgrep
'
,
"
Controls whether to use ripgrep in text search
"
),
'
description
'
:
nls
.
localize
(
'
useRipgrep
'
,
"
Controls whether to use ripgrep in text
and file
search
"
),
'
default
'
:
true
},
'
search.useIgnoreFilesByDefault
'
:
{
...
...
src/vs/workbench/parts/search/common/queryBuilder.ts
浏览文件 @
35b91522
...
...
@@ -55,7 +55,7 @@ export class QueryBuilder {
}
}
const
useRipgrep
=
type
===
QueryType
.
File
?
options
.
useRipgrep
:
!
folderResources
||
folderResources
.
every
(
folder
=>
{
const
useRipgrep
=
!
folderResources
||
folderResources
.
every
(
folder
=>
{
const
folderConfig
=
this
.
configurationService
.
getConfiguration
<
ISearchConfiguration
>
(
undefined
,
{
resource
:
folder
});
return
folderConfig
.
search
.
useRipgrep
;
});
...
...
src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
浏览文件 @
35b91522
...
...
@@ -185,8 +185,6 @@ class TestExperimentService implements IExperimentService {
_serviceBrand
:
any
;
getExperiments
():
IExperiments
{
return
{
ripgrepQuickSearch
:
true
,
};
return
{};
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录