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

Переход к определению полей и таблиц запроса

This commit is contained in:
salexdv 2021-09-14 21:00:45 +03:00
parent 497e5cd89e
commit a7e753c55a
2 changed files with 64 additions and 1 deletions

View File

@ -5865,4 +5865,64 @@ class bslHelper {
}
/**
* Provide the definition of the symbol at the given position of query
*
* @returns {array} Location[]
*/
provideQueryDefinition() {
let location = null;
if (this.word) {
if (this.wordHasCharsBefore('.')) {
let pattern = '(as|как)\\s*' + this.word;
let position = new monaco.Position(this.lineNumber, 1);
let match = this.model.findPreviousMatch(pattern, position, true);
if (match && match.range.startLineNumber < this.lineNumber) {
location = [{
uri: this.model.uri,
range: match.range
}];
}
}
else if (this.wordHasCharsAfter('.')) {
let pattern = '(as|как)\\s*' + this.word;
let position = new monaco.Position(this.lineNumber, this.model.getLineMaxColumn(this.lineNumber));
let match = this.model.findNextMatch(pattern, position, true);
if (match && match.range.startLineNumber > this.lineNumber) {
location = [{
uri: this.model.uri,
range: match.range
}];
}
}
else {
let pattern = '(поместить|into)[\\s\\n\\t]*' + this.word;
let position = new monaco.Position(this.lineNumber, 1);
let match = this.model.findNextMatch(pattern, position, true);
if (match && match.range.startLineNumber < this.lineNumber) {
location = [{
uri: this.model.uri,
range: match.range
}];
}
}
}
return location;
}
}

View File

@ -547,7 +547,10 @@ define([], function () {
provideDocumentColors: () => {}
},
definitionProvider: {
provideDefinition: () => {}
provideDefinition: (model, position) => {
let bsl = new bslHelper(model, position);
return bsl.provideQueryDefinition();
}
},
autoIndentation: false,
indentationRules: {