From ad9ba35f7187158dbc99a78fbb0a964956a21ed0 Mon Sep 17 00:00:00 2001 From: salexdv Date: Wed, 31 Aug 2022 08:31:20 +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=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B8=D1=81=D1=82=D0=BE=D1=87=D0=BD=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=BB=D1=8F=20#288?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bsl_helper.js | 24 ++++++++++++++++++++++-- src/test_query.html | 13 ++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/bsl_helper.js b/src/bsl_helper.js index d632f09..63a6660 100644 --- a/src/bsl_helper.js +++ b/src/bsl_helper.js @@ -4499,8 +4499,28 @@ class bslHelper { if (match) { // Searching the source - position = new monaco.Position(match.range.endLineNumber, match.range.endColumn); - match = Finder.findPreviousMatch(this.model, '[a-zA-Z0-9\u0410-\u044F]+\\.[a-zA-Z0-9\u0410-\u044F_]+(?:\\.[a-zA-Z0-9\u0410-\u044F_]+)?(?:\\.[a-zA-Z0-9\u0410-\u044F_]+)?', position); + position = new monaco.Position(match.range.endLineNumber, match.range.endColumn); + let bracket_match = this.model.findPrevBracket(position); + + if (bracket_match && match.range.startLineNumber < bracket_match.range.startLineNumber) { + position = new monaco.Position(bracket_match.range.startLineNumber, bracket_match.range.startColumn); + let brackets = editor.getModel().matchBracket(position); + if (brackets) { + brackets = brackets.sort(); + const open = brackets[0], close = brackets[1]; + const bracket_range = new monaco.Range(open.startLineNumber, open.endColumn, close.startLineNumber, close.startColumn); + const bracket_text = this.model.getValueInRange(bracket_range); + const source_text = this.model.getValueInRange(match.range).replace(bracket_text, ''); + const source_model = monaco.editor.createModel(source_text); + const model_range = source_model.getFullModelRange(); + const model_position = new monaco.Position(model_range.endLineNumber, model_range.endColumn); + match = Finder.findPreviousMatch(source_model, '[a-zA-Z0-9\u0410-\u044F]+\\.[a-zA-Z0-9\u0410-\u044F_]+(?:\\.[a-zA-Z0-9\u0410-\u044F_]+)?(?:\\.[a-zA-Z0-9\u0410-\u044F_]+)?', model_position); + } + else + match = null; + } + else + match = Finder.findPreviousMatch(this.model, '[a-zA-Z0-9\u0410-\u044F]+\\.[a-zA-Z0-9\u0410-\u044F_]+(?:\\.[a-zA-Z0-9\u0410-\u044F_]+)?(?:\\.[a-zA-Z0-9\u0410-\u044F_]+)?', position); if (match) { sourceDefinition = match.matches[0]; diff --git a/src/test_query.html b/src/test_query.html index 1717d85..a214414 100644 --- a/src/test_query.html +++ b/src/test_query.html @@ -11,6 +11,7 @@ + @@ -1120,7 +1121,7 @@ ' Справочник.Товары КАК Товары', ' ЛЕВОЕ СОЕДИНЕНИЕ РегистрСведений.ЦеныНоменклатуры.СрезПоследних(', ' &Период,', - ' Номенклатура В (&СписокНоменклатуры),', + ' Номенклатура.ВидНоменклатуры В (&СписокВидовНоменклатуры),', ' ) КАК Цены', ' ПО Товары.Ссылка = Цены.Номенклатура', ' ЛЕВОЕ СОЕДИНЕНИЕ РегистрНакопления.ОстаткиТоваров.Остатки КАК Остатки', @@ -1177,6 +1178,15 @@
+
+
+
+
+
+
+
+
+
@@ -1185,6 +1195,7 @@ +