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

Доработка подсказки параметров методов для режима запроса и СКД

This commit is contained in:
salexdv 2022-06-07 09:27:49 +03:00
parent 20de122526
commit 60135e0e7d

View File

@ -5558,6 +5558,24 @@ class bslHelper {
} }
/**
* Determines if the current position is suitable for
* showing a signature help
*
* @returns {bool}
*/
isSuitablePlaceForSigHelp() {
if (isQueryMode())
return !this.requireQueryValue()
else if (isDCSMode())
return true;
else
return !this.isItStringLiteral();
}
/** /**
* Returnes name of last method for signature help * Returnes name of last method for signature help
* *
@ -5570,7 +5588,7 @@ class bslHelper {
let method = ''; let method = '';
let bracket = this.model.findMatchingBracketUp('(', this.position); let bracket = this.model.findMatchingBracketUp('(', this.position);
if (bracket && (!this.isItStringLiteral() || isQueryMode() || isDCSMode())) { if (bracket && this.isSuitablePlaceForSigHelp()) {
let position = new monaco.Position(bracket.startLineNumber, bracket.startColumn); let position = new monaco.Position(bracket.startLineNumber, bracket.startColumn);
let data = this.model.getWordUntilPosition(position); let data = this.model.getWordUntilPosition(position);
@ -5658,9 +5676,9 @@ class bslHelper {
*/ */
getQuerySigHelp(context) { getQuerySigHelp(context) {
let unclosed = this.unclosedString(this.textBeforePosition); context = this.getLastSigMethod(context);
if (this.lastOperator != ')' && !this.requireQueryValue() && 0 <= unclosed.index) { if (context.methodName) {
context = this.getLastSigMethod(context); context = this.getLastSigMethod(context);
let helper = this.getCustomSigHelp(context); let helper = this.getCustomSigHelp(context);
@ -5686,20 +5704,20 @@ class bslHelper {
*/ */
getDCSSigHelp(context) { getDCSSigHelp(context) {
let unclosed = this.unclosedString(this.textBeforePosition); context = this.getLastSigMethod(context);
if (this.lastOperator != ')' && 0 <= unclosed.index) { if (context.methodName) {
let helper = this.getCustomSigHelp(context); let helper = this.getCustomSigHelp(context);
if (!helper && !editor.disableNativeSignatures) { if (!helper && !editor.disableNativeSignatures) {
let functions = this.getQueryFunctions(bslDCS); let functions = this.getQueryFunctions(bslDCS);
helper = this.getCommonSigHelp(functions); helper = this.getCommonSigHelp(context, functions);
if (!helper) { if (!helper) {
functions = this.getQueryFunctions(bslQuery); functions = this.getQueryFunctions(bslQuery);
helper = this.getCommonSigHelp(functions); helper = this.getCommonSigHelp(context, functions);
} }
} }