code completion context is only current query

This commit is contained in:
Jan Prochazka
2021-12-12 20:40:15 +01:00
parent 5e5a26ed4d
commit ccb25c9ff0
3 changed files with 13 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ const COMMON_KEYWORDS = [
'go',
];
export function mountCodeCompletion({ conid, database, editor }) {
export function mountCodeCompletion({ conid, database, editor, getText }) {
setCompleters([]);
addCompleter({
getCompletions: async function (editor, session, pos, prefix, callback) {
@@ -44,7 +44,7 @@ export function mountCodeCompletion({ conid, database, editor }) {
const lastKeywordMatch = line.match(/([a-zA-Z0-9_]*)\s*$/);
const lastKeyword = lastKeywordMatch ? lastKeywordMatch[1].toUpperCase().trim() : '';
const sources = analyseQuerySources(editor.getValue(), [
const sources = analyseQuerySources(getText(), [
...dbinfo.tables.map(x => x.pureName),
...dbinfo.views.map(x => x.pureName),
...dbinfo.matviews.map(x => x.pureName),