Skip to content

Commit

Permalink
gopls/internal/golang: splitlines: remove workaround for golang/go#68202
Browse files Browse the repository at this point in the history


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>
  • Loading branch information
adonovan committed Jun 27, 2024
1 parent 6916077 commit 5cc2d0b
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions gopls/internal/golang/lines.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5cc2d0b

Please sign in to comment.