Skip to content

Commit afd8428

Browse files
findleyrgopherbot
authored andcommitted
gopls/internal/test/integration: slightly more ergonomic FolderSettings
After setting CL 563475 for autosubmit, I realized we should use a slightly more ergonomic pattern for configuring folder settings. Change-Id: I3a4e9e3dca3f4865c3bca02258cd81ff2b7024b3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/563402 Reviewed-by: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Robert Findley <[email protected]>
1 parent c5643e9 commit afd8428

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

gopls/internal/test/integration/misc/configuration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ type B struct {
7878

7979
WithOptions(
8080
WorkspaceFolders("a"),
81-
FolderSettings(map[string]Settings{
81+
FolderSettings{
8282
"a": {
8383
"analyses": map[string]bool{
8484
"composites": false,
8585
},
8686
},
87-
}),
87+
},
8888
).Run(t, files, func(t *testing.T, env *Env) {
8989
env.OpenFile("a/a.go")
9090
env.AfterChange(NoDiagnostics())

gopls/internal/test/integration/options.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,16 @@ func WorkspaceFolders(relFolders ...string) RunOption {
115115
//
116116
// Use in conjunction with WorkspaceFolders to have different settings for
117117
// different folders.
118-
func FolderSettings(folderSettings map[string]Settings) RunOption {
118+
type FolderSettings map[string]Settings
119+
120+
func (fs FolderSettings) set(opts *runConfig) {
119121
// Re-use the Settings type, for symmetry, but translate back into maps for
120122
// the editor config.
121123
folders := make(map[string]map[string]any)
122-
for k, v := range folderSettings {
124+
for k, v := range fs {
123125
folders[k] = v
124126
}
125-
return optionSetter(func(opts *runConfig) {
126-
opts.editor.FolderSettings = folders
127-
})
127+
opts.editor.FolderSettings = folders
128128
}
129129

130130
// EnvVars sets environment variables for the LSP session. When applying these

0 commit comments

Comments
 (0)