Skip to content

Commit 742627a

Browse files
committed
[sql-hint addon] Fix retrieving of parser config
1 parent 407d1f1 commit 742627a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

addon/hint/sql-hint.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@
2323

2424
function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" }
2525

26+
function getModeConf(editor) {
27+
return editor.getModeAt(editor.getCursor()).config || CodeMirror.resolveMode("text/x-sql")
28+
}
29+
2630
function getKeywords(editor) {
27-
return editor.getModeAt(editor.getCursor()).keywords || CodeMirror.resolveMode("text/x-sql").keywords;
31+
return getModeConf(editor).keywords || []
2832
}
2933

3034
function getIdentifierQuote(editor) {
31-
return editor.getModeAt(editor.getCursor()).identifierQuote ||
32-
CodeMirror.resolveMode("text/x-sql").identifierQuote ||
33-
"`";
35+
return getModeConf(editor).identifierQuote || "`";
3436
}
3537

3638
function getText(item) {

mode/sql/sql.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)