mirror of
https://github.com/salexdv/bsl_console.git
synced 2024-11-24 08:33:29 +02:00
Переход к определению полей и таблиц запроса
This commit is contained in:
parent
497e5cd89e
commit
a7e753c55a
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -547,7 +547,10 @@ define([], function () {
|
||||
provideDocumentColors: () => {}
|
||||
},
|
||||
definitionProvider: {
|
||||
provideDefinition: () => {}
|
||||
provideDefinition: (model, position) => {
|
||||
let bsl = new bslHelper(model, position);
|
||||
return bsl.provideQueryDefinition();
|
||||
}
|
||||
},
|
||||
autoIndentation: false,
|
||||
indentationRules: {
|
||||
|
Loading…
Reference in New Issue
Block a user