1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 . "golang.org/x/tools/gopls/internal/regtest"
12 "golang.org/x/tools/internal/lsp/fake"
13 "golang.org/x/tools/internal/testenv"
16 // Test that enabling and disabling produces the expected results of showing
17 // and hiding staticcheck analysis results.
18 func TestChangeConfiguration(t *testing.T) {
19 // Staticcheck only supports Go versions > 1.14.
20 testenv.NeedsGo1Point(t, 15)
30 // NotThisVariable should really start with ThisVariable.
31 const ThisVariable = 7
33 Run(t, files, func(t *testing.T, env *Env) {
34 env.OpenFile("a/a.go")
37 NoDiagnostics("a/a.go"),
39 cfg := &fake.EditorConfig{}
40 *cfg = env.Editor.Config
41 cfg.EnableStaticcheck = true
42 env.ChangeConfiguration(t, cfg)
44 DiagnosticAt("a/a.go", 2, 0),