@@ -136,7 +136,10 @@ export default class PluginExplorer extends Morph {
136136 set systemJS ( bool ) {
137137 this . systemJSButton . classList . toggle ( "on" , bool ) ;
138138 }
139- onToggleSystemJs ( ) { this . toggleOption ( "systemJS" ) ; }
139+ onToggleSystemJs ( ) {
140+ this . toggleOption ( "systemJS" ) ;
141+ this . updateAST ( ) ;
142+ }
140143
141144 onDebug ( ) {
142145 if ( ! this . getOption ( "systemJS" ) ) {
@@ -376,7 +379,7 @@ export default class PluginExplorer extends Morph {
376379 this . transformedSourceLCM . value = code ;
377380
378381 if ( this . autoExecute ) this . execute ( ) ;
379- if ( this . autoRunTests ) runTests ( ) ;
382+ if ( this . autoRunTests ) this . runTests ( ) ;
380383 }
381384
382385 async updateTransformation ( ast ) {
@@ -389,6 +392,7 @@ export default class PluginExplorer extends Morph {
389392 lively . error ( "lively4lastSystemJSBabelConfig missing" ) ;
390393 return ;
391394 }
395+ const plugin = await this . getPlugin ( ) ;
392396 let config = Object . assign ( { } , self . lively4lastSystemJSBabelConfig ) ;
393397 let url = this . fullUrl ( this . pluginURL ) || "" ;
394398 let originalPluginURL = url . replace ( / - d e v / , "" ) ; // name of the original plugin .... the one without -dev
@@ -409,6 +413,7 @@ export default class PluginExplorer extends Morph {
409413 const filename = 'tempfile.js' ;
410414 config . sourceFileName = filename
411415 config . moduleIds = false ;
416+ config . sourceMaps = true ;
412417
413418
414419 // here for documenting the babel hook
@@ -420,10 +425,9 @@ export default class PluginExplorer extends Morph {
420425 } ;
421426
422427 this . transformationResult = babel . transform ( this . sourceText , config ) ;
423-
424-
425- this . updateAndExecute ( this . transformationResult . code ) ;
426428 }
429+
430+ this . updateAndExecute ( this . transformationResult . code ) ;
427431
428432
429433 } catch ( e ) {
@@ -499,14 +503,12 @@ export default class PluginExplorer extends Morph {
499503 }
500504
501505 mapEditorsFromToPosition ( fromTextEditor , toTextEditor , backward ) {
502- if ( backward == true ) {
503- var method = "originalPositionFor"
504- } else {
505- method = "generatedPositionFor"
506- }
506+ debugger
507+ let positionFor = backward ? this [ "originalPositionFor" ] : this [ "generatedPositionFor" ] ;
508+
507509 var range = fromTextEditor . listSelections ( ) [ 0 ]
508- var start = this [ method ] ( range . anchor . line + 1 , range . anchor . ch + 1 )
509- var end = this [ method ] ( range . head . line + 1 , range . head . ch + 1 )
510+ var start = positionFor . call ( this , range . anchor . line + 1 , range . anchor . ch + 1 )
511+ var end = positionFor . call ( this , range . head . line + 1 , range . head . ch + 1 )
510512
511513 //lively.notify(`start ${range.anchor.line} ch ${range.anchor.ch} -> ${start.line} ch ${start.column} / end ${range.head.line} ch ${range.head.ch} -> ${end.line} c ${end.column}`)
512514 if ( ! start || ! end ) return ;
0 commit comments