@@ -47,13 +47,13 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
47
47
return ;
48
48
}
49
49
50
- debugConfiguration = {
50
+ debugConfiguration = Object . assign ( debugConfiguration || { } , {
51
51
name : 'Launch' ,
52
52
type : 'go' ,
53
53
request : 'launch' ,
54
54
mode : 'auto' ,
55
55
program : activeEditor . document . fileName
56
- } ;
56
+ } ) ;
57
57
}
58
58
59
59
debugConfiguration [ 'packagePathToGoModPathMap' ] = packagePathToGoModPathMap ;
@@ -110,25 +110,33 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
110
110
activeEditor && activeEditor . document . fileName . endsWith ( '_test.go' ) ? 'test' : 'debug' ;
111
111
}
112
112
113
- const neverAgain = { title : `Don't Show Again` } ;
114
- const ignoreWarningKey = 'ignoreDebugLaunchRemoteWarning' ;
115
- const ignoreWarning = getFromGlobalState ( ignoreWarningKey ) ;
116
- if (
117
- ignoreWarning !== true &&
118
- debugConfiguration . request === 'launch' &&
119
- debugConfiguration [ 'mode' ] === 'remote'
120
- ) {
121
- vscode . window
122
- . showWarningMessage (
123
- `Request type of 'launch' with mode 'remote' is deprecated, please use request type 'attach' with mode 'remote' instead.` ,
124
- neverAgain
125
- )
126
- . then ( ( result ) => {
127
- if ( result === neverAgain ) {
128
- updateGlobalState ( ignoreWarningKey , true ) ;
129
- }
130
- } ) ;
113
+ if ( debugConfiguration . request === 'launch' && debugConfiguration [ 'mode' ] === 'remote' ) {
114
+ this . showWarning (
115
+ 'ignoreDebugLaunchRemoteWarning' ,
116
+ `Request type of 'launch' with mode 'remote' is deprecated, please use request type 'attach' with mode 'remote' instead.` ) ;
117
+ }
118
+
119
+ if ( debugConfiguration . request === 'attach'
120
+ && debugConfiguration [ 'mode' ] === 'remote'
121
+ && debugConfiguration [ 'program' ] ) {
122
+ this . showWarning (
123
+ 'ignoreUsingRemotePathAndProgramWarning' ,
124
+ `Request type of 'attach' with mode 'remote' does not work with 'program' attribute, please use 'cwd' attribute instead.` ) ;
131
125
}
132
126
return debugConfiguration ;
133
127
}
128
+
129
+ private showWarning ( ignoreWarningKey : string , warningMessage : string ) {
130
+ const ignoreWarning = getFromGlobalState ( ignoreWarningKey ) ;
131
+ if ( ignoreWarning ) {
132
+ return ;
133
+ }
134
+
135
+ const neverAgain = { title : 'Don\'t Show Again' } ;
136
+ vscode . window . showWarningMessage ( warningMessage , neverAgain ) . then ( ( result ) => {
137
+ if ( result === neverAgain ) {
138
+ updateGlobalState ( ignoreWarningKey , true ) ;
139
+ }
140
+ } ) ;
141
+ }
134
142
}
0 commit comments