@@ -55,32 +55,26 @@ class InPlaceReplaceController implements IEditorContribution {
55
55
return InPlaceReplaceController . ID ;
56
56
}
57
57
58
- public run ( source : string , up : boolean ) : Promise < void > {
58
+ public run ( source : string , up : boolean ) : Promise < void > | undefined {
59
59
60
60
// cancel any pending request
61
61
if ( this . currentRequest ) {
62
62
this . currentRequest . cancel ( ) ;
63
63
}
64
64
65
- let selection = this . editor . getSelection ( ) ;
66
- if ( selection === null ) {
67
- return Promise . resolve ( void 0 ) ;
68
- }
69
-
65
+ const editorSelection = this . editor . getSelection ( ) ;
70
66
const model = this . editor . getModel ( ) ;
71
- if ( ! model ) {
72
- return Promise . resolve ( void 0 ) ;
67
+ if ( ! model || ! editorSelection ) {
68
+ return undefined ;
73
69
}
74
-
75
- const modelURI = model . uri ;
76
-
70
+ let selection = editorSelection ;
77
71
if ( selection . startLineNumber !== selection . endLineNumber ) {
78
72
// Can't accept multiline selection
79
- return Promise . resolve ( void 0 ) ;
73
+ return undefined ;
80
74
}
81
75
82
76
const state = new EditorState ( this . editor , CodeEditorStateFlag . Value | CodeEditorStateFlag . Position ) ;
83
-
77
+ const modelURI = model . uri ;
84
78
if ( ! this . editorWorkerService . canNavigateValueSet ( modelURI ) ) {
85
79
return Promise . resolve ( void 0 ) ;
86
80
}
@@ -155,8 +149,8 @@ class InPlaceReplaceUp extends EditorAction {
155
149
} ) ;
156
150
}
157
151
158
- public run ( accessor : ServicesAccessor , editor : ICodeEditor ) : Promise < void > {
159
- let controller = InPlaceReplaceController . get ( editor ) ;
152
+ public run ( accessor : ServicesAccessor , editor : ICodeEditor ) : Promise < void > | undefined {
153
+ const controller = InPlaceReplaceController . get ( editor ) ;
160
154
if ( ! controller ) {
161
155
return Promise . resolve ( void 0 ) ;
162
156
}
@@ -180,8 +174,8 @@ class InPlaceReplaceDown extends EditorAction {
180
174
} ) ;
181
175
}
182
176
183
- public run ( accessor : ServicesAccessor , editor : ICodeEditor ) : Promise < void > {
184
- let controller = InPlaceReplaceController . get ( editor ) ;
177
+ public run ( accessor : ServicesAccessor , editor : ICodeEditor ) : Promise < void > | undefined {
178
+ const controller = InPlaceReplaceController . get ( editor ) ;
185
179
if ( ! controller ) {
186
180
return Promise . resolve ( void 0 ) ;
187
181
}
0 commit comments