| 1 |
This test checks that completion gives correct completion for an incomplete struct field type. |
| 2 |
It ensures that completion in invalid code returns the correct replacement range and doesn't result in unwanted deletion. |
| 3 |
See https://github.com/golang/go/issues/77481. |
| 4 |
|
| 5 |
-- flags -- |
| 6 |
-ignore_extra_diags |
| 7 |
|
| 8 |
-- go.mod -- |
| 9 |
module mod.test |
| 10 |
|
| 11 |
go 1.21 |
| 12 |
|
| 13 |
-- simple.go -- |
| 14 |
package editor |
| 15 |
|
| 16 |
type colorex struct{} |
| 17 |
|
| 18 |
type Theme struct { |
| 19 |
MainTextColor colore //@acceptcompletion(re"colore()", "colorex", simple) |
| 20 |
MenuHeight float32 |
| 21 |
} |
| 22 |
|
| 23 |
-- @simple/simple.go -- |
| 24 |
package editor |
| 25 |
|
| 26 |
type colorex struct{} |
| 27 |
|
| 28 |
type Theme struct { |
| 29 |
MainTextColor colorex //@acceptcompletion(re"colore()", "colorex", simple) |
| 30 |
MenuHeight float32 |
| 31 |
} |
| 32 |
|
| 33 |
-- with_init.go -- |
| 34 |
package editor |
| 35 |
|
| 36 |
type colorex2 struct{} |
| 37 |
|
| 38 |
type Theme2 struct { |
| 39 |
MainTextColor colore //@acceptcompletion(re"colore()", "colorex2", with_init) |
| 40 |
|
| 41 |
MenuHeight float32 = 20 |
| 42 |
ToolbarHeight float32 = 30 |
| 43 |
TabButtonWidth float32 = 60 |
| 44 |
TabButtonHeight float32 = 30 |
| 45 |
} |
| 46 |
|
| 47 |
-- @with_init/with_init.go -- |
| 48 |
package editor |
| 49 |
|
| 50 |
type colorex2 struct{} |
| 51 |
|
| 52 |
type Theme2 struct { |
| 53 |
MainTextColor colorex2 //@acceptcompletion(re"colore()", "colorex2", with_init) |
| 54 |
|
| 55 |
MenuHeight float32 = 20 |
| 56 |
ToolbarHeight float32 = 30 |
| 57 |
TabButtonWidth float32 = 60 |
| 58 |
TabButtonHeight float32 = 30 |
| 59 |
} |
| 60 |
|