@@ -192,7 +192,7 @@ suite('Go Extension Tests', function () {
192
192
}
193
193
194
194
test ( 'Test Definition Provider using godoc' , async ( ) => {
195
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
195
+ const config = Object . create ( getGoConfig ( ) , {
196
196
docsTool : { value : 'godoc' }
197
197
} ) ;
198
198
await testDefinitionProvider ( config ) ;
@@ -204,7 +204,7 @@ suite('Go Extension Tests', function () {
204
204
// gogetdoc is not installed, so skip the test
205
205
return ;
206
206
}
207
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
207
+ const config = Object . create ( getGoConfig ( ) , {
208
208
docsTool : { value : 'gogetdoc' }
209
209
} ) ;
210
210
await testDefinitionProvider ( config ) ;
@@ -243,7 +243,7 @@ encountered.
243
243
[ 's string' ]
244
244
]
245
245
] ;
246
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
246
+ const config = Object . create ( getGoConfig ( ) , {
247
247
docsTool : { value : 'godoc' }
248
248
} ) ;
249
249
await testSignatureHelpProvider ( config , testCases ) ;
@@ -286,7 +286,7 @@ It returns the number of bytes written and any write error encountered.
286
286
[ 's string' ]
287
287
]
288
288
] ;
289
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
289
+ const config = Object . create ( getGoConfig ( ) , {
290
290
docsTool : { value : 'gogetdoc' }
291
291
} ) ;
292
292
await testSignatureHelpProvider ( config , testCases ) ;
@@ -313,7 +313,7 @@ encountered.
313
313
`This is an unexported function so couldn't get this comment on hover :( Not\nanymore!!\n`
314
314
]
315
315
] ;
316
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
316
+ const config = Object . create ( getGoConfig ( ) , {
317
317
docsTool : { value : 'godoc' }
318
318
} ) ;
319
319
await testHoverProvider ( config , testCases ) ;
@@ -358,7 +358,7 @@ It returns the number of bytes written and any write error encountered.
358
358
'IPv4Mask returns the IP mask (in 4-byte form) of the\nIPv4 mask a.b.c.d.\n'
359
359
]
360
360
] ;
361
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
361
+ const config = Object . create ( getGoConfig ( ) , {
362
362
docsTool : { value : 'gogetdoc' }
363
363
} ) ;
364
364
await testHoverProvider ( config , testCases ) ;
@@ -370,7 +370,7 @@ It returns the number of bytes written and any write error encountered.
370
370
sinon . spy ( util , 'runTool' ) ;
371
371
sinon . spy ( processutil , 'killProcessTree' ) ;
372
372
373
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
373
+ const config = Object . create ( getGoConfig ( ) , {
374
374
vetOnSave : { value : 'package' } ,
375
375
vetFlags : { value : [ '-all' ] } ,
376
376
buildOnSave : { value : 'package' } ,
@@ -394,7 +394,7 @@ It returns the number of bytes written and any write error encountered.
394
394
// the adjustment is made consistently across multiple open text documents.
395
395
const file1 = await vscode . workspace . openTextDocument ( vscode . Uri . file ( path . join ( fixturePath , 'linterTest' , 'linter_1.go' ) ) ) ;
396
396
const file2 = await vscode . workspace . openTextDocument ( vscode . Uri . file ( path . join ( fixturePath , 'linterTest' , 'linter_2.go' ) ) ) ;
397
- const warnings = await goLint ( file2 . uri , Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
397
+ const warnings = await goLint ( file2 . uri , Object . create ( getGoConfig ( ) , {
398
398
lintTool : { value : 'golint' } ,
399
399
lintFlags : { value : [ ] }
400
400
} ) , 'package' ) ;
@@ -412,7 +412,7 @@ It returns the number of bytes written and any write error encountered.
412
412
} ) ;
413
413
414
414
test ( 'Error checking' , async ( ) => {
415
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
415
+ const config = Object . create ( getGoConfig ( ) , {
416
416
vetOnSave : { value : 'package' } ,
417
417
vetFlags : { value : [ '-all' ] } ,
418
418
lintOnSave : { value : 'package' } ,
@@ -575,7 +575,7 @@ It returns the number of bytes written and any write error encountered.
575
575
} ) ;
576
576
577
577
test ( 'Test Env Variables are passed to Tests' , async ( ) => {
578
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
578
+ const config = Object . create ( getGoConfig ( ) , {
579
579
testEnvVars : { value : { dummyEnvVar : 'dummyEnvValue' , dummyNonString : 1 } }
580
580
} ) ;
581
581
const uri = vscode . Uri . file ( path . join ( fixturePath , 'baseTest' , 'sample_test.go' ) ) ;
@@ -772,28 +772,28 @@ It returns the number of bytes written and any write error encountered.
772
772
773
773
test ( 'Workspace Symbols' , ( ) => {
774
774
const workspacePath = path . join ( fixturePath , 'vendoring' ) ;
775
- const configWithoutIgnoringFolders = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
775
+ const configWithoutIgnoringFolders = Object . create ( getGoConfig ( ) , {
776
776
gotoSymbol : {
777
777
value : {
778
778
ignoreFolders : [ ]
779
779
}
780
780
}
781
781
} ) ;
782
- const configWithIgnoringFolders = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
782
+ const configWithIgnoringFolders = Object . create ( getGoConfig ( ) , {
783
783
gotoSymbol : {
784
784
value : {
785
785
ignoreFolders : [ 'vendor' ]
786
786
}
787
787
}
788
788
} ) ;
789
- const configWithIncludeGoroot = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
789
+ const configWithIncludeGoroot = Object . create ( getGoConfig ( ) , {
790
790
gotoSymbol : {
791
791
value : {
792
792
includeGoroot : true
793
793
}
794
794
}
795
795
} ) ;
796
- const configWithoutIncludeGoroot = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
796
+ const configWithoutIncludeGoroot = Object . create ( getGoConfig ( ) , {
797
797
gotoSymbol : {
798
798
value : {
799
799
includeGoroot : false
@@ -887,7 +887,7 @@ encountered.
887
887
test ( 'Test Completion Snippets For Functions' , async ( ) => {
888
888
const provider = new GoCompletionItemProvider ( ) ;
889
889
const uri = vscode . Uri . file ( path . join ( fixturePath , 'completions' , 'snippets.go' ) ) ;
890
- const baseConfig = vscode . workspace . getConfiguration ( 'go' ) ;
890
+ const baseConfig = getGoConfig ( ) ;
891
891
const textDocument = await vscode . workspace . openTextDocument ( uri ) ;
892
892
const editor = await vscode . window . showTextDocument ( textDocument ) ;
893
893
@@ -1081,7 +1081,7 @@ encountered.
1081
1081
test ( 'Test No Completion Snippets For Functions' , async ( ) => {
1082
1082
const provider = new GoCompletionItemProvider ( ) ;
1083
1083
const uri = vscode . Uri . file ( path . join ( fixturePath , 'completions' , 'nosnippets.go' ) ) ;
1084
- const baseConfig = vscode . workspace . getConfiguration ( 'go' ) ;
1084
+ const baseConfig = getGoConfig ( ) ;
1085
1085
const textDocument = await vscode . workspace . openTextDocument ( uri ) ;
1086
1086
const editor = await vscode . window . showTextDocument ( textDocument ) ;
1087
1087
@@ -1146,7 +1146,7 @@ encountered.
1146
1146
} ) ;
1147
1147
1148
1148
test ( 'Test Completion on unimported packages' , async ( ) => {
1149
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
1149
+ const config = Object . create ( getGoConfig ( ) , {
1150
1150
autocompleteUnimportedPackages : { value : true }
1151
1151
} ) ;
1152
1152
const provider = new GoCompletionItemProvider ( ) ;
@@ -1177,7 +1177,7 @@ encountered.
1177
1177
} ) ;
1178
1178
1179
1179
test ( 'Test Completion on unimported packages (multiple)' , async ( ) => {
1180
- const config = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
1180
+ const config = Object . create ( getGoConfig ( ) , {
1181
1181
gocodeFlags : { value : [ '-builtin' ] }
1182
1182
} ) ;
1183
1183
const provider = new GoCompletionItemProvider ( ) ;
@@ -1293,7 +1293,7 @@ encountered.
1293
1293
}
1294
1294
fmt.Print("Go!")
1295
1295
}` ;
1296
- const goConfig = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
1296
+ const goConfig = Object . create ( getGoConfig ( ) , {
1297
1297
playground : { value : { run : true , openbrowser : false , share : false } }
1298
1298
} ) ;
1299
1299
@@ -1325,7 +1325,7 @@ encountered.
1325
1325
}
1326
1326
fmt.Print("Go!")
1327
1327
}` ;
1328
- const goConfig = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
1328
+ const goConfig = Object . create ( getGoConfig ( ) , {
1329
1329
playground : { value : { run : true , openbrowser : false , share : true } }
1330
1330
} ) ;
1331
1331
@@ -1355,7 +1355,7 @@ encountered.
1355
1355
func fantasy() {
1356
1356
fmt.Print("not a main package, sorry")
1357
1357
}` ;
1358
- const goConfig = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
1358
+ const goConfig = Object . create ( getGoConfig ( ) , {
1359
1359
playground : { value : { run : true , openbrowser : false , share : false } }
1360
1360
} ) ;
1361
1361
@@ -1417,29 +1417,29 @@ encountered.
1417
1417
} ) ;
1418
1418
1419
1419
test ( 'Test Tags checking' , async ( ) => {
1420
- const config1 = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
1420
+ const config1 = Object . create ( getGoConfig ( ) , {
1421
1421
vetOnSave : { value : 'off' } ,
1422
1422
lintOnSave : { value : 'off' } ,
1423
1423
buildOnSave : { value : 'package' } ,
1424
1424
testTags : { value : null } ,
1425
1425
buildTags : { value : 'randomtag' }
1426
1426
} ) ;
1427
1427
1428
- const config2 = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
1428
+ const config2 = Object . create ( getGoConfig ( ) , {
1429
1429
vetOnSave : { value : 'off' } ,
1430
1430
lintOnSave : { value : 'off' } ,
1431
1431
buildOnSave : { value : 'package' } ,
1432
1432
testTags : { value : 'randomtag' }
1433
1433
} ) ;
1434
1434
1435
- const config3 = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
1435
+ const config3 = Object . create ( getGoConfig ( ) , {
1436
1436
vetOnSave : { value : 'off' } ,
1437
1437
lintOnSave : { value : 'off' } ,
1438
1438
buildOnSave : { value : 'package' } ,
1439
1439
testTags : { value : 'randomtag othertag' }
1440
1440
} ) ;
1441
1441
1442
- const config4 = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
1442
+ const config4 = Object . create ( getGoConfig ( ) , {
1443
1443
vetOnSave : { value : 'off' } ,
1444
1444
lintOnSave : { value : 'off' } ,
1445
1445
buildOnSave : { value : 'package' } ,
0 commit comments