1
0
mirror of https://github.com/salexdv/bsl_console.git synced 2024-11-24 08:33:29 +02:00

Подсказка полей таблицы в запросе не только после точки

This commit is contained in:
salexdv 2022-05-03 21:50:22 +03:00
parent c222302b27
commit 51a28810c6

View File

@ -4163,10 +4163,20 @@ class bslHelper {
*/
getQueryFieldsCompletion(suggestions, allowChain = true) {
if (this.getLastCharacter() == '.' && this.lastRawExpression) {
let position = null;
let last_expression = this.lastRawExpression;
if (this.getLastCharacter() == '.' && last_expression)
position = this.position;
else if (last_expression && this.getLastNExpression(1) == '.') {
position = new monaco.Position(this.lineNumber, this.column - last_expression.length);
last_expression = this.getLastNExpression(2);
}
if (position) {
// Let's find start of current query
let startMatch = Finder.findPreviousMatch(this.model, '(?:выбрать|select)', this.position, false);
let startMatch = Finder.findPreviousMatch(this.model, '(?:выбрать|select)', position, false);
if (startMatch) {
@ -4175,7 +4185,7 @@ class bslHelper {
// Temp table definition
let sourceDefinition = '';
let match = Finder.findNextMatch(this.model, '^[\\s\\t]*([a-zA-Z0-9\u0410-\u044F_]+)\\s+(?:как|as)\\s+' + this.lastRawExpression + '[\\s,\\n]*$', position);
let match = Finder.findNextMatch(this.model, '^[\\s\\t]*([a-zA-Z0-9\u0410-\u044F_]+)\\s+(?:как|as)\\s+' + last_expression + '[\\s,\\n]*$', position);
if (match) {
@ -4186,7 +4196,7 @@ class bslHelper {
else {
// Metadata table definition
match = Finder.findNextMatch(this.model, '(?:из|from)[\\s\\S\\n]*?(?:как|as)\\s+' + this.lastRawExpression + '[\\s,\\n]*$' , position);
match = Finder.findNextMatch(this.model, '(?:из|from)[\\s\\S\\n]*?(?:как|as)\\s+' + last_expression + '[\\s,\\n]*$' , position);
if (match) {