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-05-03 10:29:23 +03:00
parent d48aeb98e7
commit 2dceb39c6f

View File

@ -4339,6 +4339,29 @@ class bslHelper {
}
/**
* Fills array of completion for external data as source
*
* @param {object} externalData object with external data
* @param {string} sourceName name of source
* @param {array} suggestions array of suggestions for provideCompletionItems
* @param {CompletionItemKind} kind - monaco.languages.CompletionItemKind (class, function, constructor etc.)
*/
getQuerySourceForExternalData(externalData, sourceName, suggestions, kind) {
if (!sourceName) {
let label = externalData[this.queryNameField + '_tables'];
suggestions.push({
label: label,
kind: kind,
insertText: label,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
command: { id: 'vs.editor.ICodeEditor:1:requestMetadata', arguments: [{ "metadata": externalData.name.toLowerCase() + '.' + label.toLowerCase() }] }
});
}
}
/**
* Fills array of completion for source of table
*
@ -4380,16 +4403,7 @@ class bslHelper {
}
else if (key == 'externalDataSources') {
if (!metadataFunc) {
let label = value[this.queryNameField + '_tables'];
suggestions.push({
label: label,
kind: kind,
insertText: label,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
command: { id: 'vs.editor.ICodeEditor:1:requestMetadata', arguments: [{ "metadata": value.name.toLowerCase() + '.' + label.toLowerCase()}] }
});
}
this.getQuerySourceForExternalData(value, metadataFunc, suggestions, kind);
}
else if (!metadataFunc && 2 < maxLevel) {
this.getQuerySourceMetadataRegTempraryTablesCompletion(value, metadataItem, suggestions)