mirror of
https://github.com/salexdv/bsl_console.git
synced 2024-11-28 08:48:48 +02:00
Подсказка методов таблиц внешнего источника с учетом типа данных таблицы
This commit is contained in:
parent
5d391bed28
commit
e554505f36
@ -1914,8 +1914,9 @@ class bslHelper {
|
||||
* @param {array} suggestions the list of suggestions
|
||||
* @param {object} obj object from BSL-JSON dictionary
|
||||
* @param {sting} methodsName the name of node (objMethods, refMethods)
|
||||
* @param {sting} dataType the type of table (ObjectData, NonobjectData)
|
||||
*/
|
||||
getExternalDataSourcesMethods(suggestions, obj, methodsName, metadataKey, medatadaName) {
|
||||
getExternalDataSourcesMethods(suggestions, obj, methodsName, dataType) {
|
||||
|
||||
if (obj.hasOwnProperty(methodsName)) {
|
||||
|
||||
@ -1923,49 +1924,53 @@ class bslHelper {
|
||||
|
||||
for (const [mkey, mvalue] of Object.entries(obj[methodsName])) {
|
||||
|
||||
let command = null;
|
||||
let postfix = '';
|
||||
let post_action = null;
|
||||
|
||||
signatures = this.getMethodsSignature(mvalue);
|
||||
|
||||
if (signatures.length) {
|
||||
postfix = '(';
|
||||
post_action = 'editor.action.triggerParameterHints';
|
||||
}
|
||||
|
||||
if (signatures.length == 0 || (signatures.length == 1 && signatures[0].parameters.length == 0))
|
||||
postfix = '()';
|
||||
|
||||
let ref = null;
|
||||
if (mvalue.hasOwnProperty('ref'))
|
||||
ref = mvalue.ref;
|
||||
if (!dataType || !mvalue.hasOwnProperty('tableDataType') || mvalue.tableDataType == dataType) {
|
||||
|
||||
if (ref || signatures.length) {
|
||||
// If the attribute contains a ref, we need to run the command to save the position of ref
|
||||
command = {
|
||||
id: 'vs.editor.ICodeEditor:1:saveref',
|
||||
arguments: [
|
||||
{
|
||||
"name": mvalue[this.nameField],
|
||||
"data": {
|
||||
"ref": ref,
|
||||
"sig": signatures
|
||||
},
|
||||
"post_action": post_action
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
let command = null;
|
||||
let postfix = '';
|
||||
let post_action = null;
|
||||
|
||||
suggestions.push({
|
||||
label: mvalue[this.nameField],
|
||||
kind: monaco.languages.CompletionItemKind.Function,
|
||||
insertText: mvalue.name + postfix,
|
||||
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
||||
detail: mvalue.description,
|
||||
command: command
|
||||
});
|
||||
signatures = this.getMethodsSignature(mvalue);
|
||||
|
||||
if (signatures.length) {
|
||||
postfix = '(';
|
||||
post_action = 'editor.action.triggerParameterHints';
|
||||
}
|
||||
|
||||
if (signatures.length == 0 || (signatures.length == 1 && signatures[0].parameters.length == 0))
|
||||
postfix = '()';
|
||||
|
||||
let ref = null;
|
||||
if (mvalue.hasOwnProperty('ref'))
|
||||
ref = mvalue.ref;
|
||||
|
||||
if (ref || signatures.length) {
|
||||
// If the attribute contains a ref, we need to run the command to save the position of ref
|
||||
command = {
|
||||
id: 'vs.editor.ICodeEditor:1:saveref',
|
||||
arguments: [
|
||||
{
|
||||
"name": mvalue[this.nameField],
|
||||
"data": {
|
||||
"ref": ref,
|
||||
"sig": signatures
|
||||
},
|
||||
"post_action": post_action
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
suggestions.push({
|
||||
label: mvalue[this.nameField],
|
||||
kind: monaco.languages.CompletionItemKind.Function,
|
||||
insertText: mvalue.name + postfix,
|
||||
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
||||
detail: mvalue.description,
|
||||
command: command
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2009,11 +2014,15 @@ class bslHelper {
|
||||
|
||||
if (item_node) {
|
||||
|
||||
if (item_name) {
|
||||
this.getExternalDataSourcesMethods(suggestions, bslMetadata.externalDataSources, methods_name, metadataName, metadataItem);
|
||||
}
|
||||
else {
|
||||
for (const [ikey, ivalue] of Object.entries(item_node.items)) {
|
||||
for (const [ikey, ivalue] of Object.entries(item_node.items)) {
|
||||
|
||||
if (item_name) {
|
||||
if (ikey.toLowerCase() == item_name.toLowerCase()) {
|
||||
let data_type = ivalue.hasOwnProperty('tableDataType') ? ivalue.tableDataType : '';
|
||||
this.getExternalDataSourcesMethods(suggestions, bslMetadata.externalDataSources, methods_name, data_type);
|
||||
}
|
||||
}
|
||||
else {
|
||||
suggestions.push({
|
||||
label: ikey,
|
||||
kind: monaco.languages.CompletionItemKind.Unit,
|
||||
|
Loading…
Reference in New Issue
Block a user