-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/golang: add resolve support for inline refactorings
Resolve edits for inline refactorings when the client supports it. For golang/go#64510 Change-Id: I67101ab19576054b1d03c46e3d318a4660088a63 Reviewed-on: https://go-review.googlesource.com/c/tools/+/562118 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
- Loading branch information
Showing
3 changed files
with
44 additions
and
11 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
35 changes: 35 additions & 0 deletions
35
gopls/internal/test/marker/testdata/codeaction/inline_resolve.txt
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,35 @@ | ||
This is a minimal test of the refactor.inline code actions, with resolve support. | ||
See inline.txt for same test without resolve support. | ||
|
||
-- capabilities.json -- | ||
{ | ||
"textDocument": { | ||
"codeAction": { | ||
"dataSupport": true, | ||
"resolveSupport": { | ||
"properties": ["edit"] | ||
} | ||
} | ||
} | ||
} | ||
-- go.mod -- | ||
module example.com/codeaction | ||
go 1.18 | ||
|
||
-- a/a.go -- | ||
package a | ||
|
||
func _() { | ||
println(add(1, 2)) //@codeaction("add", ")", "refactor.inline", inline) | ||
} | ||
|
||
func add(x, y int) int { return x + y } | ||
|
||
-- @inline/a/a.go -- | ||
package a | ||
|
||
func _() { | ||
println(1 + 2) //@codeaction("add", ")", "refactor.inline", inline) | ||
} | ||
|
||
func add(x, y int) int { return x + y } |