@@ -529,7 +529,8 @@ export class RoslynLanguageServer {
529
529
if ( csharpDevkitIntelliCodeExtension ) {
530
530
_channel . appendLine ( 'Activating C# + C# Dev Kit + C# IntelliCode...' ) ;
531
531
const csharpDevkitIntelliCodeArgs = await this . getCSharpDevkitIntelliCodeExportArgs (
532
- csharpDevkitIntelliCodeExtension
532
+ csharpDevkitIntelliCodeExtension ,
533
+ context
533
534
) ;
534
535
args = args . concat ( csharpDevkitIntelliCodeArgs ) ;
535
536
} else {
@@ -822,14 +823,48 @@ export class RoslynLanguageServer {
822
823
}
823
824
824
825
private static async getCSharpDevkitIntelliCodeExportArgs (
825
- csharpDevkitIntelliCodeExtension : vscode . Extension < CSharpIntelliCodeExports >
826
+ csharpDevkitIntelliCodeExtension : vscode . Extension < CSharpIntelliCodeExports > ,
827
+ extensionContext : vscode . ExtensionContext
826
828
) : Promise < string [ ] > {
827
- const exports = await csharpDevkitIntelliCodeExtension . activate ( ) ;
829
+ try {
830
+ const exports = await csharpDevkitIntelliCodeExtension . activate ( ) ;
831
+
832
+ const starredCompletionComponentPath = exports . components [ '@vsintellicode/starred-suggestions-csharp' ] ;
833
+
834
+ const csharpIntelliCodeArgs : string [ ] = [
835
+ '--starredCompletionComponentPath' ,
836
+ starredCompletionComponentPath ,
837
+ ] ;
838
+ return csharpIntelliCodeArgs ;
839
+ } catch ( e ) {
840
+ _channel . appendLine ( `Activation of ${ csharpDevkitIntelliCodeExtensionId } failed` ) ;
841
+ _channel . appendLine ( e instanceof Error ? e . message : ( e as string ) ) ;
842
+ if ( e instanceof Error && e . stack ) {
843
+ _channel . appendLine ( e . stack ) ;
844
+ }
845
+
846
+ const stateKey = 'disableIntellicodeFailedPopup' ;
847
+ if ( extensionContext . globalState . get ( stateKey ) === true ) {
848
+ return [ ] ;
849
+ }
828
850
829
- const starredCompletionComponentPath = exports . components [ '@vsintellicode/starred-suggestions-csharp' ] ;
851
+ const message = vscode . l10n . t (
852
+ 'IntelliCode features will not be available, {0} failed to activate.' ,
853
+ csharpDevkitIntelliCodeExtensionId
854
+ ) ;
855
+ const showOutput = vscode . l10n . t ( 'Go to output' ) ;
856
+ const suppressNotification = vscode . l10n . t ( 'Suppress notification' ) ;
857
+ // Buttons are shown in right-to-left order, with a close button to the right of everything;
858
+ vscode . window . showErrorMessage ( message , showOutput , suppressNotification ) . then ( ( value ) => {
859
+ if ( value === showOutput ) {
860
+ _channel . show ( ) ;
861
+ } else if ( value == suppressNotification ) {
862
+ extensionContext . globalState . update ( stateKey , true ) ;
863
+ }
864
+ } ) ;
830
865
831
- const csharpIntelliCodeArgs : string [ ] = [ '--starredCompletionComponentPath' , starredCompletionComponentPath ] ;
832
- return csharpIntelliCodeArgs ;
866
+ return [ ] ;
867
+ }
833
868
}
834
869
835
870
private static async setupDevKitEnvironment (
0 commit comments