| 1 |
This test verifies that unimported completion respects the usePlaceholders setting. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-ignore_extra_diags |
| 5 |
|
| 6 |
-- settings.json -- |
| 7 |
{ |
| 8 |
"usePlaceholders": false |
| 9 |
} |
| 10 |
|
| 11 |
-- go.mod -- |
| 12 |
module mod.test |
| 13 |
|
| 14 |
go 1.21 |
| 15 |
|
| 16 |
-- foo/foo.go -- |
| 17 |
package foo |
| 18 |
|
| 19 |
func _() { |
| 20 |
// This uses goimports-based completion; TODO: this should insert snippets. |
| 21 |
os.Open //@acceptcompletion(re"Open()", "Open", open) |
| 22 |
} |
| 23 |
|
| 24 |
func _() { |
| 25 |
// This uses metadata-based completion. |
| 26 |
errors.New //@acceptcompletion(re"New()", "New", new) |
| 27 |
} |
| 28 |
|
| 29 |
-- bar/bar.go -- |
| 30 |
package bar |
| 31 |
|
| 32 |
import _ "errors" // important: doesn't transitively import os. |
| 33 |
|
| 34 |
-- @new/foo/foo.go -- |
| 35 |
package foo |
| 36 |
|
| 37 |
import "errors" |
| 38 |
|
| 39 |
func _() { |
| 40 |
// This uses goimports-based completion; TODO: this should insert snippets. |
| 41 |
os.Open //@acceptcompletion(re"Open()", "Open", open) |
| 42 |
} |
| 43 |
|
| 44 |
func _() { |
| 45 |
// This uses metadata-based completion. |
| 46 |
errors.New(${1:}) //@acceptcompletion(re"New()", "New", new) |
| 47 |
} |
| 48 |
|
| 49 |
-- @open/foo/foo.go -- |
| 50 |
package foo |
| 51 |
|
| 52 |
import "os" |
| 53 |
|
| 54 |
func _() { |
| 55 |
// This uses goimports-based completion; TODO: this should insert snippets. |
| 56 |
os.Open(${1:}) //@acceptcompletion(re"Open()", "Open", open) |
| 57 |
} |
| 58 |
|
| 59 |
func _() { |
| 60 |
// This uses metadata-based completion. |
| 61 |
errors.New //@acceptcompletion(re"New()", "New", new) |
| 62 |
} |
| 63 |
|