Merge pull request #449 from sosedoff/object-autocompletion
Autocomplete on all database objects
This commit is contained in:
commit
0d8502f799
File diff suppressed because one or more lines are too long
@ -1,8 +1,9 @@
|
|||||||
var editor = null;
|
var editor = null;
|
||||||
var connected = false;
|
var connected = false;
|
||||||
var bookmarks = {};
|
var bookmarks = {};
|
||||||
var default_rows_limit = 100;
|
var default_rows_limit = 100;
|
||||||
var currentObject = null;
|
var currentObject = null;
|
||||||
|
var autocompleteObjects = [];
|
||||||
|
|
||||||
var filterOptions = {
|
var filterOptions = {
|
||||||
"equal": "= 'DATA'",
|
"equal": "= 'DATA'",
|
||||||
@ -162,6 +163,23 @@ function loadSchemas() {
|
|||||||
$(".schema").addClass("expanded");
|
$(".schema").addClass("expanded");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear out all autocomplete objects
|
||||||
|
autocompleteObjects = [];
|
||||||
|
for (schema in data) {
|
||||||
|
for (kind in data[schema]) {
|
||||||
|
if (!(kind == "table" || kind == "view" || kind == "materialized_view")) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for (item in data[schema][kind]) {
|
||||||
|
autocompleteObjects.push({
|
||||||
|
caption: data[schema][kind][item],
|
||||||
|
value: data[schema][kind][item],
|
||||||
|
meta: kind
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bindContextMenus();
|
bindContextMenus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -712,13 +730,21 @@ function buildTableFilters(name, type) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var objectAutocompleter = {
|
||||||
|
getCompletions: function (editor, session, pos, prefix, callback) {
|
||||||
|
callback(null, autocompleteObjects);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initEditor() {
|
function initEditor() {
|
||||||
var writeQueryTimeout = null;
|
var writeQueryTimeout = null;
|
||||||
|
|
||||||
editor = ace.edit("custom_query");
|
editor = ace.edit("custom_query");
|
||||||
editor.setOptions({
|
editor.setOptions({
|
||||||
enableBasicAutocompletion: true,
|
enableBasicAutocompletion: true,
|
||||||
enableLiveAutocompletion: true,
|
enableLiveAutocompletion: true,
|
||||||
});
|
});
|
||||||
|
editor.completers.push(objectAutocompleter);
|
||||||
|
|
||||||
editor.setFontSize(13);
|
editor.setFontSize(13);
|
||||||
editor.setTheme("ace/theme/tomorrow");
|
editor.setTheme("ace/theme/tomorrow");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user