File tree 3 files changed +18
-1
lines changed 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 56
56
"activationEvents" : [
57
57
" onLanguage:go" ,
58
58
" onCommand:go.gopath" ,
59
- " onCommand:go.tools.install"
59
+ " onCommand:go.tools.install" ,
60
+ " onCommand:go.debug.startSession"
60
61
],
61
62
"main" : " ./out/src/goMain" ,
62
63
"contributes" : {
153
154
"languages" : [
154
155
" go"
155
156
],
157
+ "startSessionCommand" : " go.debug.startSession" ,
156
158
"initialConfigurations" : [
157
159
{
158
160
"name" : " Launch" ,
Original file line number Diff line number Diff line change @@ -187,6 +187,8 @@ class Delve {
187
187
connectClient ( port , host ) ;
188
188
return ;
189
189
}
190
+ if ( ! env ) env = { } ;
191
+
190
192
let dlv = getBinPathWithPreferredGopath ( 'dlv' , env [ 'GOPATH' ] ) ;
191
193
192
194
if ( ! existsSync ( dlv ) ) {
Original file line number Diff line number Diff line change @@ -156,6 +156,19 @@ export function activate(ctx: vscode.ExtensionContext): void {
156
156
goGenerateTests . toggleTestFile ( ) ;
157
157
} ) ) ;
158
158
159
+ ctx . subscriptions . push ( vscode . commands . registerCommand ( 'go.debug.startSession' , config => {
160
+ if ( ! config . request ) { // if 'request' is missing interpret this as a missing launch.json
161
+ config = Object . assign ( config , {
162
+ 'name' : 'Launch' ,
163
+ 'type' : 'go' ,
164
+ 'request' : 'launch' ,
165
+ 'mode' : 'debug' ,
166
+ 'program' : '${workspaceRoot}'
167
+ } ) ;
168
+ }
169
+ vscode . commands . executeCommand ( 'vscode.startDebug' , config ) ;
170
+ } ) ) ;
171
+
159
172
vscode . languages . setLanguageConfiguration ( GO_MODE . language , {
160
173
indentationRules : {
161
174
// ^(.*\*/)?\s*\ }.*$
You can’t perform that action at this time.
0 commit comments