зеркало из https://github.com/golang/tools.git
gopls/internal/golang: splitlines: remove workaround for golang/go#68202
There's no need for splitlines to handle FuncDecl since it handles FuncType... now that the bug in PathEnclosingInterval is fixed. Updates golang/go#68202 Change-Id: I3c96535b87c62e5d2a5b68ec66fed7df50b5d6c4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/595196 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Родитель
69160777a9
Коммит
5cc2d0b12c
|
@ -166,20 +166,8 @@ func findSplitJoinTarget(fset *token.FileSet, file *ast.File, src []byte, start,
|
|||
path, _ := astutil.PathEnclosingInterval(file, start, end)
|
||||
for _, node := range path {
|
||||
switch node := node.(type) {
|
||||
case *ast.FuncDecl:
|
||||
// target struct method declarations.
|
||||
// function (...) someMethod(a int, b int, c int) (d int, e, int) {}
|
||||
params := node.Type.Params
|
||||
if isCursorInside(params.Opening, params.Closing) {
|
||||
return "parameters", params, params.Opening, params.Closing
|
||||
}
|
||||
|
||||
results := node.Type.Results
|
||||
if results != nil && isCursorInside(results.Opening, results.Closing) {
|
||||
return "results", results, results.Opening, results.Closing
|
||||
}
|
||||
case *ast.FuncType:
|
||||
// target function signature args and result.
|
||||
// target function signature parameters and results.
|
||||
// type someFunc func (a int, b int, c int) (d int, e int)
|
||||
params := node.Params
|
||||
if isCursorInside(params.Opening, params.Closing) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче