Skip to content

Commit 063b57d

Browse files
suzmuehyangah
authored andcommitted
src/goLanguageServer.ts: remove prompt when the default is changed
When the language server is enabled by default, we will be showing the welcome page to the user with the announcement. We should not also show them a prompt. Change-Id: Iebb2fb3977335bb863d27c3b2d77e066c59a9014 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/285412 Trust: Suzy Mueller <[email protected]> Run-TryBot: Suzy Mueller <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
1 parent 30b8fdb commit 063b57d

File tree

2 files changed

+0
-61
lines changed

2 files changed

+0
-61
lines changed

src/goLanguageServer.ts

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,69 +1546,11 @@ export function sanitizeGoplsTrace(logs?: string): { sanitizedLog?: string, fail
15461546
return { failureReason: 'unrecognized crash pattern' };
15471547
}
15481548

1549-
export async function promptForLanguageServerDefaultChange(cfg: vscode.WorkspaceConfiguration) {
1550-
const useLanguageServer = cfg.inspect<boolean>('useLanguageServer');
1551-
if (!languageServerUsingDefault(cfg)) {
1552-
if (!cfg['useLanguageServer']) { // ask users who explicitly disabled.
1553-
promptForLanguageServerOptOutSurvey();
1554-
}
1555-
return; // user already explicitly set the field.
1556-
}
1557-
1558-
const promptedForLSDefaultChangeKey = `promptedForLSDefaultChange`;
1559-
if (getFromGlobalState(promptedForLSDefaultChangeKey, false)) {
1560-
return;
1561-
}
1562-
1563-
const selected = await vscode.window.showInformationMessage(
1564-
`"go.useLanguageServer" is enabled by default. If you need to disable it, please configure in the settings.`,
1565-
'Open Settings', 'OK');
1566-
switch (selected) {
1567-
case 'Open Settings':
1568-
vscode.commands.executeCommand('workbench.action.openSettings', 'go.useLanguageServer');
1569-
default:
1570-
}
1571-
updateGlobalState(promptedForLSDefaultChangeKey, true);
1572-
}
1573-
15741549
function languageServerUsingDefault(cfg: vscode.WorkspaceConfiguration): boolean {
15751550
const useLanguageServer = cfg.inspect<boolean>('useLanguageServer');
15761551
return useLanguageServer.globalValue === undefined && useLanguageServer.workspaceValue === undefined;
15771552
}
15781553

1579-
// Prompt users who disabled the language server and ask to file an issue.
1580-
async function promptForLanguageServerOptOutSurvey() {
1581-
const promptedForLSOptOutSurveyKey = `promptedForLSOptOutSurvey`;
1582-
const value = getSurveyConfig(promptedForLSOptOutSurveyKey); // We use only 'prompt' and 'lastDatePrompted' fields.
1583-
1584-
if (value?.prompt === false ||
1585-
(value?.lastDatePrompted && daysBetween(value.lastDatePrompted, new Date()) < 90)) {
1586-
return;
1587-
}
1588-
1589-
value.lastDatePrompted = new Date();
1590-
1591-
const selected = await vscode.window.showInformationMessage(
1592-
`Looks like you've disabled the language server. Would you be willing to file an issue and tell us why you had to disable it?`,
1593-
'Yes', 'Not now', 'Never');
1594-
switch (selected) {
1595-
case 'Yes':
1596-
const title = 'gopls: automated issue report (opt out)';
1597-
const body = `
1598-
Please tell us why you had to disable the language server.
1599-
1600-
`;
1601-
const url = `https://github.com/golang/vscode-go/issues/new?title=${title}&labels=upstream-tools&body=${body}`;
1602-
await vscode.env.openExternal(vscode.Uri.parse(url));
1603-
break;
1604-
case 'Never':
1605-
value.prompt = false;
1606-
break;
1607-
default:
1608-
}
1609-
updateGlobalState(promptedForLSOptOutSurveyKey, JSON.stringify(value));
1610-
}
1611-
16121554
interface ExtensionInfo {
16131555
version?: string; // Extension version
16141556
appName: string; // The application name of the editor, like 'VS Code'

src/goMain.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import {
3535
import {
3636
isInPreviewMode,
3737
languageServerIsRunning,
38-
promptForLanguageServerDefaultChange,
3938
resetSurveyConfig,
4039
showServerOutputChannel,
4140
showSurveyConfig,
@@ -107,8 +106,6 @@ export async function activate(ctx: vscode.ExtensionContext) {
107106
}
108107

109108
if (isInPreviewMode()) {
110-
promptForLanguageServerDefaultChange(cfg);
111-
112109
// For Nightly extension users, show a message directing them to forums
113110
// to give feedback.
114111
setTimeout(showGoNightlyWelcomeMessage, 10 * timeMinute);

0 commit comments

Comments
 (0)