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

Доработка определения источника поля #288

This commit is contained in:
salexdv 2022-08-31 08:31:20 +03:00
parent 5224d54374
commit ad9ba35f71
2 changed files with 34 additions and 3 deletions

View File

@ -4500,6 +4500,26 @@ class bslHelper {
// Searching the source
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) {

View File

@ -11,6 +11,7 @@
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/2.0.0/chai.js"></script>
<link href="./decorations.css" rel="stylesheet">
<link href="./tree/tree.css" rel="stylesheet">
</head>
<body>
@ -1120,7 +1121,7 @@
' Справочник.Товары КАК Товары',
' ЛЕВОЕ СОЕДИНЕНИЕ РегистрСведений.ЦеныНоменклатуры.СрезПоследних(',
' &Период,',
' Номенклатура В (&СписокНоменклатуры),',
' Номенклатура.ВидНоменклатуры В (&СписокВидовНоменклатуры),',
' ) КАК Цены',
' ПО Товары.Ссылка = Цены.Номенклатура',
' ЛЕВОЕ СОЕДИНЕНИЕ РегистрНакопления.ОстаткиТоваров.Остатки КАК Остатки',
@ -1177,6 +1178,15 @@
</script>
<div id="container" style="width:100%;height:600px;border:1px solid grey"></div>
<div id="display">
<div id="display-header">
<div id="display-title"></div>
<div id="display-close"></div>
</div>
<div id="variables-display">
<div id="variables-tree"></div>
</div>
</div>
<button id="event-button"></button>
<script src="./vs/loader.js"></script>
@ -1185,6 +1195,7 @@
<script src="./bsl_helper.js"></script>
<script src="./test_query.js"></script>
<script src="./init.js"></script>
<script src="./tree/tree.js"></script>
<div id="mocha"></div>