5
5
6
6
import * as path from 'path' ;
7
7
import * as vscode from 'vscode' ;
8
+ import { ServiceConfigurationProvider , SyntaxServerConfiguration , TsServerLogLevel , TypeScriptServiceConfiguration , areServiceConfigurationsEqual } from './configuration/configuration' ;
9
+ import * as fileSchemes from './configuration/fileSchemes' ;
10
+ import { Schemes } from './configuration/schemes' ;
8
11
import { IExperimentationTelemetryReporter } from './experimentTelemetryReporter' ;
9
12
import { DiagnosticKind , DiagnosticsManager } from './languageFeatures/diagnostics' ;
10
- import * as Proto from './tsServer/protocol/protocol' ;
11
- import { EventName } from './tsServer/protocol/protocol.const' ;
13
+ import { Logger } from './logging/logger' ;
14
+ import { TelemetryProperties , TelemetryReporter , VSCodeTelemetryReporter } from './logging/telemetry' ;
15
+ import Tracer from './logging/tracer' ;
16
+ import { ProjectType , inferredProjectCompilerOptions } from './tsconfig' ;
12
17
import { API } from './tsServer/api' ;
13
18
import BufferSyncSupport from './tsServer/bufferSyncSupport' ;
14
19
import { OngoingRequestCancellerFactory } from './tsServer/cancellation' ;
15
20
import { ILogDirectoryProvider } from './tsServer/logDirectoryProvider' ;
21
+ import { NodeVersionManager } from './tsServer/nodeManager' ;
16
22
import { TypeScriptPluginPathsProvider } from './tsServer/pluginPathsProvider' ;
23
+ import { PluginManager , TypeScriptServerPlugin } from './tsServer/plugins' ;
24
+ import * as Proto from './tsServer/protocol/protocol' ;
25
+ import { EventName } from './tsServer/protocol/protocol.const' ;
17
26
import { ITypeScriptServer , TsServerLog , TsServerProcessFactory , TypeScriptServerExitEvent } from './tsServer/server' ;
18
27
import { TypeScriptServerError } from './tsServer/serverError' ;
19
28
import { TypeScriptServerSpawner } from './tsServer/spawner' ;
20
29
import { TypeScriptVersionManager } from './tsServer/versionManager' ;
21
30
import { ITypeScriptVersionProvider , TypeScriptVersion } from './tsServer/versionProvider' ;
22
31
import { ClientCapabilities , ClientCapability , ExecConfig , ITypeScriptServiceClient , ServerResponse , TypeScriptRequests } from './typescriptService' ;
23
- import { ServiceConfigurationProvider , SyntaxServerConfiguration , TsServerLogLevel , TypeScriptServiceConfiguration , areServiceConfigurationsEqual } from './configuration/configuration' ;
24
32
import { Disposable , DisposableStore , disposeAll } from './utils/dispose' ;
25
- import * as fileSchemes from './configuration/fileSchemes' ;
26
- import { Logger } from './logging/logger' ;
27
33
import { isWeb , isWebAndHasSharedArrayBuffers } from './utils/platform' ;
28
- import { PluginManager , TypeScriptServerPlugin } from './tsServer/plugins' ;
29
- import { TelemetryProperties , TelemetryReporter , VSCodeTelemetryReporter } from './logging/telemetry' ;
30
- import Tracer from './logging/tracer' ;
31
- import { ProjectType , inferredProjectCompilerOptions } from './tsconfig' ;
32
- import { Schemes } from './configuration/schemes' ;
33
- import { NodeVersionManager } from './tsServer/nodeManager' ;
34
34
35
35
36
36
export interface TsDiagnostics {
@@ -463,7 +463,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
463
463
}
464
464
*/
465
465
this . logTelemetry ( 'tsserver.error' ) ;
466
- this . serviceExited ( false ) ;
466
+ this . serviceExited ( false , apiVersion ) ;
467
467
} ) ;
468
468
469
469
handle . onExit ( ( data : TypeScriptServerExitEvent ) => {
@@ -484,7 +484,6 @@ export default class TypeScriptServiceClient extends Disposable implements IType
484
484
*/
485
485
this . logTelemetry ( 'tsserver.exitWithCode' , { code : code ?? undefined , signal : signal ?? undefined } ) ;
486
486
487
-
488
487
if ( this . token !== mytoken ) {
489
488
// this is coming from an old process
490
489
return ;
@@ -493,7 +492,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
493
492
if ( handle . tsServerLog ?. type === 'file' ) {
494
493
this . info ( `TSServer log file: ${ handle . tsServerLog . uri . fsPath } ` ) ;
495
494
}
496
- this . serviceExited ( ! this . isRestarting ) ;
495
+ this . serviceExited ( ! this . isRestarting , apiVersion ) ;
497
496
this . isRestarting = false ;
498
497
} ) ;
499
498
@@ -612,7 +611,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
612
611
} ;
613
612
}
614
613
615
- private serviceExited ( restart : boolean ) : void {
614
+ private serviceExited ( restart : boolean , tsVersion : API ) : void {
616
615
this . resetWatchers ( ) ;
617
616
this . loadingIndicator . reset ( ) ;
618
617
@@ -686,25 +685,42 @@ export default class TypeScriptServiceClient extends Disposable implements IType
686
685
this . _isPromptingAfterCrash = true ;
687
686
}
688
687
689
- prompt ?. then ( item => {
688
+ prompt ?. then ( async item => {
690
689
this . _isPromptingAfterCrash = false ;
691
690
692
691
if ( item === reportIssueItem ) {
692
+
693
693
const minModernTsVersion = this . versionProvider . bundledVersion . apiVersion ;
694
694
695
- if (
695
+ // Don't allow reporting issues using the PnP patched version of TS Server
696
+ if ( tsVersion . isYarnPnp ( ) ) {
697
+ const reportIssue : vscode . MessageItem = {
698
+ title : vscode . l10n . t ( "Report issue against Yarn PnP" ) ,
699
+ } ;
700
+ const response = await vscode . window . showWarningMessage (
701
+ vscode . l10n . t ( "Please report an issue against Yarn PnP" ) ,
702
+ {
703
+ modal : true ,
704
+ detail : vscode . l10n . t ( "The workspace is using a version of the TypeScript Server that has been patched by Yarn PnP. This patching is a common source of bugs." ) ,
705
+ } ,
706
+ reportIssue ) ;
707
+
708
+ if ( response === reportIssue ) {
709
+ vscode . env . openExternal ( vscode . Uri . parse ( 'https://github.com/yarnpkg/berry/issues' ) ) ;
710
+ }
711
+ }
712
+ // Don't allow reporting issues with old TS versions
713
+ else if (
696
714
minModernTsVersion &&
697
- previousState . type === ServerState . Type . Errored &&
698
- previousState . error instanceof TypeScriptServerError &&
699
- previousState . error . version . apiVersion ?. lt ( minModernTsVersion )
715
+ tsVersion . lt ( minModernTsVersion )
700
716
) {
701
717
vscode . window . showWarningMessage (
702
718
vscode . l10n . t ( "Please update your TypeScript version" ) ,
703
719
{
704
720
modal : true ,
705
721
detail : vscode . l10n . t (
706
722
"The workspace is using an old version of TypeScript ({0}).\n\nBefore reporting an issue, please update the workspace to use TypeScript {1} or newer to make sure the bug has not already been fixed." ,
707
- previousState . error . version . apiVersion . displayName ,
723
+ tsVersion . displayName ,
708
724
minModernTsVersion . displayName ) ,
709
725
} ) ;
710
726
} else {
0 commit comments