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

Функция для подсказок имен табличных частей #266

This commit is contained in:
salexdv 2022-01-23 08:52:47 +03:00
parent 0a2785318b
commit 1f8fbd5d65

View File

@ -1541,6 +1541,30 @@ class bslHelper {
} }
/**
* Gets the list of tabulars owned by object
* (Catalog, Document, etc) and fills the suggestions by it
*
* @param {array} suggestions the list of suggestions
* @param {object} tabulars object with tabulars description
*/
fillSuggestionsForItemTabulars(suggestions, tabulars) {
for (const [key, value] of Object.entries(tabulars)) {
let command = { id: 'vs.editor.ICodeEditor:1:saveref', arguments: [{'name': key, "data": { "ref": 'universalObjects.ТабличнаяЧасть', "sig": null } }]};
suggestions.push({
label: key,
kind: monaco.languages.CompletionItemKind.Unit,
insertText: key,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
command: command
});
}
}
/** /**
* Gets the list of properties (attributes) owned by object * Gets the list of properties (attributes) owned by object
@ -1559,6 +1583,10 @@ class bslHelper {
if (obj.hasOwnProperty('resources')) if (obj.hasOwnProperty('resources'))
objects.push(obj.resources); objects.push(obj.resources);
if (obj.hasOwnProperty('tabulars')) {
this.fillSuggestionsForItemTabulars(suggestions, obj.tabulars)
}
for (let idx = 0; idx < objects.length; idx++) { for (let idx = 0; idx < objects.length; idx++) {
let metadataObj = objects[idx]; let metadataObj = objects[idx];