@@ -32,34 +32,29 @@ export default class CodeActionProvider extends AbstractProvider implements vsco
32
32
33
33
let line = range . start . line ;
34
34
let column = range . start . character ;
35
- let selection : protocol . V2 . Range | undefined ;
35
+
36
+ let request : protocol . V2 . GetCodeActionsRequest = {
37
+ FileName : document . fileName ,
38
+ Line : line ,
39
+ Column : column ,
40
+ } ;
36
41
37
42
// Only suggest selection-based refactorings when a selection exists.
38
43
// If there is no selection and the editor isn't focused,
39
44
// VS Code will pass us an empty Selection rather than a Range,
40
45
// hence the extra range.isEmpty check.
41
46
if ( range instanceof vscode . Selection && ! range . isEmpty ) {
42
- selection = {
47
+ request . Selection = {
43
48
Start : { Line : range . start . line , Column : range . start . character } ,
44
49
End : { Line : range . end . line , Column : range . end . character }
45
50
} ;
46
51
}
47
52
48
- let request : protocol . V2 . GetCodeActionsRequest = {
49
- FileName : document . fileName ,
50
- Line : line ,
51
- Column : column ,
52
- Selection : selection
53
- } ;
54
-
55
53
try {
56
54
let response = await serverUtils . getCodeActions ( this . _server , request , token ) ;
57
55
return response . CodeActions . map ( codeAction => {
58
56
let runRequest : protocol . V2 . RunCodeActionRequest = {
59
- FileName : document . fileName ,
60
- Line : line ,
61
- Column : column ,
62
- Selection : selection ,
57
+ ...request ,
63
58
Identifier : codeAction . Identifier ,
64
59
WantsTextChanges : true ,
65
60
WantsAllCodeActionOperations : true ,
0 commit comments