mirror of
https://github.com/golang/go
synced 2024-11-18 17:54:57 -07:00
138c814f66
Now we offer an error-check-and-return completion candidate when appropriate: func myFunc() (int, error) { f, err := os.Open("foo") <> } offers the candidate: if err != nil { return 0, <err> } where <> denotes a placeholder so you can easily alter "err". The completion will only be offered when: 1. The position is in a function that returns an error as final result value, and 2. The statement preceding position is an assignment whose final LHS value is an error. The completion will contain zero values for the non-error return values as necessary. Using the above example, the completion will be offered after the user has typed: i if if err Basically the candidate will be offered after every keystroke as the user types "if err". I call this new type of completion a statement completion - perfect for when you want to make a statement! Change-Id: I0a330e1c1fa81a2757d3afc84c24e853f46f26b0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/221613 Run-TryBot: Muir Manders <muir@mnd.rs> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org> |
||
---|---|---|
.. | ||
indirect | ||
lsp | ||
missingdep | ||
missingtwodep | ||
unused | ||
upgradedep |