mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 05:16:00 +00:00
code completion fixes
This commit is contained in:
@@ -9,7 +9,7 @@ export default function analyseQuerySources(sql, sourceNames) {
|
|||||||
const wordUpper = word.toUpperCase();
|
const wordUpper = word.toUpperCase();
|
||||||
if (upperSourceNames.includes(wordUpper)) {
|
if (upperSourceNames.includes(wordUpper)) {
|
||||||
const preWord = tokens[i - 1];
|
const preWord = tokens[i - 1];
|
||||||
if (preWord && /^(join)|(from)|(update)|(delete)|(insert)$/i.test(preWord)) {
|
if (preWord && /^((join)|(from)|(update)|(delete)|(insert))$/i.test(preWord)) {
|
||||||
let postWord = tokens[i + 1];
|
let postWord = tokens[i + 1];
|
||||||
if (postWord && /^as$/i.test(postWord)) {
|
if (postWord && /^as$/i.test(postWord)) {
|
||||||
postWord = tokens[i + 2];
|
postWord = tokens[i + 2];
|
||||||
@@ -18,7 +18,10 @@ export default function analyseQuerySources(sql, sourceNames) {
|
|||||||
res.push({
|
res.push({
|
||||||
name: word,
|
name: word,
|
||||||
});
|
});
|
||||||
} else if (/^(where)|(inner)|(left)|(right)|(on)|(join)$/i.test(postWord)) {
|
} else if (
|
||||||
|
/^((where)|(inner)|(left)|(right)|(on)|(join))$/i.test(postWord) ||
|
||||||
|
!/^[a-zA-Z][a-zA-Z0-9]*$/i.test(postWord)
|
||||||
|
) {
|
||||||
res.push({
|
res.push({
|
||||||
name: word,
|
name: word,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -111,11 +111,9 @@ export default function useCodeCompletion({ conid, database, tabVisible, current
|
|||||||
editor.execCommand('startAutocomplete');
|
editor.execCommand('startAutocomplete');
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (e.args == ' ' || e.args == '.') {
|
if (e.args == ' ' && /((from)|(join))\s*$/i.test(line)) {
|
||||||
// if (/from\s*$/i.test(line)) {
|
editor.execCommand('startAutocomplete');
|
||||||
// currentEditorRef.current.editor.execCommand('startAutocomplete');
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user