Commit 7086838
committed
gopls/internal/golang: Extract function: simplify using Cursor
This change deletes adjustRangeForCommentsAndWhiteSpace,
which duplicates functionality in PathEnclosingInterval
to turn a rough selection (including extraneous whitespace)
into a precise selection aligned with syntax nodes.
Instead we use a new function, astutil.Select, that does
the same thing but on Cursors, and push cursors throughout
the rest of the extract logic. In due course it should
replace all existing uses of PathEnclosingInterval.
Extract Variable will be dealt with in a follow-up.
Change-Id: I7c67757ffa4233d5e7a6f02e44e68e14c46faee7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/716340
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Madeline Kalil <[email protected]>
Auto-Submit: Alan Donovan <[email protected]>1 parent 63a7b87 commit 7086838
File tree
5 files changed
+156
-202
lines changed- gopls/internal
- golang
- util/cursorutil
- internal/astutil
5 files changed
+156
-202
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
486 | | - | |
| 486 | + | |
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
495 | | - | |
| 495 | + | |
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
| |||
0 commit comments