Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
91a20206
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,发现更多精彩内容 >>
提交
91a20206
编写于
11月 15, 2017
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Provide for using settings search url from vscode-distro, make relevant settings invisible
上级
f7bb5573
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
37 addition
and
40 deletion
+37
-40
src/vs/platform/environment/common/environment.ts
src/vs/platform/environment/common/environment.ts
+2
-0
src/vs/platform/environment/node/environmentService.ts
src/vs/platform/environment/node/environmentService.ts
+3
-0
src/vs/platform/node/product.ts
src/vs/platform/node/product.ts
+1
-0
src/vs/workbench/electron-browser/main.contribution.ts
src/vs/workbench/electron-browser/main.contribution.ts
+3
-21
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+2
-2
src/vs/workbench/parts/preferences/browser/preferencesSearch.ts
.../workbench/parts/preferences/browser/preferencesSearch.ts
+25
-16
src/vs/workbench/parts/preferences/common/preferences.ts
src/vs/workbench/parts/preferences/common/preferences.ts
+1
-1
未找到文件。
src/vs/platform/environment/common/environment.ts
浏览文件 @
91a20206
...
...
@@ -111,4 +111,6 @@ export interface IEnvironmentService {
installSource
:
string
;
disableUpdates
:
boolean
;
disableCrashReporter
:
boolean
;
settingsSearchUrl
:
string
;
}
src/vs/platform/environment/node/environmentService.ts
浏览文件 @
91a20206
...
...
@@ -74,6 +74,9 @@ export class EnvironmentService implements IEnvironmentService {
@
memoize
get
settingsSearchBuildId
():
number
{
return
product
.
settingsSearchBuildId
;
}
@
memoize
get
settingsSearchUrl
():
string
{
return
product
.
settingsSearchUrl
;
}
@
memoize
get
appKeybindingsPath
():
string
{
return
path
.
join
(
this
.
appSettingsHome
,
'
keybindings.json
'
);
}
...
...
src/vs/platform/node/product.ts
浏览文件 @
91a20206
...
...
@@ -20,6 +20,7 @@ export interface IProductConfiguration {
quality
?:
string
;
commit
?:
string
;
settingsSearchBuildId
?:
number
;
settingsSearchUrl
?:
string
;
date
:
string
;
extensionsGallery
:
{
serviceUrl
:
string
;
...
...
src/vs/workbench/electron-browser/main.contribution.ts
浏览文件 @
91a20206
...
...
@@ -227,28 +227,10 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
};
if
(
product
.
quality
!==
'
stable
'
)
{
workbenchProperties
[
'
workbench.settings.experimentalFuzzySearchEndpoint
'
]
=
{
'
type
'
:
'
string
'
,
'
description
'
:
nls
.
localize
(
'
experimentalFuzzySearchEndpoint
'
,
"
Indicates the endpoint to use for the experimental settings search.
"
),
'
default
'
:
''
};
workbenchProperties
[
'
workbench.settings.experimentalFuzzySearchKey
'
]
=
{
'
type
'
:
'
string
'
,
'
description
'
:
nls
.
localize
(
'
experimentalFuzzySearchKey
'
,
"
Indicates the key to use for the experimental settings search.
"
),
'
default
'
:
''
};
workbenchProperties
[
'
workbench.settings.experimentalFuzzySearchBoost
'
]
=
{
'
type
'
:
'
number
'
,
'
description
'
:
'
Indicates the amount to boost the "literal" component of the query. Temporary.
'
,
'
default
'
:
10
};
workbenchProperties
[
'
workbench.settings.experimentalFuzzySearchAutoIngestFeedback
'
]
=
{
workbenchProperties
[
'
workbench.settings.enableNaturalLanguageSearch
'
]
=
{
'
type
'
:
'
boolean
'
,
'
description
'
:
'
Indicates whether feedback from this client should be automatically ingested.
'
,
'
default
'
:
fals
e
'
description
'
:
nls
.
localize
(
'
enableNaturalLanguageSettingsSearch
'
,
"
Controls whether to enable the natural language search mode for settings.
"
)
,
'
default
'
:
tru
e
};
}
...
...
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
91a20206
...
...
@@ -147,7 +147,7 @@ export class PreferencesEditor extends BaseEditor {
showFuzzyToggle
:
true
,
showResultCount
:
true
}));
this
.
searchWidget
.
setFuzzyToggleVisible
(
this
.
searchProvider
.
remoteSearch
Enabl
ed
);
this
.
searchWidget
.
setFuzzyToggleVisible
(
this
.
searchProvider
.
remoteSearch
Allow
ed
);
this
.
searchWidget
.
fuzzyEnabled
=
this
.
memento
[
'
fuzzyEnabled
'
];
this
.
_register
(
this
.
searchProvider
.
onRemoteSearchEnablementChanged
(
enabled
=>
this
.
searchWidget
.
setFuzzyToggleVisible
(
enabled
)));
this
.
_register
(
this
.
searchWidget
.
onDidChange
(
value
=>
this
.
onInputChanged
()));
...
...
@@ -559,7 +559,7 @@ class PreferencesRenderers extends Disposable {
const
prefSearchP
=
searchModel
.
filterPreferences
(
<
ISettingsEditorModel
>
preferencesRenderer
.
preferencesModel
);
return
prefSearchP
.
then
(
filterResult
=>
{
preferencesRenderer
.
filterPreferences
(
filterResult
,
this
.
searchProvider
.
remoteSearch
Enabl
ed
);
preferencesRenderer
.
filterPreferences
(
filterResult
,
this
.
searchProvider
.
remoteSearch
Allow
ed
);
return
filterResult
;
});
}
...
...
src/vs/workbench/parts/preferences/browser/preferencesSearch.ts
浏览文件 @
91a20206
...
...
@@ -18,8 +18,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
export
interface
IEndpointDetails
{
urlBase
:
string
;
key
:
string
;
boost
:
number
;
key
?:
string
;
}
export
class
PreferencesSearchProvider
{
...
...
@@ -30,26 +29,35 @@ export class PreferencesSearchProvider {
@
IWorkspaceConfigurationService
private
configurationService
:
IWorkspaceConfigurationService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
configurationService
.
onDidChangeConfiguration
(()
=>
this
.
_onRemoteSearchEnablementChanged
.
fire
(
this
.
remoteSearch
Enabl
ed
));
configurationService
.
onDidChangeConfiguration
(()
=>
this
.
_onRemoteSearchEnablementChanged
.
fire
(
this
.
remoteSearch
Allow
ed
));
}
get
remoteSearch
Enabl
ed
():
boolean
{
get
remoteSearch
Allow
ed
():
boolean
{
if
(
this
.
environmentService
.
appQuality
===
'
stable
'
)
{
return
false
;
}
const
endpoint
=
this
.
endpoint
;
return
!!
endpoint
.
urlBase
&&
!!
endpoint
.
key
;
const
workbenchSettings
=
this
.
configurationService
.
getValue
<
IWorkbenchSettingsConfiguration
>
().
workbench
.
settings
;
if
(
!
workbenchSettings
.
enableNaturalLanguageSearch
)
{
return
false
;
}
return
!!
this
.
endpoint
.
urlBase
;
}
get
endpoint
():
IEndpointDetails
{
const
workbenchSettings
=
this
.
configurationService
.
getValue
<
IWorkbenchSettingsConfiguration
>
().
workbench
.
settings
;
if
(
workbenchSettings
.
experimentalFuzzySearchEndpoint
)
{
return
{
urlBase
:
workbenchSettings
.
experimentalFuzzySearchEndpoint
,
key
:
workbenchSettings
.
experimentalFuzzySearchKey
,
boost
:
workbenchSettings
.
experimentalFuzzySearchBoost
key
:
workbenchSettings
.
experimentalFuzzySearchKey
};
}
else
{
return
{
urlBase
:
this
.
environmentService
.
settingsSearchUrl
};
}
}
startSearch
(
filter
:
string
,
remote
:
boolean
):
PreferencesSearchModel
{
return
new
PreferencesSearchModel
(
this
,
filter
,
remote
,
this
.
environmentService
);
...
...
@@ -147,7 +155,6 @@ class RemoteSearchProvider {
private
getSettingsFromBing
(
filter
:
string
,
endpoint
:
IEndpointDetails
):
TPromise
<
IFilterMetadata
>
{
const
url
=
prepareUrl
(
filter
,
endpoint
,
this
.
environmentService
.
settingsSearchBuildId
);
console
.
log
(
'
fetching:
'
+
url
);
const
start
=
Date
.
now
();
const
p
=
fetch
(
url
,
{
headers
:
new
Headers
({
...
...
@@ -160,7 +167,6 @@ class RemoteSearchProvider {
.
then
(
result
=>
{
const
timestamp
=
Date
.
now
();
const
duration
=
timestamp
-
start
;
console
.
log
(
'
time:
'
+
duration
/
1000
);
const
suggestions
=
(
result
.
value
||
[])
.
map
(
r
=>
({
name
:
r
.
setting
||
r
.
Setting
,
...
...
@@ -200,18 +206,21 @@ function escapeSpecialChars(query: string): string {
function
prepareUrl
(
query
:
string
,
endpoint
:
IEndpointDetails
,
buildNumber
:
number
):
string
{
query
=
escapeSpecialChars
(
query
);
const
boost
=
endpoint
.
boost
||
1
;
const
boost
=
10
;
const
userQuery
=
`(
${
query
}
)^
${
boost
}
`
;
// Appending Fuzzy after each word.
query
=
query
.
replace
(
/
\
+/g
,
'
~
'
)
+
'
~
'
;
let
url
=
`
${
endpoint
.
urlBase
}
?
${
API_VERSION
}
&search=
${
encodeURIComponent
(
userQuery
+
'
||
'
+
query
)}
&
${
QUERY_TYPE
}
&
${
SCORING_PROFILE
}
`
;
let
url
=
`
${
endpoint
.
urlBase
}
?search=
${
encodeURIComponent
(
userQuery
+
'
||
'
+
query
)}
`
;
if
(
endpoint
.
key
)
{
url
+=
`&
${
API_VERSION
}
&
${
QUERY_TYPE
}
&
${
SCORING_PROFILE
}
`
;
}
if
(
buildNumber
)
{
url
+=
`&$filter startbuildno le
${
buildNumber
}
and endbuildno ge
${
buildNumber
}
`
;
}
return
url
;
return
url
+
`&$filter=startbuildno le 119000227 and endbuildno ge 119000227`
;
}
class
SettingMatches
{
...
...
src/vs/workbench/parts/preferences/common/preferences.ts
浏览文件 @
91a20206
...
...
@@ -23,8 +23,8 @@ export interface IWorkbenchSettingsConfiguration {
openDefaultSettings
:
boolean
;
experimentalFuzzySearchEndpoint
:
string
;
experimentalFuzzySearchKey
:
string
;
experimentalFuzzySearchBoost
:
number
;
experimentalFuzzySearchAutoIngestFeedback
:
boolean
;
enableNaturalLanguageSearch
:
boolean
;
}
};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录