From 3e60379a2693faa34dd98891ccfc0dab2178c02a Mon Sep 17 00:00:00 2001 From: salexdv Date: Thu, 1 Sep 2022 08:35:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D1=81=D0=BA=D0=B0=D0=B7?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=80=D0=B5=D0=BA=D0=B2=D0=B8=D0=B7=D0=B8=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=A2=D0=A7=20=D0=B2=20=D0=B7=D0=B0=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bsl_helper.js | 59 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/src/bsl_helper.js b/src/bsl_helper.js index 4e069dc..d610b5d 100644 --- a/src/bsl_helper.js +++ b/src/bsl_helper.js @@ -2312,6 +2312,7 @@ class bslHelper { fillSuggestionsForMetadataItem(suggestions, obj, metadataName, metadataItem) { let objects = []; + let is_query = (isQueryMode() || isDCSMode()); if (obj.hasOwnProperty('properties')) objects.push(obj.properties); @@ -2319,7 +2320,7 @@ class bslHelper { if (obj.hasOwnProperty('resources')) objects.push(obj.resources); - if (obj.hasOwnProperty('tabulars')) { + if (obj.hasOwnProperty('tabulars') && !is_query) { this.fillSuggestionsForItemTabulars(suggestions, obj.tabulars, metadataName, metadataItem) } @@ -4163,6 +4164,47 @@ class bslHelper { } + /** + * Adds standart tabular attributes to suggestion list + * + * @param {array} suggestions the list of suggestions + * @param {string} ref to tabular owner + */ + addStandardTabularAttributesToQuerySuggestions(suggestions, ref) { + + let label = engLang ? 'Ref' : 'Ссылка'; + + let command = { + id: 'vs.editor.ICodeEditor:1:saveref', + arguments: [ + { + "name": label, + "data": { + "ref": ref, + "sig": null + } + } + ] + } + + suggestions.push({ + label: label, + kind: monaco.languages.CompletionItemKind.Field, + insertText: label, + insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet, + command: command + }); + + label = engLang ? 'LineNumber' : 'НомерСтроки'; + suggestions.push({ + label: label, + kind: monaco.languages.CompletionItemKind.Field, + insertText: label, + insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet + }); + + } + /** * Gets the list of properties (attributes) owned by object * (Catalog, Document, etc) and fills the suggestions by it @@ -4278,8 +4320,19 @@ class bslHelper { if (ikey.toLowerCase() == metadataName) { - if (ivalue.hasOwnProperty('properties')) - this.fillSuggestionsForMetadataItemInQuery(suggestions, ivalue, metadataSubtable); + if (ivalue.hasOwnProperty('properties')) { + if (ivalue.hasOwnProperty('tabulars') && 3 == sourceArray.length) { + for (const [tkey, tvalue] of Object.entries(ivalue.tabulars)) { + if (tkey.toLowerCase() == metadataSubtable) { + this.addStandardTabularAttributesToQuerySuggestions(suggestions, key + '.' + ikey); + this.fillSuggestionsForMetadataItemInQuery(suggestions, tvalue, ''); + } + } + } + else { + this.fillSuggestionsForMetadataItemInQuery(suggestions, ivalue, metadataSubtable); + } + } else if (ivalue.hasOwnProperty('tables') && 3 < sourceArray.length && value[this.queryNameField + '_tables'].toLowerCase() == metadataSubtable) { let tableName = sourceArray[3].toLowerCase();