提交 bc347c43 编写于 作者: R Rob Lourens

Add instructions comment to top of setting search feedback page

上级 0234e715
......@@ -6,6 +6,7 @@
import { TPromise } from 'vs/base/common/winjs.base';
import * as nls from 'vs/nls';
import { Delayer } from 'vs/base/common/async';
import * as strings from 'vs/base/common/strings';
import { tail } from 'vs/base/common/arrays';
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IAction } from 'vs/base/common/actions';
......@@ -555,8 +556,13 @@ export class HiddenAreasRenderer extends Disposable {
}
export class FeedbackWidgetRenderer extends Disposable {
private static DEFAULT_COMMENT_TEXT = 'Modify the below results to match your expectations. Assign scores to indicate their relevance. Replace this comment with any text feedback.';
private static DEFAULT_COMMENT_TEXT = 'Replace this comment with any text feedback.';
private static DEFAULT_ALTS = ['alt 1', 'alt 2'];
private static INSTRUCTION_TEXT = [
'// Modify the "resultScores" section to contain only your expected results. Assign scores to indicate their relevance.',
'// Results present in "resultScores" will be automatically "boosted" for this query, if they are not already at the top of the result set.',
'// Add phrase pairs to the "alts" section to have them considered to be synonyms in queries.'
].join('\n');
private _feedbackWidget: FloatingClickWidget;
private _currentResult: IFilterResult;
......@@ -590,7 +596,7 @@ export class FeedbackWidgetRenderer extends Disposable {
}
private getFeedback(): void {
if (!this.telemetryService.isOptedIn) {
if (!this.telemetryService.isOptedIn && this.environmentService.appQuality) {
this.messageService.show(Severity.Error, 'Can\'t send feedback, user is opted out of telemetry');
return;
}
......@@ -607,7 +613,7 @@ export class FeedbackWidgetRenderer extends Disposable {
});
feedbackQuery['alts'] = [FeedbackWidgetRenderer.DEFAULT_ALTS];
const contents = JSON.stringify(feedbackQuery, undefined, ' ');
const contents = FeedbackWidgetRenderer.INSTRUCTION_TEXT + '\n' + JSON.stringify(feedbackQuery, undefined, ' ');
this.editorService.openEditor({ contents, language: 'json' }, /*sideBySide=*/true).then(feedbackEditor => {
const sendFeedbackWidget = this._register(this.instantiationService.createInstance(FloatingClickWidget, feedbackEditor.getControl(), 'Send feedback', null));
sendFeedbackWidget.render();
......@@ -625,7 +631,9 @@ export class FeedbackWidgetRenderer extends Disposable {
private sendFeedback(feedbackEditor: ICodeEditor, result: IFilterResult, actualResults: IScoredResults): TPromise<void> {
const model = feedbackEditor.getModel();
const expectedQueryLines = model.getLinesContent();
const expectedQueryLines = model.getLinesContent()
.filter(line => !strings.startsWith(line, '//'));
let expectedQuery: any;
try {
expectedQuery = JSON.parse(expectedQueryLines.join('\n'));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册