Skip to content

Commit

Permalink
[sql-hint addon] Fix retrieving of parser config
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Nov 15, 2022
1 parent 407d1f1 commit 742627a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions addon/hint/sql-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@

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

function getModeConf(editor) {
return editor.getModeAt(editor.getCursor()).config || CodeMirror.resolveMode("text/x-sql")
}

function getKeywords(editor) {
return editor.getModeAt(editor.getCursor()).keywords || CodeMirror.resolveMode("text/x-sql").keywords;
return getModeConf(editor).keywords || []
}

function getIdentifierQuote(editor) {
return editor.getModeAt(editor.getCursor()).identifierQuote ||
CodeMirror.resolveMode("text/x-sql").identifierQuote ||
"`";
return getModeConf(editor).identifierQuote || "`";
}

function getText(item) {
Expand Down
3 changes: 2 additions & 1 deletion mode/sql/sql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 742627a

Please sign in to comment.