From 60135e0e7dfe8c8b5036a1b0c87fd726b7c23e63 Mon Sep 17 00:00:00 2001 From: salexdv Date: Tue, 7 Jun 2022 09:27:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=B4=D1=81=D0=BA=D0=B0=D0=B7=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=BE=D0=B2=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=B0=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=B0=20=D0=B8=20=D0=A1=D0=9A?= =?UTF-8?q?=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bsl_helper.js | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/bsl_helper.js b/src/bsl_helper.js index c6f207f..107222f 100644 --- a/src/bsl_helper.js +++ b/src/bsl_helper.js @@ -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 * @@ -5570,7 +5588,7 @@ class bslHelper { let method = ''; 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 data = this.model.getWordUntilPosition(position); @@ -5658,9 +5676,9 @@ class bslHelper { */ 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); let helper = this.getCustomSigHelp(context); @@ -5686,20 +5704,20 @@ class bslHelper { */ 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); if (!helper && !editor.disableNativeSignatures) { let functions = this.getQueryFunctions(bslDCS); - helper = this.getCommonSigHelp(functions); + helper = this.getCommonSigHelp(context, functions); if (!helper) { functions = this.getQueryFunctions(bslQuery); - helper = this.getCommonSigHelp(functions); + helper = this.getCommonSigHelp(context, functions); } }