Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d5736304
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,发现更多精彩内容 >>
提交
d5736304
编写于
1月 23, 2018
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Settings search - fix feedback and telemetry to handle extension setting results
上级
6ae8a18c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
63 addition
and
33 deletion
+63
-33
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+10
-6
src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts
...rkbench/parts/preferences/browser/preferencesRenderers.ts
+26
-17
src/vs/workbench/parts/preferences/common/preferences.ts
src/vs/workbench/parts/preferences/common/preferences.ts
+4
-2
src/vs/workbench/parts/preferences/common/preferencesModels.ts
...s/workbench/parts/preferences/common/preferencesModels.ts
+20
-6
src/vs/workbench/parts/preferences/electron-browser/preferencesSearch.ts
...h/parts/preferences/electron-browser/preferencesSearch.ts
+3
-2
未找到文件。
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
d5736304
...
...
@@ -294,20 +294,24 @@ export class PreferencesEditor extends BaseEditor {
}
}
private
reportFilteringUsed
(
filter
:
string
,
counts
:
IStringDictionary
<
number
>
,
metadata
?:
I
FilterMetadata
):
void
{
private
reportFilteringUsed
(
filter
:
string
,
counts
:
IStringDictionary
<
number
>
,
metadata
?:
I
StringDictionary
<
IFilterMetadata
>
):
void
{
if
(
filter
&&
filter
!==
this
.
_lastReportedFilter
)
{
let
durations
:
any
;
if
(
metadata
)
{
durations
=
Object
.
create
(
null
);
Object
.
keys
(
metadata
).
forEach
(
key
=>
durations
[
key
]
=
metadata
[
key
].
duration
);
}
let
data
=
{
filter
,
duration
:
metadata
?
metadata
.
duration
:
undefined
,
context
:
metadata
?
metadata
.
context
:
undefined
,
durations
,
counts
};
/* __GDPR__
"defaultSettings.filter" : {
"filter": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"context" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"durations" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"counts" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
...
...
@@ -352,7 +356,7 @@ class SettingsNavigator implements INavigator<ISetting> {
interface
IFilterOrSearchResult
{
defaultSettingsGroupCounts
:
IStringDictionary
<
number
>
;
metadata
:
I
FilterMetadata
;
metadata
:
I
StringDictionary
<
IFilterMetadata
>
;
}
class
PreferencesRenderersController
extends
Disposable
{
...
...
src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts
浏览文件 @
d5736304
...
...
@@ -113,7 +113,6 @@ export class UserSettingsRenderer extends Disposable implements IPreferencesRend
if
(
this
.
filterResult
)
{
data
[
'
query
'
]
=
this
.
filterResult
.
query
;
data
[
'
duration
'
]
=
this
.
filterResult
.
metadata
&&
this
.
filterResult
.
metadata
.
duration
;
data
[
'
index
'
]
=
source
.
index
;
data
[
'
groupId
'
]
=
source
.
groupId
;
data
[
'
editableSide
'
]
=
!!
fromEditableSettings
;
...
...
@@ -123,9 +122,8 @@ export class UserSettingsRenderer extends Disposable implements IPreferencesRend
"defaultSettingsActions.copySetting" : {
"userConfigurationKeys" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"query" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"groupId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"index" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"groupId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"editableSide" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
...
...
@@ -622,31 +620,35 @@ export class FeedbackWidgetRenderer extends Disposable {
}
const
result
=
this
.
_currentResult
;
const
actualResults
=
result
.
metadata
.
scoredResults
;
const
metadata
=
result
.
metadata
[
'
nlpResult
'
];
// Feedback only on nlpResult set for now
const
marketplaceExtensionsResults
=
result
.
metadata
[
'
newExtensionsResult
'
]
&&
result
.
metadata
[
'
newExtensionsResult
'
].
scoredResults
;
const
actualResults
=
metadata
?
metadata
.
scoredResults
:
{};
const
actualResultIds
=
Object
.
keys
(
actualResults
);
const
feedbackQuery
:
any
=
{};
feedbackQuery
[
'
comment
'
]
=
FeedbackWidgetRenderer
.
DEFAULT_COMMENT_TEXT
;
feedbackQuery
[
'
queryString
'
]
=
result
.
query
;
feedbackQuery
[
'
resultScores
'
]
=
{}
;
feedbackQuery
[
'
resultScores
'
]
=
[]
;
actualResultIds
.
forEach
(
settingId
=>
{
const
outputKey
=
actualResults
[
settingId
].
key
;
feedbackQuery
[
'
resultScores
'
][
outputKey
]
=
10
;
feedbackQuery
[
'
resultScores
'
].
push
({
packageID
:
actualResults
[
settingId
].
packageId
,
key
:
actualResults
[
settingId
].
key
,
score
:
10
});
});
feedbackQuery
[
'
alts
'
]
=
[];
const
contents
=
FeedbackWidgetRenderer
.
INSTRUCTION_TEXT
+
'
\n
'
+
JSON
.
stringify
(
feedbackQuery
,
undefined
,
'
'
)
+
'
\n\n
'
+
actualResultIds
.
map
(
name
=>
{
return
`//
${
actualResults
[
name
].
key
}
:
${
actualResults
[
name
].
score
}
`
;
}).
join
(
'
\n
'
);
this
.
getScoreText
(
actualResults
)
+
'
\n\n
'
+
this
.
getScoreText
(
marketplaceExtensionsResults
)
+
'
\n
'
;
this
.
editorService
.
openEditor
({
contents
,
language
:
'
jsonc
'
},
/*sideBySide=*/
true
).
then
(
feedbackEditor
=>
{
const
sendFeedbackWidget
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
FloatingClickWidget
,
feedbackEditor
.
getControl
(),
'
Send feedback
'
,
null
));
sendFeedbackWidget
.
render
();
this
.
_register
(
sendFeedbackWidget
.
onClick
(()
=>
{
this
.
sendFeedback
(
feedbackEditor
.
getControl
()
as
ICodeEditor
,
result
,
result
.
metadata
.
scoredResults
).
then
(()
=>
{
this
.
sendFeedback
(
feedbackEditor
.
getControl
()
as
ICodeEditor
,
result
,
metadata
.
scoredResults
).
then
(()
=>
{
sendFeedbackWidget
.
dispose
();
this
.
messageService
.
show
(
Severity
.
Info
,
'
Feedback sent successfully
'
);
},
err
=>
{
...
...
@@ -656,6 +658,17 @@ export class FeedbackWidgetRenderer extends Disposable {
});
}
private
getScoreText
(
results
?:
IScoredResults
):
string
{
if
(
!
results
)
{
return
''
;
}
return
Object
.
keys
(
results
)
.
map
(
name
=>
{
return
`//
${
results
[
name
].
key
}
:
${
results
[
name
].
score
}
`
;
}).
join
(
'
\n
'
);
}
private
sendFeedback
(
feedbackEditor
:
ICodeEditor
,
result
:
IFilterResult
,
actualResults
:
IScoredResults
):
TPromise
<
void
>
{
const
model
=
feedbackEditor
.
getModel
();
const
expectedQueryLines
=
model
.
getLinesContent
()
...
...
@@ -685,11 +698,9 @@ export class FeedbackWidgetRenderer extends Disposable {
"settingsSearchResultFeedback" : {
"query" : { "classification": "CustomContent", "purpose": "FeatureInsight" },
"userComment" : { "classification": "CustomerContent", "purpose": "FeatureInsight" },
"actualResults" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"expectedResults" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"
url" : { "classification": "CustomerContent
", "purpose": "FeatureInsight" },
"
actualResults" : { "classification": "SystemMetaData
", "purpose": "FeatureInsight" },
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"timestamp" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
return
this
.
telemetryService
.
publicLog
(
'
settingsSearchResultFeedback
'
,
{
...
...
@@ -697,9 +708,7 @@ export class FeedbackWidgetRenderer extends Disposable {
userComment
,
actualResults
,
expectedResults
:
expectedQuery
.
resultScores
,
url
:
result
.
metadata
.
remoteUrl
,
duration
:
result
.
metadata
.
duration
,
timestamp
:
result
.
metadata
.
timestamp
,
duration
:
result
.
metadata
[
'
nlpResult
'
].
duration
,
buildNumber
:
this
.
environmentService
.
settingsSearchBuildId
,
alts
,
autoIngest
...
...
src/vs/workbench/parts/preferences/common/preferences.ts
浏览文件 @
d5736304
...
...
@@ -16,6 +16,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
join
}
from
'
vs/base/common/paths
'
;
import
{
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
Event
from
'
vs/base/common/event
'
;
import
{
IStringDictionary
}
from
'
vs/base/common/collections
'
;
export
interface
IWorkbenchSettingsConfiguration
{
workbench
:
{
...
...
@@ -79,7 +80,7 @@ export interface IFilterResult {
filteredGroups
:
ISettingsGroup
[];
allGroups
:
ISettingsGroup
[];
matches
:
IRange
[];
metadata
?:
I
FilterMetadata
;
metadata
?:
I
StringDictionary
<
IFilterMetadata
>
;
}
export
interface
ISettingMatch
{
...
...
@@ -104,7 +105,8 @@ export interface IRemoteSetting {
}
export
interface
IFilterMetadata
{
remoteUrl
:
string
;
requestUrl
:
string
;
requestBody
:
string
;
timestamp
:
number
;
duration
:
number
;
scoredResults
:
IScoredResults
;
...
...
src/vs/workbench/parts/preferences/common/preferencesModels.ts
浏览文件 @
d5736304
...
...
@@ -6,7 +6,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
*
as
map
from
'
vs/base/common/map
'
;
import
{
tail
,
flatten
,
first
}
from
'
vs/base/common/arrays
'
;
import
{
tail
,
flatten
}
from
'
vs/base/common/arrays
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IReference
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
...
...
@@ -15,12 +15,13 @@ import { visit, JSONVisitor } from 'vs/base/common/json';
import
{
ITextModel
,
IIdentifiedSingleEditOperation
}
from
'
vs/editor/common/model
'
;
import
{
EditorModel
}
from
'
vs/workbench/common/editor
'
;
import
{
IConfigurationNode
,
IConfigurationRegistry
,
Extensions
,
OVERRIDE_PROPERTY_PATTERN
,
IConfigurationPropertySchema
,
ConfigurationScope
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
ISettingsEditorModel
,
IKeybindingsEditorModel
,
ISettingsGroup
,
ISetting
,
IFilterResult
,
IGroupFilter
,
ISettingMatcher
,
ISettingMatch
,
ISearchResultGroup
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
ISettingsEditorModel
,
IKeybindingsEditorModel
,
ISettingsGroup
,
ISetting
,
IFilterResult
,
IGroupFilter
,
ISettingMatcher
,
ISettingMatch
,
ISearchResultGroup
,
IFilterMetadata
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ITextEditorModel
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IRange
,
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
IStringDictionary
}
from
'
vs/base/common/collections
'
;
export
abstract
class
AbstractSettingsModel
extends
EditorModel
{
...
...
@@ -114,6 +115,19 @@ export abstract class AbstractSettingsModel extends EditorModel {
};
}
protected
collectMetadata
(
groups
:
ISearchResultGroup
[]):
IStringDictionary
<
IFilterMetadata
>
{
const
metadata
=
Object
.
create
(
null
);
let
hasMetadata
=
false
;
groups
.
forEach
(
g
=>
{
if
(
g
.
result
.
metadata
)
{
metadata
[
g
.
id
]
=
g
.
result
.
metadata
;
hasMetadata
=
true
;
}
});
return
hasMetadata
?
metadata
:
null
;
}
protected
get
filterGroups
():
ISettingsGroup
[]
{
return
this
.
settingsGroups
;
...
...
@@ -205,12 +219,12 @@ export class SettingsEditorModel extends AbstractSettingsModel implements ISetti
};
}
const
groupWithMetadata
=
first
(
resultGroups
,
group
=>
!!
group
.
result
.
metadata
);
const
metadata
=
this
.
collectMetadata
(
resultGroups
);
return
<
IFilterResult
>
{
allGroups
:
this
.
settingsGroups
,
filteredGroups
:
filteredGroup
?
[
filteredGroup
]
:
[],
matches
,
metadata
:
groupWithMetadata
&&
groupWithMetadata
.
result
.
metadata
metadata
};
}
}
...
...
@@ -648,13 +662,13 @@ export class DefaultSettingsEditorModel extends AbstractSettingsModel implements
const
startLine
=
tail
(
this
.
settingsGroups
).
range
.
endLineNumber
+
2
;
const
{
settingsGroups
:
filteredGroups
,
matches
}
=
this
.
writeResultGroups
(
nonEmptyResultGroups
,
startLine
);
const
groupWithMetadata
=
first
(
resultGroups
,
group
=>
!!
group
.
result
.
metadata
);
const
metadata
=
this
.
collectMetadata
(
resultGroups
);
return
resultGroups
.
length
?
<
IFilterResult
>
{
allGroups
:
this
.
settingsGroups
,
filteredGroups
,
matches
,
metadata
:
groupWithMetadata
&&
groupWithMetadata
.
result
.
metadata
metadata
}
:
null
;
}
...
...
src/vs/workbench/parts/preferences/electron-browser/preferencesSearch.ts
浏览文件 @
d5736304
...
...
@@ -243,7 +243,8 @@ class RemoteSearchProvider implements ISearchProvider {
});
return
<
IFilterMetadata
>
{
remoteUrl
:
details
.
url
,
// telemetry for filter text?
requestUrl
:
details
.
url
,
requestBody
:
details
.
body
,
duration
,
timestamp
,
scoredResults
,
...
...
@@ -337,7 +338,7 @@ class RemoteSearchProvider implements ISearchProvider {
function
getSettingKey
(
name
:
string
,
packageId
?:
string
):
string
{
return
packageId
?
packageId
+
'
_
'
+
name
:
packageId
+
'
##
'
+
name
:
name
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录