Skip to content

Commit 92ce962

Browse files
committed
minor update
1 parent cf6b033 commit 92ce962

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

client/modules/IDE/components/Editor.jsx

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -417,29 +417,28 @@ class Editor extends React.Component {
417417
closeOnUnfocus: false
418418
};
419419

420-
// CSS
421-
if (_cm.options.mode === 'css') {
420+
if (_cm.options.mode === 'javascript') {
421+
// JavaScript
422+
CodeMirror.showHint(
423+
_cm,
424+
() => {
425+
const c = _cm.getCursor();
426+
const token = _cm.getTokenAt(c);
427+
428+
const hints = this.hinter.search(token.string);
429+
430+
return {
431+
list: hints,
432+
from: CodeMirror.Pos(c.line, token.start),
433+
to: CodeMirror.Pos(c.line, c.ch)
434+
};
435+
},
436+
hintOptions
437+
);
438+
} else if (_cm.options.mode === 'css') {
439+
// CSS
422440
CodeMirror.showHint(_cm, CodeMirror.hint.css, hintOptions);
423-
return;
424441
}
425-
426-
// JavaScript
427-
CodeMirror.showHint(
428-
_cm,
429-
() => {
430-
const c = _cm.getCursor();
431-
const token = _cm.getTokenAt(c);
432-
433-
const hints = this.hinter.search(token.string);
434-
435-
return {
436-
list: hints,
437-
from: CodeMirror.Pos(c.line, token.start),
438-
to: CodeMirror.Pos(c.line, c.ch)
439-
};
440-
},
441-
hintOptions
442-
);
443442
}
444443

445444
showReplace() {

client/modules/IDE/components/show-hint.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,14 @@
323323
else {
324324
const e = ownerDocument.createElement('p');
325325
const name = getText(cur);
326+
326327
if (cur.item && cur.item.type) {
327328
cur.displayText = displayHint(name, cur.item.type);
328329
}
330+
329331
elt.appendChild(e);
330332
e.outerHTML =
331-
cur.displayText ||
332-
`<span class="plain-hint-item">${getText(cur)}<span>`;
333+
cur.displayText || `<span class="plain-hint-item">${name}<span>`;
333334
}
334335
elt.hintId = i;
335336
}

0 commit comments

Comments
 (0)