@@ -12,6 +12,18 @@ type AceModule = import('ace-builds').Ace.Editor;
12
12
type AceCompleter = import ( 'ace-builds' ) . Ace . Completer ;
13
13
type AceCompletion = import ( 'ace-builds' ) . Ace . Completion ;
14
14
15
+ interface CodeMirrorEditor {
16
+ ace : AceModule ;
17
+ }
18
+
19
+ interface VimKeybindings {
20
+ CodeMirror : {
21
+ Vim : {
22
+ defineEx : ( cmd : string , key : string , cb : ( cm : CodeMirrorEditor ) => void ) => void ;
23
+ } ;
24
+ } ;
25
+ }
26
+
15
27
const displayExternCrateAutocomplete = ( editor : AceModule , autocompleteOnUse : boolean ) => {
16
28
const { session } = editor ;
17
29
const pos = editor . getCursorPosition ( ) ;
@@ -241,8 +253,8 @@ const AceEditor: React.FC<AceEditorProps> = props => {
241
253
editor . setOption ( 'keyboardHandler' , handler ) ;
242
254
243
255
if ( keybinding === 'vim' ) {
244
- const { CodeMirror : { Vim } } = ace . require ( 'ace/keyboard/vim' ) ;
245
- Vim . defineEx ( 'write' , 'w' , ( cm , _input ) => {
256
+ const { CodeMirror : { Vim } } : VimKeybindings = ace . require ( 'ace/keyboard/vim' ) ;
257
+ Vim . defineEx ( 'write' , 'w' , ( cm ) => {
246
258
cm . ace . execCommand ( 'executeCode' ) ;
247
259
} ) ;
248
260
}
@@ -333,7 +345,7 @@ interface AceEditorAsyncProps {
333
345
}
334
346
335
347
class AceEditorAsync extends React . Component < AceEditorAsyncProps , AceEditorAsyncState > {
336
- public constructor ( props ) {
348
+ public constructor ( props : AceEditorAsyncProps ) {
337
349
super ( props ) ;
338
350
this . state = {
339
351
modeState : LoadState . Unloaded ,
@@ -359,7 +371,7 @@ class AceEditorAsync extends React.Component<AceEditorAsyncProps, AceEditorAsync
359
371
this . load ( ) ;
360
372
}
361
373
362
- public componentDidUpdate ( _prevProps , _prevState ) {
374
+ public componentDidUpdate ( ) {
363
375
if ( this . isLoadNeeded ( ) ) {
364
376
this . load ( ) ;
365
377
}
0 commit comments