mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Add preferences to enable brace matching and brace closing in the SQL editors. Fixes #2513
This commit is contained in:
committed by
Dave Page
parent
a87ee6d059
commit
1b49bb8b22
@@ -190,9 +190,24 @@ class SqlEditorModule(PgAdminModule):
|
||||
'Options', 'wrap_code',
|
||||
gettext("Line wrapping?"), 'boolean', False,
|
||||
category_label=gettext('Options'),
|
||||
help_str=gettext('Specifies whether or not to wrap SQL code in editor.')
|
||||
help_str=gettext('Specifies whether or not to wrap SQL code in the editor.')
|
||||
)
|
||||
|
||||
self.insert_pair_brackets = self.preference.register(
|
||||
'Options', 'insert_pair_brackets',
|
||||
gettext("Insert bracket pairs?"), 'boolean', True,
|
||||
category_label=gettext('Options'),
|
||||
help_str=gettext('Specifies whether or not to insert paired brackets in the editor.')
|
||||
)
|
||||
|
||||
self.brace_matching = self.preference.register(
|
||||
'Options', 'brace_matching',
|
||||
gettext("Brace matching?"), 'boolean', True,
|
||||
category_label=gettext('Options'),
|
||||
help_str=gettext('Specifies whether or not to highlight matched braces in the editor.')
|
||||
)
|
||||
|
||||
|
||||
blueprint = SqlEditorModule(MODULE_NAME, __name__, static_url_path='/static')
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ define([
|
||||
'codemirror/addon/search/search',
|
||||
'codemirror/addon/search/searchcursor',
|
||||
'codemirror/addon/search/jump-to-line',
|
||||
'codemirror/addon/edit/matchbrackets',
|
||||
'codemirror/addon/edit/closebrackets',
|
||||
|
||||
'backgrid.sizeable.columns',
|
||||
'slick.pgadmin.formatters',
|
||||
@@ -111,7 +113,6 @@ define([
|
||||
$('.editor-title').text(_.unescape(self.editor_title));
|
||||
self.filter_obj = CodeMirror.fromTextArea(filter.get(0), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
indentUnit: 4,
|
||||
mode: "text/x-pgsql",
|
||||
foldOptions: {
|
||||
@@ -124,7 +125,9 @@ define([
|
||||
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
|
||||
extraKeys: pgBrowser.editor_shortcut_keys,
|
||||
tabSize: pgAdmin.Browser.editor_options.tabSize,
|
||||
lineWrapping: pgAdmin.Browser.editor_options.wrapCode
|
||||
lineWrapping: pgAdmin.Browser.editor_options.wrapCode,
|
||||
autoCloseBrackets: pgAdmin.Browser.editor_options.insert_pair_brackets,
|
||||
matchBrackets: pgAdmin.Browser.editor_options.brace_matching
|
||||
});
|
||||
|
||||
// Create main wcDocker instance
|
||||
@@ -154,7 +157,6 @@ define([
|
||||
|
||||
self.query_tool_obj = CodeMirror.fromTextArea(text_container.get(0), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
indentUnit: 4,
|
||||
styleSelectedText: true,
|
||||
mode: "text/x-pgsql",
|
||||
@@ -169,7 +171,9 @@ define([
|
||||
extraKeys: pgBrowser.editor_shortcut_keys,
|
||||
tabSize: pgAdmin.Browser.editor_options.tabSize,
|
||||
lineWrapping: pgAdmin.Browser.editor_options.wrapCode,
|
||||
scrollbarStyle: 'simple'
|
||||
scrollbarStyle: 'simple',
|
||||
autoCloseBrackets: pgAdmin.Browser.editor_options.insert_pair_brackets,
|
||||
matchBrackets: pgAdmin.Browser.editor_options.brace_matching
|
||||
});
|
||||
|
||||
// Refresh Code mirror on SQL panel resize to
|
||||
|
||||
Reference in New Issue
Block a user