-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls: unimported completion should use the completion matcher
Fix a bug where unimported completion was using strings.HasPrefix directly, rather than using the configured completion matcher. Fixes golang/go#60545 Change-Id: I96e8e0b2dbfd9f007b166d4a82399c591ffd823a Reviewed-on: https://go-review.googlesource.com/c/tools/+/499795 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]> gopls-CI: kokoro <[email protected]>
- Loading branch information
Showing
2 changed files
with
42 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
gopls/internal/regtest/marker/testdata/completion/issue60545.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This test checks that unimported completion is case-insensitive. | ||
|
||
-- go.mod -- | ||
module mod.test | ||
|
||
go 1.18 | ||
|
||
-- main.go -- | ||
package main | ||
|
||
func main() { | ||
fmt.p //@complete(re"p()","Print", "Printf", "Println"), diag("fmt", re"(undefined|undeclared)") | ||
} | ||
|
||
-- other.go -- | ||
package main | ||
|
||
// Including another package that imports "fmt" causes completion to use the | ||
// existing metadata, which is the codepath leading to golang/go#60545. | ||
import "fmt" | ||
|
||
func _() { | ||
fmt.Println() | ||
} |