@@ -2,7 +2,6 @@ import React from 'react';
2
2
import styled from '@emotion/styled' ;
3
3
import { keyframes } from '@emotion/core' ;
4
4
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api' ;
5
- const { MonacoServices } = require ( 'monaco-languageclient/lib/monaco-services' ) ;
6
5
import { extractSigners } from "util/parser" ;
7
6
8
7
@@ -173,24 +172,24 @@ class CadenceEditor extends React.Component<
173
172
}
174
173
}
175
174
176
- async initEditor ( ) {
175
+ async initEditor ( ) {
177
176
this . editor = monaco . editor . create (
178
- document . getElementById ( this . props . mount ) ,
179
- {
180
- theme : 'vs-light' ,
181
- language : CADENCE_LANGUAGE_ID ,
182
- minimap : {
183
- enabled : false ,
184
- } ,
177
+ document . getElementById ( this . props . mount ) ,
178
+ {
179
+ theme : 'vs-light' ,
180
+ language : CADENCE_LANGUAGE_ID ,
181
+ minimap : {
182
+ enabled : false ,
185
183
} ,
184
+ } ,
186
185
) ;
187
186
this . _subscription = this . editor . onDidChangeModelContent ( ( event : any ) => {
188
187
this . props . onChange ( this . editor . getValue ( ) , event ) ;
189
188
} ) ;
190
189
191
190
const state = this . getOrCreateEditorState (
192
- this . props . activeId ,
193
- this . props . code ,
191
+ this . props . activeId ,
192
+ this . props . code ,
194
193
) ;
195
194
this . editor . setModel ( state . model ) ;
196
195
this . editor . focus ( ) ;
@@ -318,20 +317,20 @@ class CadenceEditor extends React.Component<
318
317
const serverStatusChanged = this . props . serverReady !== prevProps . serverReady
319
318
const activeIdChanged = this . props . activeId !== prevProps . activeId
320
319
const typeChanged = this . props . type !== prevProps . type
321
- if ( serverStatusChanged || activeIdChanged || typeChanged ) {
322
- if ( this . props . callbacks . toServer !== null ) {
320
+ if ( serverStatusChanged || activeIdChanged || typeChanged ) {
321
+ if ( this . props . callbacks . toServer !== null ) {
323
322
await this . loadLanguageClient ( )
324
323
}
325
324
}
326
325
}
327
326
328
- async swapMonacoEditor ( prev : any , current : any ) {
327
+ async swapMonacoEditor ( prev : any , current : any ) {
329
328
await this . destroyMonaco ( ) ;
330
329
await this . initEditor ( ) ;
331
330
this . switchEditor ( prev , current ) ;
332
331
}
333
332
334
- destroyMonaco ( ) {
333
+ destroyMonaco ( ) {
335
334
if ( this . editor ) {
336
335
this . editor . dispose ( ) ;
337
336
const model = this . editor . getModel ( ) ;
0 commit comments