Skip to content

Commit 39fcae1

Browse files
committed
CodeMirror: remove auto-complete, so we're not bundling tern.
1 parent 0d5ef6b commit 39fcae1

File tree

1 file changed

+60
-60
lines changed
  • packages/app/src/app/components/CodeEditor/CodeMirror

1 file changed

+60
-60
lines changed

packages/app/src/app/components/CodeEditor/CodeMirror/index.js

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -225,66 +225,66 @@ class CodemirrorEditor extends React.Component<Props, State> implements Editor {
225225
}
226226
};
227227

228-
if (settings.autoCompleteEnabled) {
229-
const tern = await import(
230-
/* webpackChunkName: 'codemirror-tern' */ 'tern'
231-
).then(x => x.default);
232-
const defs = await import(
233-
/* webpackChunkName: 'codemirror-tern-definitions' */ 'tern/defs/ecmascript.json'
234-
);
235-
window.tern = tern;
236-
this.server =
237-
this.server ||
238-
new CodeMirror.TernServer({
239-
defs: [defs],
240-
});
241-
this.codemirror.on('cursorActivity', updateArgHints);
242-
this.codemirror.on('inputRead', showAutoComplete);
243-
this.codemirror.setOption('extraKeys', {
244-
'Ctrl-Space': cm => {
245-
if (this.server) this.server.complete(cm);
246-
},
247-
'Ctrl-I': cm => {
248-
if (this.server) this.server.showType(cm);
249-
},
250-
'Ctrl-O': cm => {
251-
if (this.server) this.server.showDocs(cm);
252-
},
253-
'Alt-.': cm => {
254-
if (this.server) this.server.jumpToDef(cm);
255-
},
256-
'Alt-,': cm => {
257-
if (this.server) this.server.jumpBack(cm);
258-
},
259-
'Ctrl-Q': cm => {
260-
if (this.server) this.server.rename(cm);
261-
},
262-
'Ctrl-.': cm => {
263-
if (this.server) this.server.selectName(cm);
264-
},
265-
Tab: cm => {
266-
// Indent, or place 2 spaces
267-
if (cm.somethingSelected()) {
268-
cm.indentSelection('add');
269-
} else {
270-
const spaces = Array(cm.getOption('indentUnit') + 1).join(' ');
271-
cm.replaceSelection(spaces, 'end', '+input');
272-
273-
try {
274-
cm.execCommand('emmetExpandAbbreviation');
275-
} catch (e) {
276-
console.error(e);
277-
}
278-
}
279-
},
280-
Enter: 'emmetInsertLineBreak',
281-
...defaultKeys,
282-
});
283-
} else {
284-
this.server = null;
285-
this.codemirror.off('cursorActivity', updateArgHints);
286-
this.codemirror.off('inputRead', showAutoComplete);
287-
}
228+
// if (settings.autoCompleteEnabled) {
229+
// const tern = await import(
230+
// /* webpackChunkName: 'codemirror-tern' */ 'tern'
231+
// ).then(x => x.default);
232+
// const defs = await import(
233+
// /* webpackChunkName: 'codemirror-tern-definitions' */ 'tern/defs/ecmascript.json'
234+
// );
235+
// window.tern = tern;
236+
// this.server =
237+
// this.server ||
238+
// new CodeMirror.TernServer({
239+
// defs: [defs],
240+
// });
241+
// this.codemirror.on('cursorActivity', updateArgHints);
242+
// this.codemirror.on('inputRead', showAutoComplete);
243+
// this.codemirror.setOption('extraKeys', {
244+
// 'Ctrl-Space': cm => {
245+
// if (this.server) this.server.complete(cm);
246+
// },
247+
// 'Ctrl-I': cm => {
248+
// if (this.server) this.server.showType(cm);
249+
// },
250+
// 'Ctrl-O': cm => {
251+
// if (this.server) this.server.showDocs(cm);
252+
// },
253+
// 'Alt-.': cm => {
254+
// if (this.server) this.server.jumpToDef(cm);
255+
// },
256+
// 'Alt-,': cm => {
257+
// if (this.server) this.server.jumpBack(cm);
258+
// },
259+
// 'Ctrl-Q': cm => {
260+
// if (this.server) this.server.rename(cm);
261+
// },
262+
// 'Ctrl-.': cm => {
263+
// if (this.server) this.server.selectName(cm);
264+
// },
265+
// Tab: cm => {
266+
// // Indent, or place 2 spaces
267+
// if (cm.somethingSelected()) {
268+
// cm.indentSelection('add');
269+
// } else {
270+
// const spaces = Array(cm.getOption('indentUnit') + 1).join(' ');
271+
// cm.replaceSelection(spaces, 'end', '+input');
272+
273+
// try {
274+
// cm.execCommand('emmetExpandAbbreviation');
275+
// } catch (e) {
276+
// console.error(e);
277+
// }
278+
// }
279+
// },
280+
// Enter: 'emmetInsertLineBreak',
281+
// ...defaultKeys,
282+
// });
283+
// } else {
284+
this.server = null;
285+
this.codemirror.off('cursorActivity', updateArgHints);
286+
this.codemirror.off('inputRead', showAutoComplete);
287+
// }
288288

289289
if (settings.vimMode) {
290290
await import(

0 commit comments

Comments
 (0)