@@ -1546,69 +1546,11 @@ export function sanitizeGoplsTrace(logs?: string): { sanitizedLog?: string, fail
1546
1546
return { failureReason : 'unrecognized crash pattern' } ;
1547
1547
}
1548
1548
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
-
1574
1549
function languageServerUsingDefault ( cfg : vscode . WorkspaceConfiguration ) : boolean {
1575
1550
const useLanguageServer = cfg . inspect < boolean > ( 'useLanguageServer' ) ;
1576
1551
return useLanguageServer . globalValue === undefined && useLanguageServer . workspaceValue === undefined ;
1577
1552
}
1578
1553
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
-
1612
1554
interface ExtensionInfo {
1613
1555
version ?: string ; // Extension version
1614
1556
appName : string ; // The application name of the editor, like 'VS Code'
0 commit comments