@@ -69,25 +69,25 @@ export default class CodeEditor extends React.PureComponent {
6969 props : Props ;
7070
7171 shouldComponentUpdate ( nextProps : Props ) {
72- return nextProps . id !== this . props . id ||
72+ return (
73+ nextProps . id !== this . props . id ||
7374 nextProps . error !== this . props . error ||
7475 this . props . canSave !== nextProps . canSave ||
75- this . props . preferences !== nextProps . preferences ;
76+ this . props . preferences !== nextProps . preferences
77+ ) ;
7678 }
7779
78- swapDocuments = async (
79- {
80- currentId,
81- nextId,
82- nextCode,
83- nextTitle,
84- } : {
85- currentId : string ,
86- nextId : string ,
87- nextCode : ?string ,
88- nextTitle : string ,
89- }
90- ) => {
80+ swapDocuments = async ( {
81+ currentId,
82+ nextId,
83+ nextCode,
84+ nextTitle,
85+ } : {
86+ currentId : string ,
87+ nextId : string ,
88+ nextCode : ?string ,
89+ nextTitle : string ,
90+ } ) => {
9191 if ( nextId !== currentId || nextCode !== this . getCode ( ) ) {
9292 if ( ! documentCache [ nextId ] ) {
9393 const mode = await this . getMode ( nextTitle ) ;
@@ -170,10 +170,6 @@ export default class CodeEditor extends React.PureComponent {
170170 const { preferences } = this . props ;
171171
172172 const defaultKeys = {
173- Tab : cm => {
174- const spaces = Array ( cm . getOption ( 'indentUnit' ) + 1 ) . join ( ' ' ) ;
175- cm . replaceSelection ( spaces ) ;
176- } ,
177173 'Cmd-/' : cm => {
178174 cm . listSelections ( ) . forEach ( ( ) => {
179175 cm . toggleComment ( { lineComment : '//' } ) ;
@@ -200,14 +196,14 @@ export default class CodeEditor extends React.PureComponent {
200196 const tern = await System . import ( 'tern' ) ;
201197 const defs = await System . import ( 'tern/defs/ecmascript.json' ) ;
202198 window . tern = tern ;
203- this . server = this . server ||
199+ this . server =
200+ this . server ||
204201 new CodeMirror . TernServer ( {
205202 defs : [ defs ] ,
206203 } ) ;
207204 this . codemirror . on ( 'cursorActivity' , updateArgHints ) ;
208205 this . codemirror . on ( 'inputRead' , showAutoComplete ) ;
209206 this . codemirror . setOption ( 'extraKeys' , {
210- ...defaultKeys ,
211207 'Ctrl-Space' : cm => {
212208 if ( this . server ) this . server . complete ( cm ) ;
213209 } ,
@@ -229,6 +225,7 @@ export default class CodeEditor extends React.PureComponent {
229225 'Ctrl-.' : cm => {
230226 if ( this . server ) this . server . selectName ( cm ) ;
231227 } ,
228+ ...defaultKeys ,
232229 } ) ;
233230 } else {
234231 this . server = null ;
0 commit comments