1
0
mirror of https://github.com/salexdv/bsl_console.git synced 2024-12-12 10:45:14 +02:00

Merge branch 'salexdv:develop' into develop

This commit is contained in:
Sergey Starykh 2021-05-12 11:59:59 +03:00
commit 3cf9b4410c
2 changed files with 56 additions and 21 deletions

View File

@ -412,6 +412,13 @@ define([], function () {
signatureHelpRetriggerCharacters: [')'],
provideSignatureHelp: (model, position, token, context) => {
let widget = document.querySelector('.parameter-hints-widget');
if (widget) {
widget.style.display = '';
signatureVisible = true;
}
let bsl = new bslHelper(model, position);
let helper = bsl.getSigHelp(context);
@ -425,18 +432,7 @@ define([], function () {
activeSignature: activeSignature,
triggerCharacter: context.triggerCharacter
}
sendEvent('EVENT_BEFORE_SIGNATURE', params);
}
if (helper) {
let widget = document.querySelector('.parameter-hints-widget');
if (widget) {
widget.style.display = '';
widget.style.visibility = '';
}
sendEvent('EVENT_BEFORE_SIGNATURE', params);
}
return helper;

View File

@ -20,6 +20,7 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit
contextMenuEnabled = false;
err_tid = 0;
suggestObserver = null;
signatureObserver = null;
generateBeforeShowSuggestEvent = false;
generateSelectSuggestEvent = false;
generateBeforeHoverEvent = false;
@ -27,7 +28,8 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit
statusBarWidget = null;
ctrlPressed = false;
altPressed = false;
shiftPressed = false;
shiftPressed = false;
signatureVisible = true;
reserMark = function() {
@ -849,6 +851,40 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit
generateBeforeSignatureEvent = enabled;
if (signatureObserver != null) {
signatureObserver.disconnect();
signatureObserver = null;
}
if (enabled) {
signatureObserver = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.target.classList.contains('overflowingContentWidgets') && mutation.addedNodes.length) {
let element = mutation.addedNodes[0];
if (element.classList.contains('parameter-hints-widget') && !signatureVisible) {
element.style.display = 'none';
signatureObserver.disconnect();
signatureObserver = null;
}
}
})
});
signatureObserver.observe(document, {
childList: true,
subtree: true
});
}
}
hideSuggestionsList = function() {
@ -859,16 +895,15 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit
}
hideSignatureList = function() {
hideSignatureList = function () {
signatureVisible = false;
let widget = document.querySelector('.parameter-hints-widget');
if (widget) {
widget.style.display = 'hidden';
widget.style.visibility = 'hidden';
}
}
if (widget)
widget.style.display = 'none';
}
hideHoverList = function() {
@ -1105,8 +1140,12 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit
}
let element = e.target.element;
if (element.tagName.toLowerCase() == 'a')
if (element.tagName.toLowerCase() == 'a') {
sendEvent("EVENT_ON_LINK_CLICK", {label: element.innerText, href: element.dataset.href});
setTimeout(() => {
editor.focus();
}, 100);
}
});