mirror of
https://github.com/salexdv/bsl_console.git
synced 2025-02-07 13:31:37 +02:00
Custom suggestions for in "Query" and "DCS" modes
This commit is contained in:
parent
dd7eb96fcf
commit
777ba906c5
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
pic/
|
||||
release/
|
||||
src/.vscode/
|
||||
src/.vscode/
|
||||
src/src.zip
|
||||
|
@ -3245,42 +3245,49 @@ class bslHelper {
|
||||
getQueryCompletition() {
|
||||
|
||||
let suggestions = [];
|
||||
// +++
|
||||
if (customSuggestions.length) {
|
||||
suggestions = customSuggestions.slice();
|
||||
customSuggestions = [];
|
||||
}
|
||||
else
|
||||
// ---
|
||||
{
|
||||
if (!this.requireQueryValue()) {
|
||||
|
||||
if (!this.requireQueryValue()) {
|
||||
if (!this.requireQueryRef()) {
|
||||
|
||||
if (!this.requireQueryRef()) {
|
||||
if (!this.getQuerySourceCompletition(suggestions, monaco.languages.CompletionItemKind.Enum)) {
|
||||
|
||||
if (!this.getQuerySourceCompletition(suggestions, monaco.languages.CompletionItemKind.Enum)) {
|
||||
if (this.lastOperator != '"') {
|
||||
let functions = this.getQueryFunctions(bslQuery);
|
||||
this.getCommonCompletition(suggestions, functions, monaco.languages.CompletionItemKind.Function, true);
|
||||
this.getRefCompletition(suggestions);
|
||||
this.getQueryTablesCompletition(suggestions, monaco.languages.CompletionItemKind.Class);
|
||||
this.getCustomObjectsCompletition(suggestions, bslMetadata.customObjects, monaco.languages.CompletionItemKind.Enum);
|
||||
}
|
||||
|
||||
this.getQueryCommonCompletition(suggestions, monaco.languages.CompletionItemKind.Module);
|
||||
this.getQueryParamsCompletition(suggestions, monaco.languages.CompletionItemKind.Enum);
|
||||
this.getQueryFieldsCompletition(suggestions);
|
||||
this.getSnippets(suggestions, querySnippets);
|
||||
|
||||
if (this.lastOperator != '"') {
|
||||
let functions = this.getQueryFunctions(bslQuery);
|
||||
this.getCommonCompletition(suggestions, functions, monaco.languages.CompletionItemKind.Function, true);
|
||||
this.getRefCompletition(suggestions);
|
||||
this.getQueryTablesCompletition(suggestions, monaco.languages.CompletionItemKind.Class);
|
||||
this.getCustomObjectsCompletition(suggestions, bslMetadata.customObjects, monaco.languages.CompletionItemKind.Enum);
|
||||
}
|
||||
|
||||
this.getQueryCommonCompletition(suggestions, monaco.languages.CompletionItemKind.Module);
|
||||
this.getQueryParamsCompletition(suggestions, monaco.languages.CompletionItemKind.Enum);
|
||||
this.getQueryFieldsCompletition(suggestions);
|
||||
this.getSnippets(suggestions, querySnippets);
|
||||
}
|
||||
else {
|
||||
|
||||
this.getQueryRefCompletition(suggestions, monaco.languages.CompletionItemKind.Enum);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
this.getQueryRefCompletition(suggestions, monaco.languages.CompletionItemKind.Enum);
|
||||
this.getQueryValuesCompletition(suggestions, bslQuery.values, monaco.languages.CompletionItemKind.Enum);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
this.getQueryValuesCompletition(suggestions, bslQuery.values, monaco.languages.CompletionItemKind.Enum);
|
||||
|
||||
}
|
||||
|
||||
if (suggestions.length)
|
||||
return { suggestions: suggestions }
|
||||
else
|
||||
@ -3296,25 +3303,32 @@ class bslHelper {
|
||||
getDCSCompletition() {
|
||||
|
||||
let suggestions = [];
|
||||
// +++
|
||||
if (customSuggestions.length) {
|
||||
suggestions = customSuggestions.slice();
|
||||
customSuggestions = [];
|
||||
}
|
||||
else
|
||||
// ---
|
||||
{
|
||||
if (!this.requireQueryValue()) {
|
||||
|
||||
if (!this.requireQueryValue()) {
|
||||
if (this.lastOperator != '"') {
|
||||
this.getFillSuggestionsFromArray(suggestions, languages.bsl.languageDef.rules.DCSExp, monaco.languages.CompletionItemKind.Module);
|
||||
let functions = this.getQueryFunctions(bslDCS);
|
||||
this.getCommonCompletition(suggestions, functions, monaco.languages.CompletionItemKind.Function, true);
|
||||
this.getCustomObjectsCompletition(suggestions, bslMetadata.customObjects, monaco.languages.CompletionItemKind.Enum);
|
||||
this.getRefCompletition(suggestions);
|
||||
this.getSnippets(suggestions, DCSSnippets);
|
||||
}
|
||||
|
||||
if (this.lastOperator != '"') {
|
||||
this.getFillSuggestionsFromArray(suggestions, languages.bsl.languageDef.rules.DCSExp, monaco.languages.CompletionItemKind.Module);
|
||||
let functions = this.getQueryFunctions(bslDCS);
|
||||
this.getCommonCompletition(suggestions, functions, monaco.languages.CompletionItemKind.Function, true);
|
||||
this.getCustomObjectsCompletition(suggestions, bslMetadata.customObjects, monaco.languages.CompletionItemKind.Enum);
|
||||
this.getRefCompletition(suggestions);
|
||||
this.getSnippets(suggestions, DCSSnippets);
|
||||
}
|
||||
else {
|
||||
|
||||
this.getQueryValuesCompletition(suggestions, bslQuery.values, monaco.languages.CompletionItemKind.Enum);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
this.getQueryValuesCompletition(suggestions, bslQuery.values, monaco.languages.CompletionItemKind.Enum);
|
||||
|
||||
}
|
||||
|
||||
if (suggestions.length)
|
||||
return { suggestions: suggestions }
|
||||
else
|
||||
|
@ -496,6 +496,10 @@ define([], function () {
|
||||
completionProvider: {
|
||||
triggerCharacters: ['.', '(', '&'],
|
||||
provideCompletionItems: function (model, position, context, token) {
|
||||
let widget = document.querySelector('.suggest-widget');
|
||||
widget.style.display = '';
|
||||
widget.style.visibility = '';
|
||||
|
||||
let bsl = new bslHelper(model, position);
|
||||
let completition = bsl.getQueryCompletition(query_language);
|
||||
if (generateBeforeShowSuggestEvent) {
|
||||
|
BIN
src/src.zip
BIN
src/src.zip
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user