-
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.
internal/lsp/source: use the real type parameter in snippet completions
This change makes source.FormatVarType return the instantiated type parameter instead of the actual AST expression because that will just refer to the abstract type parameter and not the insantiated one. I am not sure if this covers all edge cases or if there's a better solution but I'm happy to adjust to whatever is appropriate. Fixes golang/go#50623 Change-Id: I6e0b2d93c47c9a0502f2995ca8d3668a9a31c056 Reviewed-on: https://go-review.googlesource.com/c/tools/+/378714 Trust: Robert Findley <[email protected]> Run-TryBot: Peter Weinberger <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Peter Weinberger <[email protected]>
- Loading branch information
1 parent
80963bc
commit 9f83dd3
Showing
3 changed files
with
25 additions
and
2 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
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,14 @@ | ||
// +build go1.18 | ||
//go:build go1.18 | ||
|
||
package snippets | ||
|
||
type Tree[T any] struct{} | ||
|
||
func (tree Tree[T]) Do(f func(s T)) {} | ||
|
||
func _() { | ||
_ = "func(...) {}" //@item(litFunc, "func(...) {}", "", "var") | ||
var t Tree[string] | ||
t.Do(fun) //@complete(")", litFunc),snippet(")", litFunc, "func(s string) {$0\\}", "func(s string) {$0\\}") | ||
} |
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