[sql-hint addon] Fix retrieving of parser config

This commit is contained in:
Marijn Haverbeke 2022-11-15 09:36:27 +01:00
parent 407d1f1c89
commit 742627abca
2 changed files with 8 additions and 5 deletions

View File

@ -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) {

View File

@ -207,7 +207,8 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
blockCommentStart: "/*",
blockCommentEnd: "*/",
lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : "--",
closeBrackets: "()[]{}''\"\"``"
closeBrackets: "()[]{}''\"\"``",
config: parserConfig
};
});