Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit f8d3014

Browse files
committed
use empty settings on first load, comment settings
1 parent 3ef0d65 commit f8d3014

2 files changed

Lines changed: 30 additions & 13 deletions

File tree

SQLTools.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
SYNTAX_PLAIN_TEXT = 'Packages/Text/Plain text.tmLanguage'
2020
SYNTAX_SQL = 'Packages/SQL/SQL.tmLanguage'
21+
SQLTOOLS_SETTINGS_FILE = 'SQLTools.sublime-settings'
22+
SQLTOOLS_CONNECTIONS_FILE = 'SQLToolsConnections.sublime-settings'
23+
SQLTOOLS_QUERIES_FILE = 'SQLToolsSavedQueries.sublime-settings'
2124

2225
USER_FOLDER = None
2326
DEFAULT_FOLDER = None
@@ -43,12 +46,12 @@ def startPlugin():
4346
USER_FOLDER = os.path.join(sublime.packages_path(), 'User')
4447
DEFAULT_FOLDER = os.path.dirname(__file__)
4548

46-
SETTINGS_FILENAME = os.path.join(USER_FOLDER, "SQLTools.sublime-settings")
47-
SETTINGS_FILENAME_DEFAULT = os.path.join(DEFAULT_FOLDER, "SQLTools.sublime-settings")
48-
CONNECTIONS_FILENAME = os.path.join(USER_FOLDER, "SQLToolsConnections.sublime-settings")
49-
CONNECTIONS_FILENAME_DEFAULT = os.path.join(DEFAULT_FOLDER, "SQLToolsConnections.sublime-settings")
50-
QUERIES_FILENAME = os.path.join(USER_FOLDER, "SQLToolsSavedQueries.sublime-settings")
51-
QUERIES_FILENAME_DEFAULT = os.path.join(DEFAULT_FOLDER, "SQLToolsSavedQueries.sublime-settings")
49+
SETTINGS_FILENAME = os.path.join(USER_FOLDER, SQLTOOLS_SETTINGS_FILE)
50+
SETTINGS_FILENAME_DEFAULT = os.path.join(DEFAULT_FOLDER, SQLTOOLS_SETTINGS_FILE)
51+
CONNECTIONS_FILENAME = os.path.join(USER_FOLDER, SQLTOOLS_CONNECTIONS_FILE)
52+
CONNECTIONS_FILENAME_DEFAULT = os.path.join(DEFAULT_FOLDER, SQLTOOLS_CONNECTIONS_FILE)
53+
QUERIES_FILENAME = os.path.join(USER_FOLDER, SQLTOOLS_QUERIES_FILE)
54+
QUERIES_FILENAME_DEFAULT = os.path.join(DEFAULT_FOLDER, SQLTOOLS_QUERIES_FILE)
5255

5356
settings = Settings(SETTINGS_FILENAME, default=SETTINGS_FILENAME_DEFAULT)
5457
queries = Storage(QUERIES_FILENAME, default=QUERIES_FILENAME_DEFAULT)
@@ -580,6 +583,13 @@ def reload():
580583

581584

582585
def plugin_loaded():
586+
# this ensures we have empty settings file in 'User' directory during first start
587+
# otherwise sublime will copy entire contents of 'SQLTools.sublime-settings'
588+
# which is not desirable and prevents future changes to queries and other
589+
# sensible defaults defined in settings file, as those would be overriden by content
590+
# from older versions of SQLTools in 'User\SQLTools.sublime-settings'
591+
sublime.save_settings(SQLTOOLS_SETTINGS_FILE)
592+
583593
try:
584594
from package_control import events
585595

SQLTools.sublime-settings

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1+
// NOTE: it is strongly advised to override
2+
// only those settings that you wish to change
3+
// in your Users/SQLTools.sublime-settings
14
{
25
"debug" : true,
3-
"thread_timeout" : 15,
6+
"thread_timeout" : 15, // query timeout in seconds
47
"history_size" : 100,
58
"show_result_on_window" : false,
69
"clear_output" : false,
710
"safe_limit" : false,
811
"show_query" : false,
912
"expand_to_paragraph" : false,
1013
/**
11-
* The list of syntax selector for which the plugin autocompletion will be active.
14+
* The list of syntax selectors for which the plugin autocompletion will be active.
1215
* An empty list means autocompletion always active.
1316
*/
1417
"selectors": ["source.sql", "source.pgsql", "source.plpgsql.postgres", "source.plsql.oracle", "source.tsql"],
15-
"autocompletion": "smart", /* possible values: "basic", "smart" or false (disable) */
16-
"unescape_quotes" : [
17-
"php"
18-
],
18+
/**
19+
* Possible values for autocompletion: "basic", "smart" or false (disable)
20+
* Completion keywords case is controlled by format.keyword_case (see below)
21+
*/
22+
"autocompletion": "smart",
1923
/**
2024
* If DB cli binary is not in PATH, set the full path in "cli" section.
2125
* Note: forward slashes ("/") should be used in path. Example:
@@ -41,8 +45,11 @@
4145
"indent_width" : 4,
4246
"reindent" : true
4347
},
48+
"unescape_quotes" : [
49+
"php"
50+
],
4451
/**
45-
* Client options for you SGBD.
52+
* Client options for you RDBMS.
4653
* In this file, the section cli has the names you can use here. Eg: "pgsql": "psql"
4754
* So here, you must have "psql with the same sections listed bellow (options, before, args and queries)"
4855
*

0 commit comments

Comments
 (0)