@@ -371,28 +371,64 @@ function lintDiagnosticCollectionName(lintToolName: string) {
371
371
}
372
372
373
373
async function showDeprecationWarning ( ) {
374
- // Present a warning about the deprecation of the go.documentLink setting.
375
- const experimentalFeatures = getGoConfig ( ) [ 'languageServerExperimentalFeatures' ] ;
374
+ const cfg = getGoConfig ( ) ;
375
+ const experimentalFeatures = cfg [ 'languageServerExperimentalFeatures' ] ;
376
376
if ( experimentalFeatures ) {
377
377
// TODO(golang/vscode-go#50): Eventually notify about deprecation of
378
378
// all of the settings. See golang/vscode-go#1109 too.
379
379
// The `diagnostics` setting is still used as a workaround for running custom vet.
380
- if ( experimentalFeatures [ 'documentLink' ] === false ) {
381
- vscode . window
382
- . showErrorMessage ( `The 'go.languageServerExperimentalFeature.documentLink' setting is now deprecated.
383
- Please use '"gopls": {"ui.navigation.importShortcut": "Definition" }' instead.
384
- See [the settings doc](https://github.com/golang/vscode-go/blob/master/docs/settings.md#uinavigationimportshortcut) for more details.` ) ;
385
- }
386
380
const promptKey = 'promptedLanguageServerExperimentalFeatureDeprecation' ;
387
381
const prompted = getFromGlobalState ( promptKey , false ) ;
388
382
if ( ! prompted && experimentalFeatures [ 'diagnostics' ] === false ) {
389
383
const msg = `The 'go.languageServerExperimentalFeature.diagnostics' setting will be deprecated soon.
390
- If you would like additional configuration for diagnostics from gopls, please see and response to [Issue 50](https://github.com/golang /vscode-go/issues /50).` ;
384
+ If you would like additional configuration for diagnostics from gopls, please see and response to [Issue 50](https://go.dev/s /vscode-issue /50).` ;
391
385
const selected = await vscode . window . showInformationMessage ( msg , "Don't show again" ) ;
392
386
switch ( selected ) {
393
387
case "Don't show again" :
394
388
updateGlobalState ( promptKey , true ) ;
395
389
}
396
390
}
397
391
}
392
+ const codelensFeatures = cfg [ 'enableCodeLens' ] ;
393
+ if ( codelensFeatures && codelensFeatures [ 'references' ] ) {
394
+ const promptKey = 'promptedCodeLensReferencesFeatureDeprecation' ;
395
+ const prompted = getFromGlobalState ( promptKey , false ) ;
396
+ if ( ! prompted ) {
397
+ const msg =
398
+ "The 'go.enableCodeLens.references' setting will be removed soon. Please see [Issue 2509](https://go.dev/s/vscode-issue/2509)." ;
399
+ const selected = await vscode . window . showWarningMessage ( msg , 'Update Settings' , "Don't show again" ) ;
400
+ switch ( selected ) {
401
+ case 'Update Settings' :
402
+ {
403
+ const { globalValue, workspaceValue, workspaceFolderValue } = cfg . inspect < {
404
+ [ key : string ] : boolean ;
405
+ } > ( 'enableCodeLens' ) || {
406
+ globalValue : undefined ,
407
+ workspaceValue : undefined ,
408
+ workspaceFolderValue : undefined
409
+ } ;
410
+ if ( globalValue && globalValue [ 'references' ] ) {
411
+ delete globalValue . references ;
412
+ cfg . update ( 'enableCodeLens' , globalValue , vscode . ConfigurationTarget . Global ) ;
413
+ }
414
+ if ( workspaceValue && workspaceValue [ 'references' ] ) {
415
+ delete workspaceValue . references ;
416
+ cfg . update ( 'enableCodeLens' , workspaceValue , vscode . ConfigurationTarget . Workspace ) ;
417
+ }
418
+ if ( workspaceFolderValue && workspaceFolderValue [ 'references' ] ) {
419
+ delete workspaceFolderValue . references ;
420
+ cfg . update (
421
+ 'enableCodeLens' ,
422
+ workspaceFolderValue ,
423
+ vscode . ConfigurationTarget . WorkspaceFolder
424
+ ) ;
425
+ }
426
+ }
427
+ break ;
428
+ case "Don't show again" :
429
+ updateGlobalState ( promptKey , true ) ;
430
+ break ;
431
+ }
432
+ }
433
+ }
398
434
}
0 commit comments