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

Поддержка ссылок systemEnum

This commit is contained in:
Alexander Shkuraev 2021-07-16 12:19:27 +03:00
parent d34dcbd8b4
commit 07bf91db40

View File

@ -886,6 +886,39 @@ class bslHelper {
}
/**
* Fills suggestions from systemEnum
*
* @param {array} suggestions the list of suggestions
* @param {object} obj object from BSL-JSON dictionary
*/
getSystemEnumSuggestions(suggestions, obj) {
if (obj.hasOwnProperty('values')) {
for (const [pkey, pvalue] of Object.entries(obj.values)) {
let command = null;
if (pvalue.hasOwnProperty('ref'))
command = { id: 'vs.editor.ICodeEditor:1:saveref', arguments: [{ "name": pvalue[this.nameField], "data": { "ref": pvalue.ref, "sig": null } }] };
suggestions.push({
label: pvalue[this.nameField],
kind: monaco.languages.CompletionItemKind.Field,
insertText: pvalue[this.nameField],
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
detail: pvalue.description,
documentation: '',
command: command
});
}
}
}
/**
* Fills the suggestions for reference-type object
*
@ -921,6 +954,11 @@ class bslHelper {
this.getClassSuggestions(suggestions, bslGlobals[itemName][subItemName]);
}
}
else if (itemName == 'systemEnum') {
if (this.objectHasProperties(bslGlobals, itemName, subItemName)) {
this.getSystemEnumSuggestions(suggestions, bslGlobals[itemName][subItemName]);
}
}
else {
let isObject = (refArray.length == 3 && refArray[2] == 'obj');