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

Подсказка табличных частей в конструкции ИЗ

This commit is contained in:
salexdv 2022-08-31 18:50:12 +03:00
parent 5718f65162
commit 7825d2b060

View File

@ -4646,28 +4646,47 @@ class bslHelper {
/** /**
* Fills array of completion for virtual tables of registers in source * Fills array of completion for virtual tables of registers in source
* or for tabulars of metadata object
* *
* @param {object} data objects from BSL-JSON dictionary * @param {object} data objects from BSL-JSON dictionary
* @param {string} metadataItem name of metadata item like (ЦеныНоменклатуры/ProductPrices, СвободныеОстатки/AvailableStock) * @param {string} metadataItem name of metadata item like (ЦеныНоменклатуры/ProductPrices, СвободныеОстатки/AvailableStock)
* @param {array} suggestions array of suggestions for provideCompletionItems * @param {array} suggestions array of suggestions for provideCompletionItems
*/ */
getQuerySourceMetadataRegTempraryTablesCompletion(data, metadataItem, suggestions) { getQuerySourceMetadataTabularsRegTempraryTables(data, metadataItem, suggestions) {
for (const [ikey, ivalue] of Object.entries(data.items)) { for (const [ikey, ivalue] of Object.entries(data.items)) {
if (ikey.toLowerCase() == metadataItem.toLowerCase() && ivalue.hasOwnProperty('type')) { if (ikey.toLowerCase() == metadataItem.toLowerCase()) {
if (ivalue.hasOwnProperty('type')) {
let tables = this.getRegisterVirtualTables(ivalue.type); let tables = this.getRegisterVirtualTables(ivalue.type);
for (const [tkey, tvalue] of Object.entries(tables)) { for (const [tkey, tvalue] of Object.entries(tables)) {
suggestions.push({ suggestions.push({
label: tkey, label: tkey,
kind: monaco.languages.CompletionItemKind.Unit, kind: monaco.languages.CompletionItemKind.Unit,
insertText: tvalue, insertText: tvalue,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
}); });
}
}
else if (ivalue.hasOwnProperty('tabulars')) {
for (const [tkey, tvalue] of Object.entries(ivalue.tabulars)) {
suggestions.push({
label: tkey,
kind: monaco.languages.CompletionItemKind.Unit,
insertText: tkey,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
});
}
} }
} }
@ -4772,8 +4791,7 @@ class bslHelper {
this.getQuerySourceForExternalData(value, metadataItem, metadataFunc, suggestions, kind); this.getQuerySourceForExternalData(value, metadataItem, metadataFunc, suggestions, kind);
} }
else if (!metadataFunc && 2 < maxLevel) { else if (!metadataFunc && 2 < maxLevel) {
this.getQuerySourceMetadataRegTempraryTablesCompletion(value, metadataItem, suggestions) this.getQuerySourceMetadataTabularsRegTempraryTables(value, metadataItem, suggestions)
} }
} }