Skip to content

Commit af8377d

Browse files
committed
goSurvey: update language in Go Developer survey prompt
Also fix a small bug. Change-Id: I7d745e0cec00cbb17b7878fb82579620b60d9a61 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/355975 Trust: Rebecca Stambler <[email protected]> Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Rebecca Stambler <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
1 parent 8ac427b commit af8377d

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

src/goDeveloperSurvey.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function maybePromptForDeveloperSurvey() {
4343
return;
4444
}
4545
const now = new Date();
46-
let cfg = shouldPromptForSurvey(now, getSurveyConfig());
46+
let cfg = shouldPromptForSurvey(now, getDeveloperSurveyConfig());
4747
if (!cfg) {
4848
return;
4949
}
@@ -121,12 +121,13 @@ export function shouldPromptForSurvey(now: Date, cfg: DeveloperSurveyConfig): De
121121
return cfg;
122122
}
123123

124-
async function promptForDeveloperSurvey(cfg: DeveloperSurveyConfig, now: Date): Promise<DeveloperSurveyConfig> {
124+
export async function promptForDeveloperSurvey(cfg: DeveloperSurveyConfig, now: Date): Promise<DeveloperSurveyConfig> {
125125
let selected = await vscode.window.showInformationMessage(
126126
// TODO(rstambler): Figure out how to phrase this.
127-
'Looks like you are coding in Go! We are currently running a Go developer survey...',
127+
`Looks like you are coding in Go! Help ensure Go is meeting your needs
128+
by participating in this 10-minute survey by ${endDate.toDateString()}?`,
128129
'Yes',
129-
'Not now',
130+
'Remind me later',
130131
'Never'
131132
);
132133

@@ -176,7 +177,7 @@ To opt-out of all survey prompts, please set 'go.survey.prompt' to false.`,
176177

177178
export const developerSurveyConfig = 'developerSurveyConfig';
178179

179-
function getSurveyConfig(): DeveloperSurveyConfig {
180+
export function getDeveloperSurveyConfig(): DeveloperSurveyConfig {
180181
return getStateConfig(developerSurveyConfig) as DeveloperSurveyConfig;
181182
}
182183

src/goSurvey.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ import { getLocalGoplsVersion, lastUserAction, latestConfig } from './goLanguage
1111
import { outputChannel } from './goStatus';
1212
import { extensionId } from './const';
1313
import { getFromGlobalState, getFromWorkspaceState, updateGlobalState } from './stateUtils';
14-
import { developerSurveyConfig } from './goDeveloperSurvey';
14+
import {
15+
developerSurveyConfig,
16+
getDeveloperSurveyConfig,
17+
maybePromptForDeveloperSurvey,
18+
promptForDeveloperSurvey
19+
} from './goDeveloperSurvey';
1520
import { getGoConfig } from './config';
1621

1722
// GoplsSurveyConfig is the set of global properties used to determine if
@@ -50,7 +55,7 @@ export function maybePromptForGoplsSurvey() {
5055
return;
5156
}
5257
const now = new Date();
53-
let cfg = shouldPromptForSurvey(now, getSurveyConfig());
58+
let cfg = shouldPromptForSurvey(now, getGoplsSurveyConfig());
5459
if (!cfg) {
5560
return;
5661
}
@@ -200,7 +205,7 @@ To opt-out of all survey prompts, please disable the 'Go > Survey: Prompt' setti
200205

201206
export const goplsSurveyConfig = 'goplsSurveyConfig';
202207

203-
function getSurveyConfig(): GoplsSurveyConfig {
208+
function getGoplsSurveyConfig(): GoplsSurveyConfig {
204209
return getStateConfig(goplsSurveyConfig) as GoplsSurveyConfig;
205210
}
206211

@@ -244,21 +249,36 @@ export function getStateConfig(globalStateKey: string, workspace?: boolean): any
244249

245250
export async function showSurveyConfig() {
246251
// TODO(rstambler): Add developer survey config.
247-
outputChannel.appendLine('Survey Configuration');
248-
outputChannel.appendLine(JSON.stringify(getSurveyConfig(), null, 2));
252+
outputChannel.appendLine('HaTs Survey Configuration');
253+
outputChannel.appendLine(JSON.stringify(getGoplsSurveyConfig(), null, 2));
249254
outputChannel.show();
250255

251-
const selected = await vscode.window.showInformationMessage('Prompt for survey?', 'Yes', 'Maybe', 'No');
256+
outputChannel.appendLine('Developer Survey Configuration');
257+
outputChannel.appendLine(JSON.stringify(getDeveloperSurveyConfig(), null, 2));
258+
outputChannel.show();
259+
260+
let selected = await vscode.window.showInformationMessage('Prompt for HaTS survey?', 'Yes', 'Maybe', 'No');
252261
switch (selected) {
253262
case 'Yes':
254-
promptForGoplsSurvey(getSurveyConfig(), new Date());
263+
promptForGoplsSurvey(getGoplsSurveyConfig(), new Date());
255264
break;
256265
case 'Maybe':
257266
maybePromptForGoplsSurvey();
258267
break;
259268
default:
260269
break;
261270
}
271+
selected = await vscode.window.showInformationMessage('Prompt for Developer survey?', 'Yes', 'Maybe', 'No');
272+
switch (selected) {
273+
case 'Yes':
274+
promptForDeveloperSurvey(getDeveloperSurveyConfig(), new Date());
275+
break;
276+
case 'Maybe':
277+
maybePromptForDeveloperSurvey();
278+
break;
279+
default:
280+
break;
281+
}
262282
}
263283

264284
export const timeMinute = 1000 * 60;

0 commit comments

Comments
 (0)