mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
code completion fixes
This commit is contained in:
parent
afbec02f3a
commit
86cd0c9459
@ -9,7 +9,7 @@ export default function analyseQuerySources(sql, sourceNames) {
|
||||
const wordUpper = word.toUpperCase();
|
||||
if (upperSourceNames.includes(wordUpper)) {
|
||||
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];
|
||||
if (postWord && /^as$/i.test(postWord)) {
|
||||
postWord = tokens[i + 2];
|
||||
@ -18,7 +18,10 @@ export default function analyseQuerySources(sql, sourceNames) {
|
||||
res.push({
|
||||
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({
|
||||
name: word,
|
||||
});
|
||||
|
@ -111,11 +111,9 @@ export default function useCodeCompletion({ conid, database, tabVisible, current
|
||||
editor.execCommand('startAutocomplete');
|
||||
}
|
||||
|
||||
// if (e.args == ' ' || e.args == '.') {
|
||||
// if (/from\s*$/i.test(line)) {
|
||||
// currentEditorRef.current.editor.execCommand('startAutocomplete');
|
||||
// }
|
||||
// }
|
||||
if (e.args == ' ' && /((from)|(join))\s*$/i.test(line)) {
|
||||
editor.execCommand('startAutocomplete');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user