Skip to content

Commit 407d1f1

Browse files
committed
[sql-hint addon] Make completion work when SQL isn't the outermost mode
Closes #5249
1 parent 2e3df70 commit 407d1f1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

addon/hint/sql-hint.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@
2424
function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" }
2525

2626
function getKeywords(editor) {
27-
var mode = editor.doc.modeOption;
28-
if (mode === "sql") mode = "text/x-sql";
29-
return CodeMirror.resolveMode(mode).keywords;
27+
return editor.getModeAt(editor.getCursor()).keywords || CodeMirror.resolveMode("text/x-sql").keywords;
3028
}
3129

3230
function getIdentifierQuote(editor) {
33-
var mode = editor.doc.modeOption;
34-
if (mode === "sql") mode = "text/x-sql";
35-
return CodeMirror.resolveMode(mode).identifierQuote || "`";
31+
return editor.getModeAt(editor.getCursor()).identifierQuote ||
32+
CodeMirror.resolveMode("text/x-sql").identifierQuote ||
33+
"`";
3634
}
3735

3836
function getText(item) {

0 commit comments

Comments
 (0)