@@ -106,7 +106,7 @@ func CodeActions(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle,
106
106
}
107
107
108
108
if want [protocol .RefactorInline ] {
109
- rewrites , err := getInlineCodeActions (pkg , pgf , rng )
109
+ rewrites , err := getInlineCodeActions (pkg , pgf , rng , snapshot . Options () )
110
110
if err != nil {
111
111
return nil , err
112
112
}
@@ -381,7 +381,7 @@ func canRemoveParameter(pkg *cache.Package, pgf *ParsedGoFile, rng protocol.Rang
381
381
}
382
382
383
383
// getInlineCodeActions returns refactor.inline actions available at the specified range.
384
- func getInlineCodeActions (pkg * cache.Package , pgf * ParsedGoFile , rng protocol.Range ) ([]protocol.CodeAction , error ) {
384
+ func getInlineCodeActions (pkg * cache.Package , pgf * ParsedGoFile , rng protocol.Range , options * settings. Options ) ([]protocol.CodeAction , error ) {
385
385
start , end , err := pgf .RangePos (rng )
386
386
if err != nil {
387
387
return nil , err
@@ -391,9 +391,10 @@ func getInlineCodeActions(pkg *cache.Package, pgf *ParsedGoFile, rng protocol.Ra
391
391
var commands []protocol.Command
392
392
if _ , fn , err := EnclosingStaticCall (pkg , pgf , start , end ); err == nil {
393
393
cmd , err := command .NewApplyFixCommand (fmt .Sprintf ("Inline call to %s" , fn .Name ()), command.ApplyFixArgs {
394
- Fix : fixInlineCall ,
395
- URI : pgf .URI ,
396
- Range : rng ,
394
+ Fix : fixInlineCall ,
395
+ URI : pgf .URI ,
396
+ Range : rng ,
397
+ ResolveEdits : supportsResolveEdits (options ),
397
398
})
398
399
if err != nil {
399
400
return nil , err
@@ -404,11 +405,7 @@ func getInlineCodeActions(pkg *cache.Package, pgf *ParsedGoFile, rng protocol.Ra
404
405
// Convert commands to actions.
405
406
var actions []protocol.CodeAction
406
407
for i := range commands {
407
- actions = append (actions , protocol.CodeAction {
408
- Title : commands [i ].Title ,
409
- Kind : protocol .RefactorInline ,
410
- Command : & commands [i ],
411
- })
408
+ actions = append (actions , newCodeAction (commands [i ].Title , protocol .RefactorInline , & commands [i ], nil , options ))
412
409
}
413
410
return actions , nil
414
411
}
0 commit comments