aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-08 13:02:05 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-08 13:02:05 +0000
commit7f8b4675de74f7b43057d21d445f0ddca59f95b8 (patch)
tree69402383bf87177e40d58a0824f6721be226e96b
parentc10728213ede7dbdd37493aca9657ab4010edbdc (diff)
downloadsequelpro-7f8b4675de74f7b43057d21d445f0ddca59f95b8.tar.gz
sequelpro-7f8b4675de74f7b43057d21d445f0ddca59f95b8.tar.bz2
sequelpro-7f8b4675de74f7b43057d21d445f0ddca59f95b8.zip
• outsourced keyword completion and function completion lists to CompletionTokens.plist
• SPQueryController manages keyword and function completion lists now; this reduces the memory usage a bit and the list is easier to edit • added pre-defined function argument snippets to CompletionTokens.plist (auto-generated from mysql's HELP) • added Preference option for Editor whether a function completion should insert () and if found the function argument snippets automatically or not - last ) will be linked as autopaired then • changed behaviour for wrapping a selection into `"'() etc. - now it re-selects the original selection after wrapping and in addition last wrap character is now marked as autopair-linked • improved logic for popping up the auto-completion list
-rw-r--r--Interfaces/English.lproj/Preferences.xib66
-rw-r--r--Resources/CompletionTokens.plist1139
-rw-r--r--Resources/PreferenceDefaults.plist2
-rw-r--r--Source/CMTextView.h5
-rw-r--r--Source/CMTextView.m1062
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m1
-rw-r--r--Source/SPNarrowDownCompletion.h3
-rw-r--r--Source/SPNarrowDownCompletion.m38
-rw-r--r--Source/SPQueryController.h9
-rw-r--r--Source/SPQueryController.m67
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj4
12 files changed, 1367 insertions, 1030 deletions
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib
index 4d8b75cd..7115052e 100644
--- a/Interfaces/English.lproj/Preferences.xib
+++ b/Interfaces/English.lproj/Preferences.xib
@@ -3721,6 +3721,28 @@ AQAAAAA</bytes>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
+ <object class="NSButton" id="782193237">
+ <reference key="NSNextResponder" ref="1033452264"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{257, 86}, {186, 18}}</string>
+ <reference key="NSSuperview" ref="1033452264"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="131748905">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Insert function arguments</string>
+ <reference key="NSSupport" ref="320262838"/>
+ <reference key="NSControlView" ref="782193237"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="752798171"/>
+ <reference key="NSAlternateImage" ref="888311049"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
<object class="NSButton" id="827082642">
<reference key="NSNextResponder" ref="1033452264"/>
<int key="NSvFlags">268</int>
@@ -3869,7 +3891,7 @@ AQAAAAA</bytes>
<object class="NSButton" id="774563613">
<reference key="NSNextResponder" ref="1033452264"/>
<int key="NSvFlags">-2147483380</int>
- <string key="NSFrame">{{257, 91}, {197, 18}}</string>
+ <string key="NSFrame">{{257, 24}, {197, 18}}</string>
<reference key="NSSuperview" ref="1033452264"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="420702000">
@@ -4041,8 +4063,7 @@ AQAAAAA</bytes>
<object class="NSUserDefaultsController" id="151174232">
<object class="NSMutableArray" key="NSDeclaredKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>CustomQueryAutoComplete</string>
- <string>CustomQueryAutoCompleteDelay</string>
+ <string>CustomQueryFunctionCompletionInsertsArguments</string>
</object>
<bool key="NSSharedInstance">YES</bool>
</object>
@@ -6314,6 +6335,22 @@ AQAAAAA</bytes>
</object>
<int key="connectionID">1541</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.CustomQueryFunctionCompletionInsertsArguments</string>
+ <reference key="source" ref="782193237"/>
+ <reference key="destination" ref="151174232"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="782193237"/>
+ <reference key="NSDestination" ref="151174232"/>
+ <string key="NSLabel">value: values.CustomQueryFunctionCompletionInsertsArguments</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.CustomQueryFunctionCompletionInsertsArguments</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1545</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -7320,7 +7357,6 @@ AQAAAAA</bytes>
<reference ref="571822117"/>
<reference ref="1030846368"/>
<reference ref="397485802"/>
- <reference ref="774563613"/>
<reference ref="16021182"/>
<reference ref="140155660"/>
<reference ref="659498064"/>
@@ -7337,6 +7373,8 @@ AQAAAAA</bytes>
<reference ref="892250776"/>
<reference ref="184945490"/>
<reference ref="827082642"/>
+ <reference ref="774563613"/>
+ <reference ref="782193237"/>
</object>
<reference key="parent" ref="0"/>
<string key="objectName">Editor</string>
@@ -8936,6 +8974,20 @@ AQAAAAA</bytes>
<reference key="object" ref="201150384"/>
<reference key="parent" ref="1009372112"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1542</int>
+ <reference key="object" ref="782193237"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="131748905"/>
+ </object>
+ <reference key="parent" ref="1033452264"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1543</int>
+ <reference key="object" ref="131748905"/>
+ <reference key="parent" ref="782193237"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -9166,6 +9218,8 @@ AQAAAAA</bytes>
<string>1525.IBPluginDependency</string>
<string>1526.IBPluginDependency</string>
<string>1527.IBPluginDependency</string>
+ <string>1542.IBPluginDependency</string>
+ <string>1543.IBPluginDependency</string>
<string>17.IBEditorWindowLastContentRect</string>
<string>17.IBPluginDependency</string>
<string>17.IBUserGuides</string>
@@ -9658,6 +9712,8 @@ AQAAAAA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{571, 222}, {500, 280}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableArray">
@@ -10041,7 +10097,7 @@ AQAAAAA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">1541</int>
+ <int key="maxID">1545</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Resources/CompletionTokens.plist b/Resources/CompletionTokens.plist
new file mode 100644
index 00000000..efbc4648
--- /dev/null
+++ b/Resources/CompletionTokens.plist
@@ -0,0 +1,1139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>core_keywords</key>
+ <array>
+ <string>ACCESSIBLE</string>
+ <string>ACTION</string>
+ <string>ADD</string>
+ <string>AFTER</string>
+ <string>AGAINST</string>
+ <string>AGGREGATE</string>
+ <string>ALGORITHM</string>
+ <string>ALL</string>
+ <string>ALTER</string>
+ <string>ALTER COLUMN</string>
+ <string>ALTER DATABASE</string>
+ <string>ALTER EVENT</string>
+ <string>ALTER FUNCTION</string>
+ <string>ALTER LOGFILE GROUP</string>
+ <string>ALTER PROCEDURE</string>
+ <string>ALTER SCHEMA</string>
+ <string>ALTER SERVER</string>
+ <string>ALTER TABLE</string>
+ <string>ALTER TABLESPACE</string>
+ <string>ALTER VIEW</string>
+ <string>ANALYZE</string>
+ <string>ANALYZE TABLE</string>
+ <string>AND</string>
+ <string>ANY</string>
+ <string>AS</string>
+ <string>ASC</string>
+ <string>ASCII</string>
+ <string>ASENSITIVE</string>
+ <string>AT</string>
+ <string>AUTHORS</string>
+ <string>AUTOEXTEND_SIZE</string>
+ <string>AUTO_INCREMENT</string>
+ <string>AVG</string>
+ <string>AVG_ROW_LENGTH</string>
+ <string>BACKUP</string>
+ <string>BACKUP TABLE</string>
+ <string>BEFORE</string>
+ <string>BEGIN</string>
+ <string>BETWEEN</string>
+ <string>BIGINT</string>
+ <string>BINARY</string>
+ <string>BINLOG</string>
+ <string>BIT</string>
+ <string>BLOB</string>
+ <string>BOOL</string>
+ <string>BOOLEAN</string>
+ <string>BOTH</string>
+ <string>BTREE</string>
+ <string>BY</string>
+ <string>BYTE</string>
+ <string>CACHE</string>
+ <string>CACHE INDEX</string>
+ <string>CALL</string>
+ <string>CASCADE</string>
+ <string>CASCADED</string>
+ <string>CASE</string>
+ <string>CHAIN</string>
+ <string>CHANGE</string>
+ <string>CHANGED</string>
+ <string>CHAR</string>
+ <string>CHARACTER</string>
+ <string>CHARACTER SET</string>
+ <string>CHARSET</string>
+ <string>CHECK</string>
+ <string>CHECK TABLE</string>
+ <string>CHECKSUM</string>
+ <string>CHECKSUM TABLE</string>
+ <string>CIPHER</string>
+ <string>CLIENT</string>
+ <string>CLOSE</string>
+ <string>COALESCE</string>
+ <string>CODE</string>
+ <string>COLLATE</string>
+ <string>COLLATION</string>
+ <string>COLUMN</string>
+ <string>COLUMNS</string>
+ <string>COLUMN_FORMAT</string>
+ <string>COMMENT</string>
+ <string>COMMIT</string>
+ <string>COMMITTED</string>
+ <string>COMPACT</string>
+ <string>COMPLETION</string>
+ <string>COMPRESSED</string>
+ <string>CONCURRENT</string>
+ <string>CONDITION</string>
+ <string>CONNECTION</string>
+ <string>CONSISTENT</string>
+ <string>CONSTRAINT</string>
+ <string>CONTAINS</string>
+ <string>CONTINUE</string>
+ <string>CONTRIBUTORS</string>
+ <string>CONVERT</string>
+ <string>CREATE</string>
+ <string>CREATE DATABASE</string>
+ <string>CREATE EVENT</string>
+ <string>CREATE FUNCTION</string>
+ <string>CREATE INDEX</string>
+ <string>CREATE LOGFILE GROUP</string>
+ <string>CREATE PROCEDURE</string>
+ <string>CREATE SCHEMA</string>
+ <string>CREATE TABLE</string>
+ <string>CREATE TABLESPACE</string>
+ <string>CREATE TRIGGER</string>
+ <string>CREATE USER</string>
+ <string>CREATE VIEW</string>
+ <string>CROSS</string>
+ <string>CUBE</string>
+ <string>CURRENT_DATE</string>
+ <string>CURRENT_TIME</string>
+ <string>CURRENT_TIMESTAMP</string>
+ <string>CURRENT_USER</string>
+ <string>CURSOR</string>
+ <string>DATA</string>
+ <string>DATABASE</string>
+ <string>DATABASES</string>
+ <string>DATAFILE</string>
+ <string>DATE</string>
+ <string>DATETIME</string>
+ <string>DAY</string>
+ <string>DAY_HOUR</string>
+ <string>DAY_MICROSECOND</string>
+ <string>DAY_MINUTE</string>
+ <string>DAY_SECOND</string>
+ <string>DEALLOCATE</string>
+ <string>DEALLOCATE PREPARE</string>
+ <string>DEC</string>
+ <string>DECIMAL</string>
+ <string>DECLARE</string>
+ <string>DEFAULT</string>
+ <string>DEFINER</string>
+ <string>DELAYED</string>
+ <string>DELAY_KEY_WRITE</string>
+ <string>DELETE</string>
+ <string>DELIMITER </string>
+ <string>DELIMITER ;\n</string>
+ <string>DELIMITER ;;\n</string>
+ <string>DESC</string>
+ <string>DESCRIBE</string>
+ <string>DES_KEY_FILE</string>
+ <string>DETERMINISTIC</string>
+ <string>DIRECTORY</string>
+ <string>DISABLE</string>
+ <string>DISCARD</string>
+ <string>DISK</string>
+ <string>DISTINCT</string>
+ <string>DISTINCTROW</string>
+ <string>DIV</string>
+ <string>DO</string>
+ <string>DOUBLE</string>
+ <string>DROP</string>
+ <string>DROP DATABASE</string>
+ <string>DROP EVENT</string>
+ <string>DROP FOREIGN KEY</string>
+ <string>DROP FUNCTION</string>
+ <string>DROP INDEX</string>
+ <string>DROP LOGFILE GROUP</string>
+ <string>DROP PREPARE</string>
+ <string>DROP PRIMARY KEY</string>
+ <string>DROP PREPARE</string>
+ <string>DROP PROCEDURE</string>
+ <string>DROP SCHEMA</string>
+ <string>DROP SERVER</string>
+ <string>DROP TABLE</string>
+ <string>DROP TABLESPACE</string>
+ <string>DROP TRIGGER</string>
+ <string>DROP USER</string>
+ <string>DROP VIEW</string>
+ <string>DUAL</string>
+ <string>DUMPFILE</string>
+ <string>DUPLICATE</string>
+ <string>DYNAMIC</string>
+ <string>EACH</string>
+ <string>ELSE</string>
+ <string>ELSEIF</string>
+ <string>ENABLE</string>
+ <string>ENCLOSED</string>
+ <string>END</string>
+ <string>ENDS</string>
+ <string>ENGINE</string>
+ <string>ENGINES</string>
+ <string>ENUM</string>
+ <string>ERRORS</string>
+ <string>ESCAPE</string>
+ <string>ESCAPED</string>
+ <string>EVENT</string>
+ <string>EVENTS</string>
+ <string>EVERY</string>
+ <string>EXECUTE</string>
+ <string>EXISTS</string>
+ <string>EXIT</string>
+ <string>EXPANSION</string>
+ <string>EXPLAIN</string>
+ <string>EXTENDED</string>
+ <string>EXTENT_SIZE</string>
+ <string>FALSE</string>
+ <string>FAST</string>
+ <string>FETCH</string>
+ <string>FIELDS</string>
+ <string>FIELDS TERMINATED BY</string>
+ <string>FILE</string>
+ <string>FIRST</string>
+ <string>FIXED</string>
+ <string>FLOAT</string>
+ <string>FLOAT4</string>
+ <string>FLOAT8</string>
+ <string>FLUSH</string>
+ <string>FOR</string>
+ <string>FOR UPDATE</string>
+ <string>FORCE</string>
+ <string>FOREIGN</string>
+ <string>FOREIGN KEY</string>
+ <string>FOUND</string>
+ <string>FRAC_SECOND</string>
+ <string>FROM</string>
+ <string>FULL</string>
+ <string>FULLTEXT</string>
+ <string>FUNCTION</string>
+ <string>GEOMETRY</string>
+ <string>GEOMETRYCOLLECTION</string>
+ <string>GET_FORMAT</string>
+ <string>GLOBAL</string>
+ <string>GRANT</string>
+ <string>GRANTS</string>
+ <string>GROUP</string>
+ <string>GROUP BY</string>
+ <string>HANDLER</string>
+ <string>HASH</string>
+ <string>HAVING</string>
+ <string>HELP</string>
+ <string>HIGH_PRIORITY</string>
+ <string>HOSTS</string>
+ <string>HOUR</string>
+ <string>HOUR_MICROSECOND</string>
+ <string>HOUR_MINUTE</string>
+ <string>HOUR_SECOND</string>
+ <string>IDENTIFIED</string>
+ <string>IF</string>
+ <string>IGNORE</string>
+ <string>IMPORT</string>
+ <string>IN</string>
+ <string>INDEX</string>
+ <string>INDEXES</string>
+ <string>INFILE</string>
+ <string>INITIAL_SIZE</string>
+ <string>INNER</string>
+ <string>INNOBASE</string>
+ <string>INNODB</string>
+ <string>INOUT</string>
+ <string>INSENSITIVE</string>
+ <string>INSERT</string>
+ <string>INSERT_METHOD</string>
+ <string>INSTALL</string>
+ <string>INSTALL PLUGIN</string>
+ <string>INT</string>
+ <string>INT1</string>
+ <string>INT2</string>
+ <string>INT3</string>
+ <string>INT4</string>
+ <string>INT8</string>
+ <string>INTEGER</string>
+ <string>INTERVAL</string>
+ <string>INTO</string>
+ <string>INTO DUMPFILE</string>
+ <string>INTO OUTFILE</string>
+ <string>INTO TABLE</string>
+ <string>INVOKER</string>
+ <string>IO_THREAD</string>
+ <string>IS</string>
+ <string>ISOLATION</string>
+ <string>ISSUER</string>
+ <string>ITERATE</string>
+ <string>JOIN</string>
+ <string>KEY</string>
+ <string>KEYS</string>
+ <string>KEY_BLOCK_SIZE</string>
+ <string>KILL</string>
+ <string>LANGUAGE</string>
+ <string>LAST</string>
+ <string>LEADING</string>
+ <string>LEAVE</string>
+ <string>LEAVES</string>
+ <string>LEFT</string>
+ <string>LESS</string>
+ <string>LEVEL</string>
+ <string>LIKE</string>
+ <string>LIMIT</string>
+ <string>LINEAR</string>
+ <string>LINES</string>
+ <string>LINES TERMINATED BY</string>
+ <string>LINESTRING</string>
+ <string>LIST</string>
+ <string>LOAD DATA</string>
+ <string>LOAD INDEX INTO CACHE</string>
+ <string>LOAD XML</string>
+ <string>LOCAL</string>
+ <string>LOCALTIME</string>
+ <string>LOCALTIMESTAMP</string>
+ <string>LOCK</string>
+ <string>LOCK IN SHARE MODE</string>
+ <string>LOCK TABLES</string>
+ <string>LOCKS</string>
+ <string>LOGFILE</string>
+ <string>LOGS</string>
+ <string>LONG</string>
+ <string>LONGBLOB</string>
+ <string>LONGTEXT</string>
+ <string>LOOP</string>
+ <string>LOW_PRIORITY</string>
+ <string>MASTER</string>
+ <string>MASTER_CONNECT_RETRY</string>
+ <string>MASTER_HOST</string>
+ <string>MASTER_LOG_FILE</string>
+ <string>MASTER_LOG_POS</string>
+ <string>MASTER_PASSWORD</string>
+ <string>MASTER_PORT</string>
+ <string>MASTER_SERVER_ID</string>
+ <string>MASTER_SSL</string>
+ <string>MASTER_SSL_CA</string>
+ <string>MASTER_SSL_CAPATH</string>
+ <string>MASTER_SSL_CERT</string>
+ <string>MASTER_SSL_CIPHER</string>
+ <string>MASTER_SSL_KEY</string>
+ <string>MASTER_USER</string>
+ <string>MATCH</string>
+ <string>MAXVALUE</string>
+ <string>MAX_CONNECTIONS_PER_HOUR</string>
+ <string>MAX_QUERIES_PER_HOUR</string>
+ <string>MAX_ROWS</string>
+ <string>MAX_SIZE</string>
+ <string>MAX_UPDATES_PER_HOUR</string>
+ <string>MAX_USER_CONNECTIONS</string>
+ <string>MEDIUM</string>
+ <string>MEDIUMBLOB</string>
+ <string>MEDIUMINT</string>
+ <string>MEDIUMTEXT</string>
+ <string>MEMORY</string>
+ <string>MERGE</string>
+ <string>MICROSECOND</string>
+ <string>MIDDLEINT</string>
+ <string>MIGRATE</string>
+ <string>MINUTE</string>
+ <string>MINUTE_MICROSECOND</string>
+ <string>MINUTE_SECOND</string>
+ <string>MIN_ROWS</string>
+ <string>MOD</string>
+ <string>MODE</string>
+ <string>MODIFIES</string>
+ <string>MODIFY</string>
+ <string>MONTH</string>
+ <string>MULTILINESTRING</string>
+ <string>MULTIPOINT</string>
+ <string>MULTIPOLYGON</string>
+ <string>MUTEX</string>
+ <string>NAME</string>
+ <string>NAMES</string>
+ <string>NATIONAL</string>
+ <string>NATURAL</string>
+ <string>NCHAR</string>
+ <string>NDB</string>
+ <string>NDBCLUSTER</string>
+ <string>NEW</string>
+ <string>NEXT</string>
+ <string>NO</string>
+ <string>NODEGROUP</string>
+ <string>NONE</string>
+ <string>NOT</string>
+ <string>NO_WAIT</string>
+ <string>NO_WRITE_TO_BINLOG</string>
+ <string>NULL</string>
+ <string>NUMERIC</string>
+ <string>NVARCHAR</string>
+ <string>OFFSET</string>
+ <string>OLD_PASSWORD</string>
+ <string>ON</string>
+ <string>ONE</string>
+ <string>ONE_SHOT</string>
+ <string>OPEN</string>
+ <string>OPTIMIZE</string>
+ <string>OPTIMIZE TABLE</string>
+ <string>OPTION</string>
+ <string>OPTIONALLY</string>
+ <string>OPTIONALLY ENCLOSED BY</string>
+ <string>OPTIONS</string>
+ <string>OR</string>
+ <string>ORDER</string>
+ <string>ORDER BY</string>
+ <string>OUT</string>
+ <string>OUTER</string>
+ <string>OUTFILE</string>
+ <string>PACK_KEYS</string>
+ <string>PARSER</string>
+ <string>PARTIAL</string>
+ <string>PARTITION</string>
+ <string>PARTITIONING</string>
+ <string>PARTITIONS</string>
+ <string>PASSWORD</string>
+ <string>PHASE</string>
+ <string>PLUGIN</string>
+ <string>PLUGINS</string>
+ <string>POINT</string>
+ <string>POLYGON</string>
+ <string>PRECISION</string>
+ <string>PREPARE</string>
+ <string>PRESERVE</string>
+ <string>PREV</string>
+ <string>PRIMARY</string>
+ <string>PRIMARY KEY</string>
+ <string>PRIVILEGES</string>
+ <string>PROCEDURE</string>
+ <string>PROCEDURE ANALYSE</string>
+ <string>PROCESS</string>
+ <string>PROCESSLIST</string>
+ <string>PURGE</string>
+ <string>QUARTER</string>
+ <string>QUERY</string>
+ <string>QUICK</string>
+ <string>RANGE</string>
+ <string>READ</string>
+ <string>READS</string>
+ <string>READ_ONLY</string>
+ <string>READ_WRITE</string>
+ <string>REAL</string>
+ <string>REBUILD</string>
+ <string>RECOVER</string>
+ <string>REDOFILE</string>
+ <string>REDO_BUFFER_SIZE</string>
+ <string>REDUNDANT</string>
+ <string>REFERENCES</string>
+ <string>REGEXP</string>
+ <string>RELAY_LOG_FILE</string>
+ <string>RELAY_LOG_POS</string>
+ <string>RELAY_THREAD</string>
+ <string>RELEASE</string>
+ <string>RELOAD</string>
+ <string>REMOVE</string>
+ <string>RENAME</string>
+ <string>RENAME DATABASE</string>
+ <string>RENAME TABLE</string>
+ <string>REORGANIZE</string>
+ <string>REPAIR</string>
+ <string>REPAIR TABLE</string>
+ <string>REPEAT</string>
+ <string>REPEATABLE</string>
+ <string>REPLACE</string>
+ <string>REPLICATION</string>
+ <string>REQUIRE</string>
+ <string>RESET</string>
+ <string>RESET MASTER</string>
+ <string>RESTORE</string>
+ <string>RESTORE TABLE</string>
+ <string>RESTRICT</string>
+ <string>RESUME</string>
+ <string>RETURN</string>
+ <string>RETURNS</string>
+ <string>REVOKE</string>
+ <string>RIGHT</string>
+ <string>RLIKE</string>
+ <string>ROLLBACK</string>
+ <string>ROLLUP</string>
+ <string>ROUTINE</string>
+ <string>ROW</string>
+ <string>ROWS</string>
+ <string>ROWS IDENTIFIED BY</string>
+ <string>ROW_FORMAT</string>
+ <string>RTREE</string>
+ <string>SAVEPOINT</string>
+ <string>SCHEDULE</string>
+ <string>SCHEDULER</string>
+ <string>SCHEMA</string>
+ <string>SCHEMAS</string>
+ <string>SECOND</string>
+ <string>SECOND_MICROSECOND</string>
+ <string>SECURITY</string>
+ <string>SELECT</string>
+ <string>SELECT DISTINCT</string>
+ <string>SENSITIVE</string>
+ <string>SEPARATOR</string>
+ <string>SERIAL</string>
+ <string>SERIALIZABLE</string>
+ <string>SESSION</string>
+ <string>SET</string>
+ <string>SET GLOBAL</string>
+ <string>SET NAMES</string>
+ <string>SET PASSWORD</string>
+ <string>SHARE</string>
+ <string>SHOW</string>
+ <string>SHOW BINARY LOGS</string>
+ <string>SHOW BINLOG EVENTS</string>
+ <string>SHOW CHARACTER SET</string>
+ <string>SHOW COLLATION</string>
+ <string>SHOW COLUMNS</string>
+ <string>SHOW CONTRIBUTORS</string>
+ <string>SHOW CREATE DATABASE</string>
+ <string>SHOW CREATE EVENT</string>
+ <string>SHOW CREATE FUNCTION</string>
+ <string>SHOW CREATE PROCEDURE</string>
+ <string>SHOW CREATE SCHEMA</string>
+ <string>SHOW CREATE TABLE</string>
+ <string>SHOW CREATE TRIGGERS</string>
+ <string>SHOW CREATE VIEW</string>
+ <string>SHOW DATABASES</string>
+ <string>SHOW ENGINE</string>
+ <string>SHOW ENGINES</string>
+ <string>SHOW ERRORS</string>
+ <string>SHOW EVENTS</string>
+ <string>SHOW FIELDS</string>
+ <string>SHOW FULL PROCESSLIST</string>
+ <string>SHOW FUNCTION CODE</string>
+ <string>SHOW FUNCTION STATUS</string>
+ <string>SHOW GRANTS</string>
+ <string>SHOW INDEX</string>
+ <string>SHOW INNODB STATUS</string>
+ <string>SHOW KEYS</string>
+ <string>SHOW MASTER LOGS</string>
+ <string>SHOW MASTER STATUS</string>
+ <string>SHOW OPEN TABLES</string>
+ <string>SHOW PLUGINS</string>
+ <string>SHOW PRIVILEGES</string>
+ <string>SHOW PROCEDURE CODE</string>
+ <string>SHOW PROCEDURE STATUS</string>
+ <string>SHOW PROFILE</string>
+ <string>SHOW PROFILES</string>
+ <string>SHOW PROCESSLIST</string>
+ <string>SHOW SCHEDULER STATUS</string>
+ <string>SHOW SCHEMAS</string>
+ <string>SHOW SLAVE HOSTS</string>
+ <string>SHOW SLAVE STATUS</string>
+ <string>SHOW STATUS</string>
+ <string>SHOW STORAGE ENGINES</string>
+ <string>SHOW TABLE STATUS</string>
+ <string>SHOW TABLE TYPES</string>
+ <string>SHOW TABLES</string>
+ <string>SHOW TRIGGERS</string>
+ <string>SHOW VARIABLES</string>
+ <string>SHOW WARNINGS</string>
+ <string>SHUTDOWN</string>
+ <string>SIGNED</string>
+ <string>SIMPLE</string>
+ <string>SLAVE</string>
+ <string>SMALLINT</string>
+ <string>SNAPSHOT</string>
+ <string>SOME</string>
+ <string>SONAME</string>
+ <string>SOUNDS</string>
+ <string>SPATIAL</string>
+ <string>SPECIFIC</string>
+ <string>SQL_AUTO_IS_NULL</string>
+ <string>SQL_BIG_RESULT</string>
+ <string>SQL_BIG_SELECTS</string>
+ <string>SQL_BIG_TABLES</string>
+ <string>SQL_BUFFER_RESULT</string>
+ <string>SQL_CACHE</string>
+ <string>SQL_CALC_FOUND_ROWS</string>
+ <string>SQL_LOG_BIN</string>
+ <string>SQL_LOG_OFF</string>
+ <string>SQL_LOG_UPDATE</string>
+ <string>SQL_LOW_PRIORITY_UPDATES</string>
+ <string>SQL_MAX_JOIN_SIZE</string>
+ <string>SQL_NO_CACHE</string>
+ <string>SQL_QUOTE_SHOW_CREATE</string>
+ <string>SQL_SAFE_UPDATES</string>
+ <string>SQL_SELECT_LIMIT</string>
+ <string>SQL_SLAVE_SKIP_COUNTER</string>
+ <string>SQL_SMALL_RESULT</string>
+ <string>SQL_THREAD</string>
+ <string>SQL_TSI_DAY</string>
+ <string>SQL_TSI_FRAC_SECOND</string>
+ <string>SQL_TSI_HOUR</string>
+ <string>SQL_TSI_MINUTE</string>
+ <string>SQL_TSI_MONTH</string>
+ <string>SQL_TSI_QUARTER</string>
+ <string>SQL_TSI_SECOND</string>
+ <string>SQL_TSI_WEEK</string>
+ <string>SQL_TSI_YEAR</string>
+ <string>SQL_WARNINGS</string>
+ <string>SSL</string>
+ <string>START</string>
+ <string>START TRANSACTION</string>
+ <string>STARTING</string>
+ <string>STARTS</string>
+ <string>STATUS</string>
+ <string>STOP</string>
+ <string>STORAGE</string>
+ <string>STRAIGHT_JOIN</string>
+ <string>STRING</string>
+ <string>SUBJECT</string>
+ <string>SUBPARTITION</string>
+ <string>SUBPARTITIONS</string>
+ <string>SUPER</string>
+ <string>SUSPEND</string>
+ <string>TABLE</string>
+ <string>TABLES</string>
+ <string>TABLESPACE</string>
+ <string>TEMPORARY</string>
+ <string>TEMPTABLE</string>
+ <string>TERMINATED</string>
+ <string>TEXT</string>
+ <string>THAN</string>
+ <string>THEN</string>
+ <string>TIME</string>
+ <string>TIMESTAMP</string>
+ <string>TIMESTAMPADD</string>
+ <string>TIMESTAMPDIFF</string>
+ <string>TINYBLOB</string>
+ <string>TINYINT</string>
+ <string>TINYTEXT</string>
+ <string>TO</string>
+ <string>TRAILING</string>
+ <string>TRANSACTION</string>
+ <string>TRIGGER</string>
+ <string>TRIGGERS</string>
+ <string>TRUE</string>
+ <string>TRUNCATE</string>
+ <string>TYPE</string>
+ <string>TYPES</string>
+ <string>UNCOMMITTED</string>
+ <string>UNDEFINED</string>
+ <string>UNDO</string>
+ <string>UNDOFILE</string>
+ <string>UNDO_BUFFER_SIZE</string>
+ <string>UNICODE</string>
+ <string>UNINSTALL</string>
+ <string>UNINSTALL PLUGIN</string>
+ <string>UNION</string>
+ <string>UNIQUE</string>
+ <string>UNKNOWN</string>
+ <string>UNLOCK</string>
+ <string>UNLOCK TABLES</string>
+ <string>UNSIGNED</string>
+ <string>UNTIL</string>
+ <string>UPDATE</string>
+ <string>UPGRADE</string>
+ <string>USAGE</string>
+ <string>USE</string>
+ <string>USER</string>
+ <string>USER_RESOURCES</string>
+ <string>USE_FRM</string>
+ <string>USING</string>
+ <string>UTC_DATE</string>
+ <string>UTC_TIME</string>
+ <string>UTC_TIMESTAMP</string>
+ <string>VALUE</string>
+ <string>VALUES</string>
+ <string>VARBINARY</string>
+ <string>VARCHAR</string>
+ <string>VARCHARACTER</string>
+ <string>VARIABLES</string>
+ <string>VARYING</string>
+ <string>VIEW</string>
+ <string>WAIT</string>
+ <string>WARNINGS</string>
+ <string>WEEK</string>
+ <string>WHEN</string>
+ <string>WHERE</string>
+ <string>WHILE</string>
+ <string>WITH</string>
+ <string>WITH CONSISTENT SNAPSHOT</string>
+ <string>WORK</string>
+ <string>WRITE</string>
+ <string>X509</string>
+ <string>XA</string>
+ <string>XOR</string>
+ <string>YEAR</string>
+ <string>YEAR_MONTH</string>
+ <string>ZEROFILL</string>
+ </array>
+ <key>core_builtin_functions</key>
+ <array>
+ <string>ABS</string>
+ <string>ACOS</string>
+ <string>ADDDATE</string>
+ <string>ADDTIME</string>
+ <string>AES_DECRYPT</string>
+ <string>AES_ENCRYPT</string>
+ <string>AREA</string>
+ <string>ASBINARY</string>
+ <string>ASCII</string>
+ <string>ASIN</string>
+ <string>ASTEXT</string>
+ <string>ATAN</string>
+ <string>ATAN2</string>
+ <string>AVG</string>
+ <string>BDMPOLYFROMTEXT</string>
+ <string>BDMPOLYFROMWKB</string>
+ <string>BDPOLYFROMTEXT</string>
+ <string>BDPOLYFROMWKB</string>
+ <string>BENCHMARK</string>
+ <string>BIN</string>
+ <string>BIT_AND</string>
+ <string>BIT_COUNT</string>
+ <string>BIT_LENGTH</string>
+ <string>BIT_OR</string>
+ <string>BIT_XOR</string>
+ <string>BOUNDARY</string>
+ <string>BUFFER</string>
+ <string>CAST</string>
+ <string>CEIL</string>
+ <string>CEILING</string>
+ <string>CENTROID</string>
+ <string>CHAR</string>
+ <string>CHARACTER_LENGTH</string>
+ <string>CHARSET</string>
+ <string>CHAR_LENGTH</string>
+ <string>COALESCE</string>
+ <string>COERCIBILITY</string>
+ <string>COLLATION</string>
+ <string>COMPRESS</string>
+ <string>CONCAT</string>
+ <string>CONCAT_WS</string>
+ <string>CONNECTION_ID</string>
+ <string>CONTAINS</string>
+ <string>CONV</string>
+ <string>CONVERT</string>
+ <string>CONVERT_TZ</string>
+ <string>CONVEXHULL</string>
+ <string>COS</string>
+ <string>COT</string>
+ <string>COUNT</string>
+ <string>COUNT(*)</string>
+ <string>CRC32</string>
+ <string>CROSSES</string>
+ <string>CURDATE</string>
+ <string>CURRENT_DATE</string>
+ <string>CURRENT_TIME</string>
+ <string>CURRENT_TIMESTAMP</string>
+ <string>CURRENT_USER</string>
+ <string>CURTIME</string>
+ <string>DATABASE</string>
+ <string>DATE</string>
+ <string>DATEDIFF</string>
+ <string>DATE_ADD</string>
+ <string>DATE_DIFF</string>
+ <string>DATE_FORMAT</string>
+ <string>DATE_SUB</string>
+ <string>DAY</string>
+ <string>DAYNAME</string>
+ <string>DAYOFMONTH</string>
+ <string>DAYOFWEEK</string>
+ <string>DAYOFYEAR</string>
+ <string>DECODE</string>
+ <string>DEFAULT</string>
+ <string>DEGREES</string>
+ <string>DES_DECRYPT</string>
+ <string>DES_ENCRYPT</string>
+ <string>DIFFERENCE</string>
+ <string>DIMENSION</string>
+ <string>DISJOINT</string>
+ <string>DISTANCE</string>
+ <string>ELT</string>
+ <string>ENCODE</string>
+ <string>ENCRYPT</string>
+ <string>ENDPOINT</string>
+ <string>ENVELOPE</string>
+ <string>EQUALS</string>
+ <string>EXP</string>
+ <string>EXPORT_SET</string>
+ <string>EXTERIORRING</string>
+ <string>EXTRACT</string>
+ <string>EXTRACTVALUE</string>
+ <string>FIELD</string>
+ <string>FIND_IN_SET</string>
+ <string>FLOOR</string>
+ <string>FORMAT</string>
+ <string>FOUND_ROWS</string>
+ <string>FROM_DAYS</string>
+ <string>FROM_UNIXTIME</string>
+ <string>GEOMCOLLFROMTEXT</string>
+ <string>GEOMCOLLFROMWKB</string>
+ <string>GEOMETRYCOLLECTION</string>
+ <string>GEOMETRYCOLLECTIONFROMTEXT</string>
+ <string>GEOMETRYCOLLECTIONFROMWKB</string>
+ <string>GEOMETRYFROMTEXT</string>
+ <string>GEOMETRYFROMWKB</string>
+ <string>GEOMETRYN</string>
+ <string>GEOMETRYTYPE</string>
+ <string>GEOMFROMTEXT</string>
+ <string>GEOMFROMWKB</string>
+ <string>GET_FORMAT</string>
+ <string>GET_LOCK</string>
+ <string>GLENGTH</string>
+ <string>GREATEST</string>
+ <string>GROUP_CONCAT</string>
+ <string>GROUP_UNIQUE_USERS</string>
+ <string>HEX</string>
+ <string>HOUR</string>
+ <string>IF</string>
+ <string>IFNULL</string>
+ <string>INET_ATON</string>
+ <string>INET_NTOA</string>
+ <string>INSERT</string>
+ <string>INSERT_ID</string>
+ <string>INSTR</string>
+ <string>INTERIORRINGN</string>
+ <string>INTERSECTION</string>
+ <string>INTERSECTS</string>
+ <string>INTERVAL</string>
+ <string>ISCLOSED</string>
+ <string>ISEMPTY</string>
+ <string>ISNULL</string>
+ <string>ISRING</string>
+ <string>ISSIMPLE</string>
+ <string>IS_FREE_LOCK</string>
+ <string>IS_USED_LOCK</string>
+ <string>LAST_DAY</string>
+ <string>LAST_INSERT_ID</string>
+ <string>LCASE</string>
+ <string>LEAST</string>
+ <string>LEFT</string>
+ <string>LENGTH</string>
+ <string>LINEFROMTEXT</string>
+ <string>LINEFROMWKB</string>
+ <string>LINESTRING</string>
+ <string>LINESTRINGFROMTEXT</string>
+ <string>LINESTRINGFROMWKB</string>
+ <string>LN</string>
+ <string>LOAD_FILE</string>
+ <string>LOCALTIME</string>
+ <string>LOCALTIMESTAMP</string>
+ <string>LOCATE</string>
+ <string>LOG</string>
+ <string>LOG10</string>
+ <string>LOG2</string>
+ <string>LOWER</string>
+ <string>LPAD</string>
+ <string>LTRIM</string>
+ <string>MAKEDATE</string>
+ <string>MAKETIME</string>
+ <string>MAKE_SET</string>
+ <string>MASTER_POS_WAIT</string>
+ <string>MAX</string>
+ <string>MBRCONTAINS</string>
+ <string>MBRDISJOINT</string>
+ <string>MBREQUAL</string>
+ <string>MBRINTERSECTS</string>
+ <string>MBROVERLAPS</string>
+ <string>MBRTOUCHES</string>
+ <string>MBRWITHIN</string>
+ <string>MD5</string>
+ <string>MICROSECOND</string>
+ <string>MID</string>
+ <string>MIN</string>
+ <string>MINUTE</string>
+ <string>MLINEFROMTEXT</string>
+ <string>MLINEFROMWKB</string>
+ <string>MOD</string>
+ <string>MONTH</string>
+ <string>MONTHNAME</string>
+ <string>NOW</string>
+ <string>MPOINTFROMTEXT</string>
+ <string>MPOINTFROMWKB</string>
+ <string>MPOLYFROMTEXT</string>
+ <string>MPOLYFROMWKB</string>
+ <string>MULTILINESTRING</string>
+ <string>MULTILINESTRINGFROMTEXT</string>
+ <string>MULTILINESTRINGFROMWKB</string>
+ <string>MULTIPOINT</string>
+ <string>MULTIPOINTFROMTEXT</string>
+ <string>MULTIPOINTFROMWKB</string>
+ <string>MULTIPOLYGON</string>
+ <string>MULTIPOLYGONFROMTEXT</string>
+ <string>MULTIPOLYGONFROMWKB</string>
+ <string>NAME_CONST</string>
+ <string>NOW</string>
+ <string>NULLIF</string>
+ <string>NUMGEOMETRIES</string>
+ <string>NUMINTERIORRINGS</string>
+ <string>NUMPOINTS</string>
+ <string>OCT</string>
+ <string>OCTET_LENGTH</string>
+ <string>OLD_PASSWORD</string>
+ <string>ORD</string>
+ <string>OVERLAPS</string>
+ <string>PASSWORD</string>
+ <string>PERIOD_ADD</string>
+ <string>PERIOD_DIFF</string>
+ <string>PI</string>
+ <string>POINT</string>
+ <string>POINTFROMTEXT</string>
+ <string>POINTFROMWKB</string>
+ <string>POINTN</string>
+ <string>POINTONSURFACE</string>
+ <string>POLYFROMTEXT</string>
+ <string>POLYFROMWKB</string>
+ <string>POLYGON</string>
+ <string>POLYGONFROMTEXT</string>
+ <string>POLYGONFROMWKB</string>
+ <string>POSITION</string>
+ <string>POW</string>
+ <string>POWER</string>
+ <string>QUARTER</string>
+ <string>QUOTE</string>
+ <string>RADIANS</string>
+ <string>RAND</string>
+ <string>RELATED</string>
+ <string>RELEASE_LOCK</string>
+ <string>REPEAT</string>
+ <string>REPLACE</string>
+ <string>REVERSE</string>
+ <string>RIGHT</string>
+ <string>ROUND</string>
+ <string>ROW_COUNT</string>
+ <string>RPAD</string>
+ <string>RTRIM</string>
+ <string>SCHEMA</string>
+ <string>SECOND</string>
+ <string>SEC_TO_TIME</string>
+ <string>SESSION_USER</string>
+ <string>SHA</string>
+ <string>SHA1</string>
+ <string>SIGN</string>
+ <string>SIN</string>
+ <string>SLEEP</string>
+ <string>SOUNDEX</string>
+ <string>SPACE</string>
+ <string>SQRT</string>
+ <string>SRID</string>
+ <string>STARTPOINT</string>
+ <string>STD</string>
+ <string>STDDEV</string>
+ <string>STDDEV_POP</string>
+ <string>STDDEV_SAMP</string>
+ <string>STRCMP</string>
+ <string>STR_TO_DATE</string>
+ <string>SUBDATE</string>
+ <string>SUBSTR</string>
+ <string>SUBSTRING</string>
+ <string>SUBSTRING_INDEX</string>
+ <string>SUBTIME</string>
+ <string>SUM</string>
+ <string>SYMDIFFERENCE</string>
+ <string>SYSDATE</string>
+ <string>SYSTEM_USER</string>
+ <string>TAN</string>
+ <string>TIME</string>
+ <string>TIMEDIFF</string>
+ <string>TIMESTAMP</string>
+ <string>TIMESTAMPADD</string>
+ <string>TIMESTAMPDIFF</string>
+ <string>TIME_FORMAT</string>
+ <string>TIME_TO_SEC</string>
+ <string>TOUCHES</string>
+ <string>TO_DAYS</string>
+ <string>TRIM</string>
+ <string>TRUNCATE</string>
+ <string>UCASE</string>
+ <string>UNCOMPRESS</string>
+ <string>UNCOMPRESSED_LENGTH</string>
+ <string>UNHEX</string>
+ <string>UNIQUE_USERS</string>
+ <string>UNIX_TIMESTAMP</string>
+ <string>UPDATEXML</string>
+ <string>UPPER</string>
+ <string>USER</string>
+ <string>UTC_DATE</string>
+ <string>UTC_TIME</string>
+ <string>UTC_TIMESTAMP</string>
+ <string>UUID</string>
+ <string>VARIANCE</string>
+ <string>VAR_POP</string>
+ <string>VAR_SAMP</string>
+ <string>VERSION</string>
+ <string>WEEK</string>
+ <string>WEEKDAY</string>
+ <string>WEEKOFYEAR</string>
+ <string>WITHIN</string>
+ <string>YEAR</string>
+ <string>YEARWEEK</string>
+ </array>
+ <key>function_argument_snippets</key>
+ <dict>
+ <key>CONCAT</key>
+ <string>${1:str1}, ${2:str2}</string>
+ <key>CHAR</key>
+ <string>${1:N}, ${2:USING ${3:charset_name}}</string>
+ <key>MASTER_POS_WAIT</key>
+ <string>${1:log_name}, ${2:log_pos}${3:, ${4:timeout}}</string>
+ <key>WEEK</key>
+ <string>${1:date}${2:, ${3:mode}}</string>
+ <key>UpdateXML</key>
+ <string>${1:xml_target}, ${2:xpath_expr}, ${3:new_xml}</string>
+ <key>MID</key>
+ <string>${1:str}, ${2:pos}, ${3:len}</string>
+ <key>ROUND</key>
+ <string>${1:X}${2:, ${3:D}}</string>
+ <key>NULLIF</key>
+ <string>${1:expr1}, ${2:expr2}</string>
+ <key>TIMEDIFF</key>
+ <string>${1:expr1}, ${2:expr2}</string>
+ <key>REPLACE</key>
+ <string>${1:str}, ${2:from_str}, ${3:to_str}</string>
+ <key>ADDTIME</key>
+ <string>${1:expr1}, ${2:expr2}</string>
+ <key>TIMESTAMPDIFF</key>
+ <string>${1:unit}, ${2:datetime_expr1}, ${3:datetime_expr2}</string>
+ <key>FROM_UNIXTIME</key>
+ <string>${1:unix_timestamp}${2:, ${3:format}}</string>
+ <key>IFNULL</key>
+ <string>${1:expr1}, ${2:expr2}</string>
+ <key>LEAST</key>
+ <string>${1:value1}, ${2:value2}</string>
+ <key>MATCH</key>
+ <string>${1:col} AGAINST ${2:expr}</string>
+ <key>DES_DECRYPT</key>
+ <string>${1:crypt_str}${2:, ${3:key_str}}</string>
+ <key>DECODE</key>
+ <string>${1:crypt_str}, ${2:pass_str}</string>
+ <key>GET_LOCK</key>
+ <string>${1:st}, ${2:timeout}</string>
+ <key>CONV</key>
+ <string>${1:N}, ${2:from_base}, ${3:to_base}</string>
+ <key>ENCRYPT</key>
+ <string>${1:str}${2:, ${3:salt}}</string>
+ <key>ExtractValue</key>
+ <string>${1:xml_frag}, ${2:xpath_expr}</string>
+ <key>FORMAT</key>
+ <string>${1:X}, ${2:D}</string>
+ <key>TIME_FORMAT</key>
+ <string>${1:time}, ${2:format}</string>
+ <key>LEFT</key>
+ <string>${1:str}, ${2:len</string>
+ <key>RAND</key>
+ <string>${1:N}</string>
+ <key>RPAD</key>
+ <string>${1:str}, ${2:len}, ${3:padstr}</string>
+ <key>ELT</key>
+ <string>${1:N}, ${2:str1}</string>
+ <key>CONCAT_WS</key>
+ <string>${1:separator}, ${2:str1}</string>
+ <key>LOCATE</key>
+ <string>${1:substr}, ${2:str}${3:, ${4:pos}}</string>
+ <key>SUBDATE</key>
+ <string>${1:date/expr}, ${2:INTERVAL ${3:expr} ${4:unit}}</string>
+ <key>LPAD</key>
+ <string>${1:str}, ${2:len}, ${3:padstr}</string>
+ <key>ANALYSE</key>
+ <string>${1:${2:max_elements}${3:, ${4:max_memory}}}</string>
+ <key>TIMESTAMP</key>
+ <string>${1:expr1}${2:, ${3:expr2}}</string>
+ <key>INSERT</key>
+ <string>${1:str}, ${2:pos}, ${3:len}, ${4:newstr}</string>
+ <key>YEARWEEK</key>
+ <string>${1:date}${2:, ${3:mode}}</string>
+ <key>UNIX_TIMESTAMP</key>
+ <string>${1:date}</string>
+ <key>CONVERT</key>
+ <string>${1:expr}${2:, USING ${3:transcoding_name}}</string>
+ <key>ADDDATE</key>
+ <string>${1:date/expr}${2:, INTERVAL ${3:expr} ${4:unit}}</string>
+ <key>LAST_INSERT_ID</key>
+ <string>${1:expr}</string>
+ <key>SUBTIME</key>
+ <string>${1:expr1}, ${2:expr2}</string>
+ <key>POW</key>
+ <string>${1:X}, ${2:Y}</string>
+ <key>INSTR</key>
+ <string>${1:str}, ${2:substr}</string>
+ <key>REPEAT</key>
+ <string>${1:str}, ${2:count}</string>
+ <key>MAKEDATE</key>
+ <string>${1:year}, ${2:dayofyear}</string>
+ <key>SUBSTRING_INDEX</key>
+ <string>${1:str}, ${2:delim}, ${3:count}</string>
+ <key>ENCODE</key>
+ <string>${1:str}, ${2:pass_str}</string>
+ <key>TRUNCATE</key>
+ <string>${1:X}, ${2:D}</string>
+ <key>TIMESTAMPADD</key>
+ <string>${1:unit}, ${2:interval}, ${3:datetime_expr}</string>
+ <key>GREATEST</key>
+ <string>${1:value1}, ${2:value2}</string>
+ <key>ATAN</key>
+ <string>${1:Y}, ${2:X}</string>
+ <key>ATAN2</key>
+ <string>${1:Y}, ${2:X}</string>
+ <key>DATE_FORMAT</key>
+ <string>${1:date}, ${2:format}</string>
+ <key>BENCHMARK</key>
+ <string>${1:count}, ${2:expr}</string>
+ <key>NAME_CONST</key>
+ <string>${1:name}, ${2:value}</string>
+ <key>CONVERT_TZ</key>
+ <string>${1:dt}, ${2:from_tz}, ${3:to_tz}</string>
+ <key>EXPORT_SET</key>
+ <string>${1:bits}, ${2:on}, ${3:off}${4:, ${5:separator}${6:, ${7:number_of_bits}}}</string>
+ <key>DATE_ADD</key>
+ <string>${1:date}, INTERVAL ${2:expr} ${3:unit}</string>
+ <key>DATE_SUB</key>
+ <string>${1:date}, INTERVAL ${2:expr} ${3:unit}</string>
+ <key>PERIOD_DIFF</key>
+ <string>${1:P1}, ${2:P2}</string>
+ <key>DES_ENCRYPT</key>
+ <string>${1:str},${2:key_num|key_str}</string>
+ <key>STR_TO_DATE</key>
+ <string>${1:str}, ${2:format}</string>
+ <key>DATE_SUB</key>
+ <string>${1:date}, INTERVAL ${2:expr} ${3:unit}</string>
+ <key>PERIOD_ADD</key>
+ <string>${1:P}, ${2:N}</string>
+ <key>RIGHT</key>
+ <string>${1:str}, ${2:len}</string>
+ <key>DATEDIFF</key>
+ <string>${1:expr1}, ${2:expr2}</string>
+ <key>COUNT</key>
+ <string>${1:${2:DISTINCT }${3:*}}</string>
+ <key>INTERVAL</key>
+ <string>${1:N}, ${2:N1}</string>
+ <key>AES_ENCRYPT</key>
+ <string>${1:str}, ${2:key_str}</string>
+ <key>GET_FORMAT</key>
+ <string>${1:DATE|TIME|DATETIME}, ${2:'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'}</string>
+ <key>FIELD</key>
+ <string>${1:str}, ${2:str1}</string>
+ <key>MAKETIME</key>
+ <string>${1:hour}, ${2:minute}, ${3:second}</string>
+ <key>IF</key>
+ <string>${1:test}, ${2:true_expr}, ${3:false_expr}</string>
+ <key>POWER</key>
+ <string>${1:X}, ${2:Y}</string>
+ <key>STRCMP</key>
+ <string>${1:expr1}, ${2:expr2}</string>
+ <key>LOG</key>
+ <string>${1:B}, ${2:X}</string>
+ <key>AES_DECRYPT</key>
+ <string>${1:crypt_str}, ${2:key_str}</string>
+ <key>COALESCE</key>
+ <string>${1:values}</string>
+ <key>MAKE_SET</key>
+ <string>${1:bits}, ${2:str1}</string>
+ <key>FIND_IN_SET</key>
+ <string>${1:str}, ${2:strlist}</string>
+ </dict>
+ </dict>
+</plist>
diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist
index 5b941ba3..9b8bec6a 100644
--- a/Resources/PreferenceDefaults.plist
+++ b/Resources/PreferenceDefaults.plist
@@ -86,6 +86,8 @@
<false/>
<key>CustomQueryEditorTabStopWidth</key>
<integer>4</integer>
+ <key>CustomQueryFunctionCompletionInsertsArguments</key>
+ <true/>
<key>CustomQueryAutoComplete</key>
<false/>
<key>CustomQueryAutoCompleteDelay</key>
diff --git a/Source/CMTextView.h b/Source/CMTextView.h
index 558bc284..71799f26 100644
--- a/Source/CMTextView.h
+++ b/Source/CMTextView.h
@@ -74,6 +74,7 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS
BOOL snippetWasJustInserted;
BOOL completionIsOpen;
+ BOOL completionWasReinvokedAutomatically;
NSColor *queryHiliteColor;
NSColor *queryEditorBackgroundColor;
@@ -101,6 +102,7 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS
@property(assign) NSRange queryRange;
@property(assign) BOOL shouldHiliteQuery;
@property(assign) BOOL completionIsOpen;
+@property(assign) BOOL completionWasReinvokedAutomatically;
- (IBAction)showMySQLHelpForCurrentWord:(id)sender;
@@ -110,9 +112,6 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS
- (BOOL) wrapSelectionWithPrefix:(NSString *)prefix suffix:(NSString *)suffix;
- (BOOL) shiftSelectionRight;
- (BOOL) shiftSelectionLeft;
-// - (NSArray *) completionsForPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index;
-- (NSArray *) keywords;
-- (NSArray *) functions;
- (void) setAutoindent:(BOOL)enableAutoindent;
- (BOOL) autoindent;
- (void) setAutoindentIgnoresEnter:(BOOL)enableAutoindentIgnoresEnter;
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 30c4d7a5..0c6d2187 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -99,6 +99,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS
@synthesize queryRange;
@synthesize shouldHiliteQuery;
@synthesize completionIsOpen;
+@synthesize completionWasReinvokedAutomatically;
/*
* Sort function (mainly used to sort the words in the textView)
@@ -141,6 +142,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self setAutopair:[prefs boolForKey:SPCustomQueryAutoPairCharacters]];
[self setAutohelp:[prefs boolForKey:SPCustomQueryUpdateAutoHelp]];
[self setAutouppercaseKeywords:[prefs boolForKey:SPCustomQueryAutoUppercaseKeywords]];
+ [self setCompletionWasReinvokedAutomatically:NO];
+
// Re-define tab stops for a better editing
[self setTabStops];
@@ -278,12 +281,17 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(!isDictMode) {
// Add predefined keywords
- for(id s in [self keywords])
+ NSArray *keywordList = [[NSArray arrayWithArray:[[SPQueryController sharedQueryController] keywordList]] retain];
+ for(id s in keywordList)
[possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:s, @"display", @"dummy-small", @"image", nil]];
// Add predefined functions
- for(id s in [self functions])
+ NSArray *functionList = [[NSArray arrayWithArray:[[SPQueryController sharedQueryController] functionList]] retain];
+ for(id s in functionList)
[possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:s, @"display", @"func-small", @"image", nil]];
+
+ [functionList release];
+ [keywordList release];
}
}
@@ -482,7 +490,9 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if([[[self textStorage] attribute:kQuote atIndex:r.location-1 effectiveRange:nil] isEqualToString:kQuoteValue])
return;
if(![[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[[self string] characterAtIndex:r.location-1]])
- [self doCompletionByUsingSpellChecker:NO fuzzyMode:NO autoCompleteMode:YES];
+ // Suppress auto-completion if window isn't active anymore
+ if([[NSApp keyWindow] firstResponder] == self)
+ [self doCompletionByUsingSpellChecker:NO fuzzyMode:NO autoCompleteMode:YES];
}
}
@@ -520,7 +530,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Break for long stuff
if(completionRange.length>100000) return;
- NSString* allow; // additional chars which not close the popup
+ NSString* allow; // additional chars which won't close the suggestion list window
if(isDictMode)
allow= @"_";
else
@@ -848,18 +858,25 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
- (BOOL) wrapSelectionWithPrefix:(NSString *)prefix suffix:(NSString *)suffix
{
+ NSRange currentRange = [self selectedRange];
+
// Only proceed if a selection is active
- if ([self selectedRange].length == 0 || ![self isEditable])
+ if (currentRange.length == 0 || ![self isEditable])
return NO;
+ NSString *selString = [[self string] substringWithRange:currentRange];
+
// Replace the current selection with the selected string wrapped in prefix and suffix
- [self insertText:
- [NSString stringWithFormat:@"%@%@%@",
- prefix,
- [[self string] substringWithRange:[self selectedRange]],
- suffix
- ]
- ];
+ [self insertText:[NSString stringWithFormat:@"%@%@%@", prefix, selString, suffix]];
+
+ // Re-select original selection
+ NSRange innerSelectionRange = NSMakeRange(currentRange.location+1, [selString length]);
+ [self setSelectedRange:innerSelectionRange];
+
+ // If autopair is enabled mark last autopair character as autopair-linked
+ if([prefs boolForKey:SPCustomQueryAutoPairCharacters])
+ [[self textStorage] addAttribute:kAPlinked value:kAPval range:NSMakeRange(NSMaxRange(innerSelectionRange), 1)];
+
return YES;
}
@@ -1271,6 +1288,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self breakUndoCoalescing];
[self insertText:snip];
+ // If autopair is enabled check whether snip begins with ( and ends with ), if so mark ) as pair-linked
+ if([prefs boolForKey:SPCustomQueryAutoPairCharacters] && ([snip hasPrefix:@"("] && [snip hasSuffix:@")"] || ([snip hasPrefix:@"`"] && [snip hasSuffix:@"`"]) || ([snip hasPrefix:@"'"] && [snip hasSuffix:@"'"]) || ([snip hasPrefix:@"\""] && [snip hasSuffix:@"\""])))
+ [[self textStorage] addAttribute:kAPlinked value:kAPval range:NSMakeRange([self selectedRange].location - 1, 1)];
+
// Any snippets defined?
if(snippetControlCounter > -1) {
// Find and select first defined snippet
@@ -1475,6 +1496,12 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
selector:@selector(autoHelp)
object:nil];
+ // Cancel auto-completion timer
+ if([prefs boolForKey:SPCustomQueryAutoComplete])
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(doAutoCompletion)
+ object:nil];
+
[super mouseDown:theEvent];
// Start autoHelp timer
@@ -1497,6 +1524,13 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
afterDelay:[[prefs valueForKey:SPCustomQueryAutoHelpDelay] doubleValue]];
}
+ // Cancel auto-completion timer
+ if([prefs boolForKey:SPCustomQueryAutoComplete])
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(doAutoCompletion)
+ object:nil];
+
+
long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask);
// Check if user pressed ⌥ to allow composing of accented characters.
@@ -1516,6 +1550,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if ([theEvent keyCode] == 53 && [self isEditable]){ // ESC key for internal completion
+ [self setCompletionWasReinvokedAutomatically:NO];
+
// Cancel autocompletion trigger
if([prefs boolForKey:SPCustomQueryAutoComplete])
[NSObject cancelPreviousPerformRequestsWithTarget:self
@@ -1529,6 +1565,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
return;
}
if (insertedCharacter == NSF5FunctionKey && [self isEditable]){ // F5 for completion based on spell checker
+ [self setCompletionWasReinvokedAutomatically:NO];
[self doCompletionByUsingSpellChecker:YES fuzzyMode:NO autoCompleteMode:NO];
return;
}
@@ -1827,993 +1864,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
/*
- * List of keywords for autocompletion. If you add a keyword here,
- * it should also be added to the flex file SPEditorTokens.l
- */
--(NSArray *)keywords
-{
- return [NSArray arrayWithObjects:
- @"ACCESSIBLE",
- @"ACTION",
- @"ADD",
- @"AFTER",
- @"AGAINST",
- @"AGGREGATE",
- @"ALGORITHM",
- @"ALL",
- @"ALTER",
- @"ALTER COLUMN",
- @"ALTER DATABASE",
- @"ALTER EVENT",
- @"ALTER FUNCTION",
- @"ALTER LOGFILE GROUP",
- @"ALTER PROCEDURE",
- @"ALTER SCHEMA",
- @"ALTER SERVER",
- @"ALTER TABLE",
- @"ALTER TABLESPACE",
- @"ALTER VIEW",
- @"ANALYZE",
- @"ANALYZE TABLE",
- @"AND",
- @"ANY",
- @"AS",
- @"ASC",
- @"ASCII",
- @"ASENSITIVE",
- @"AT",
- @"AUTHORS",
- @"AUTOEXTEND_SIZE",
- @"AUTO_INCREMENT",
- @"AVG",
- @"AVG_ROW_LENGTH",
- @"BACKUP",
- @"BACKUP TABLE",
- @"BEFORE",
- @"BEGIN",
- @"BETWEEN",
- @"BIGINT",
- @"BINARY",
- @"BINLOG",
- @"BIT",
- @"BLOB",
- @"BOOL",
- @"BOOLEAN",
- @"BOTH",
- @"BTREE",
- @"BY",
- @"BYTE",
- @"CACHE",
- @"CACHE INDEX",
- @"CALL",
- @"CASCADE",
- @"CASCADED",
- @"CASE",
- @"CHAIN",
- @"CHANGE",
- @"CHANGED",
- @"CHAR",
- @"CHARACTER",
- @"CHARACTER SET",
- @"CHARSET",
- @"CHECK",
- @"CHECK TABLE",
- @"CHECKSUM",
- @"CHECKSUM TABLE",
- @"CIPHER",
- @"CLIENT",
- @"CLOSE",
- @"COALESCE",
- @"CODE",
- @"COLLATE",
- @"COLLATION",
- @"COLUMN",
- @"COLUMNS",
- @"COLUMN_FORMAT"
- @"COMMENT",
- @"COMMIT",
- @"COMMITTED",
- @"COMPACT",
- @"COMPLETION",
- @"COMPRESSED",
- @"CONCURRENT",
- @"CONDITION",
- @"CONNECTION",
- @"CONSISTENT",
- @"CONSTRAINT",
- @"CONTAINS",
- @"CONTINUE",
- @"CONTRIBUTORS",
- @"CONVERT",
- @"CREATE",
- @"CREATE DATABASE",
- @"CREATE EVENT",
- @"CREATE FUNCTION",
- @"CREATE INDEX",
- @"CREATE LOGFILE GROUP",
- @"CREATE PROCEDURE",
- @"CREATE SCHEMA",
- @"CREATE TABLE",
- @"CREATE TABLESPACE",
- @"CREATE TRIGGER",
- @"CREATE USER",
- @"CREATE VIEW",
- @"CROSS",
- @"CUBE",
- @"CURRENT_DATE",
- @"CURRENT_TIME",
- @"CURRENT_TIMESTAMP",
- @"CURRENT_USER",
- @"CURSOR",
- @"DATA",
- @"DATABASE",
- @"DATABASES",
- @"DATAFILE",
- @"DATE",
- @"DATETIME",
- @"DAY",
- @"DAY_HOUR",
- @"DAY_MICROSECOND",
- @"DAY_MINUTE",
- @"DAY_SECOND",
- @"DEALLOCATE",
- @"DEALLOCATE PREPARE",
- @"DEC",
- @"DECIMAL",
- @"DECLARE",
- @"DEFAULT",
- @"DEFINER",
- @"DELAYED",
- @"DELAY_KEY_WRITE",
- @"DELETE",
- @"DELIMITER ",
- @"DELIMITER ;\n",
- @"DELIMITER ;;\n",
- @"DESC",
- @"DESCRIBE",
- @"DES_KEY_FILE",
- @"DETERMINISTIC",
- @"DIRECTORY",
- @"DISABLE",
- @"DISCARD",
- @"DISK",
- @"DISTINCT",
- @"DISTINCTROW",
- @"DIV",
- @"DO",
- @"DOUBLE",
- @"DROP",
- @"DROP DATABASE",
- @"DROP EVENT",
- @"DROP FOREIGN KEY",
- @"DROP FUNCTION",
- @"DROP INDEX",
- @"DROP LOGFILE GROUP",
- @"DROP PREPARE",
- @"DROP PRIMARY KEY",
- @"DROP PREPARE",
- @"DROP PROCEDURE",
- @"DROP SCHEMA",
- @"DROP SERVER",
- @"DROP TABLE",
- @"DROP TABLESPACE",
- @"DROP TRIGGER",
- @"DROP USER",
- @"DROP VIEW",
- @"DUAL",
- @"DUMPFILE",
- @"DUPLICATE",
- @"DYNAMIC",
- @"EACH",
- @"ELSE",
- @"ELSEIF",
- @"ENABLE",
- @"ENCLOSED",
- @"END",
- @"ENDS",
- @"ENGINE",
- @"ENGINES",
- @"ENUM",
- @"ERRORS",
- @"ESCAPE",
- @"ESCAPED",
- @"EVENT",
- @"EVENTS",
- @"EVERY",
- @"EXECUTE",
- @"EXISTS",
- @"EXIT",
- @"EXPANSION",
- @"EXPLAIN",
- @"EXTENDED",
- @"EXTENT_SIZE",
- @"FALSE",
- @"FAST",
- @"FETCH",
- @"FIELDS",
- @"FIELDS TERMINATED BY",
- @"FILE",
- @"FIRST",
- @"FIXED",
- @"FLOAT",
- @"FLOAT4",
- @"FLOAT8",
- @"FLUSH",
- @"FOR",
- @"FOR UPDATE",
- @"FORCE",
- @"FOREIGN",
- @"FOREIGN KEY",
- @"FOUND",
- @"FRAC_SECOND",
- @"FROM",
- @"FULL",
- @"FULLTEXT",
- @"FUNCTION",
- @"GEOMETRY",
- @"GEOMETRYCOLLECTION",
- @"GET_FORMAT",
- @"GLOBAL",
- @"GRANT",
- @"GRANTS",
- @"GROUP",
- @"GROUP BY",
- @"HANDLER",
- @"HASH",
- @"HAVING",
- @"HELP",
- @"HIGH_PRIORITY",
- @"HOSTS",
- @"HOUR",
- @"HOUR_MICROSECOND",
- @"HOUR_MINUTE",
- @"HOUR_SECOND",
- @"IDENTIFIED",
- @"IF",
- @"IGNORE",
- @"IMPORT",
- @"IN",
- @"INDEX",
- @"INDEXES",
- @"INFILE",
- @"INITIAL_SIZE",
- @"INNER",
- @"INNOBASE",
- @"INNODB",
- @"INOUT",
- @"INSENSITIVE",
- @"INSERT",
- @"INSERT_METHOD",
- @"INSTALL",
- @"INSTALL PLUGIN",
- @"INT",
- @"INT1",
- @"INT2",
- @"INT3",
- @"INT4",
- @"INT8",
- @"INTEGER",
- @"INTERVAL",
- @"INTO",
- @"INTO DUMPFILE",
- @"INTO OUTFILE",
- @"INTO TABLE",
- @"INVOKER",
- @"IO_THREAD",
- @"IS",
- @"ISOLATION",
- @"ISSUER",
- @"ITERATE",
- @"JOIN",
- @"KEY",
- @"KEYS",
- @"KEY_BLOCK_SIZE",
- @"KILL",
- @"LANGUAGE",
- @"LAST",
- @"LEADING",
- @"LEAVE",
- @"LEAVES",
- @"LEFT",
- @"LESS",
- @"LEVEL",
- @"LIKE",
- @"LIMIT",
- @"LINEAR",
- @"LINES",
- @"LINES TERMINATED BY",
- @"LINESTRING",
- @"LIST",
- @"LOAD DATA",
- @"LOAD INDEX INTO CACHE",
- @"LOAD XML",
- @"LOCAL",
- @"LOCALTIME",
- @"LOCALTIMESTAMP",
- @"LOCK",
- @"LOCK IN SHARE MODE",
- @"LOCK TABLES",
- @"LOCKS",
- @"LOGFILE",
- @"LOGS",
- @"LONG",
- @"LONGBLOB",
- @"LONGTEXT",
- @"LOOP",
- @"LOW_PRIORITY",
- @"MASTER",
- @"MASTER_CONNECT_RETRY",
- @"MASTER_HOST",
- @"MASTER_LOG_FILE",
- @"MASTER_LOG_POS",
- @"MASTER_PASSWORD",
- @"MASTER_PORT",
- @"MASTER_SERVER_ID",
- @"MASTER_SSL",
- @"MASTER_SSL_CA",
- @"MASTER_SSL_CAPATH",
- @"MASTER_SSL_CERT",
- @"MASTER_SSL_CIPHER",
- @"MASTER_SSL_KEY",
- @"MASTER_USER",
- @"MATCH",
- @"MAXVALUE",
- @"MAX_CONNECTIONS_PER_HOUR",
- @"MAX_QUERIES_PER_HOUR",
- @"MAX_ROWS",
- @"MAX_SIZE",
- @"MAX_UPDATES_PER_HOUR",
- @"MAX_USER_CONNECTIONS",
- @"MEDIUM",
- @"MEDIUMBLOB",
- @"MEDIUMINT",
- @"MEDIUMTEXT",
- @"MEMORY",
- @"MERGE",
- @"MICROSECOND",
- @"MIDDLEINT",
- @"MIGRATE",
- @"MINUTE",
- @"MINUTE_MICROSECOND",
- @"MINUTE_SECOND",
- @"MIN_ROWS",
- @"MOD",
- @"MODE",
- @"MODIFIES",
- @"MODIFY",
- @"MONTH",
- @"MULTILINESTRING",
- @"MULTIPOINT",
- @"MULTIPOLYGON",
- @"MUTEX",
- @"NAME",
- @"NAMES",
- @"NATIONAL",
- @"NATURAL",
- @"NCHAR",
- @"NDB",
- @"NDBCLUSTER",
- @"NEW",
- @"NEXT",
- @"NO",
- @"NODEGROUP",
- @"NONE",
- @"NOT",
- @"NO_WAIT",
- @"NO_WRITE_TO_BINLOG",
- @"NULL",
- @"NUMERIC",
- @"NVARCHAR",
- @"OFFSET",
- @"OLD_PASSWORD",
- @"ON",
- @"ONE",
- @"ONE_SHOT",
- @"OPEN",
- @"OPTIMIZE",
- @"OPTIMIZE TABLE",
- @"OPTION",
- @"OPTIONALLY",
- @"OPTIONALLY ENCLOSED BY",
- @"OPTIONS",
- @"OR",
- @"ORDER",
- @"ORDER BY",
- @"OUT",
- @"OUTER",
- @"OUTFILE",
- @"PACK_KEYS",
- @"PARSER",
- @"PARTIAL",
- @"PARTITION",
- @"PARTITIONING",
- @"PARTITIONS",
- @"PASSWORD",
- @"PHASE",
- @"PLUGIN",
- @"PLUGINS",
- @"POINT",
- @"POLYGON",
- @"PRECISION",
- @"PREPARE",
- @"PRESERVE",
- @"PREV",
- @"PRIMARY",
- @"PRIMARY KEY",
- @"PRIVILEGES",
- @"PROCEDURE",
- @"PROCEDURE ANALYSE",
- @"PROCESS",
- @"PROCESSLIST",
- @"PURGE",
- @"QUARTER",
- @"QUERY",
- @"QUICK",
- @"RANGE",
- @"READ",
- @"READS",
- @"READ_ONLY",
- @"READ_WRITE",
- @"REAL",
- @"REBUILD",
- @"RECOVER",
- @"REDOFILE",
- @"REDO_BUFFER_SIZE",
- @"REDUNDANT",
- @"REFERENCES",
- @"REGEXP",
- @"RELAY_LOG_FILE",
- @"RELAY_LOG_POS",
- @"RELAY_THREAD",
- @"RELEASE",
- @"RELOAD",
- @"REMOVE",
- @"RENAME",
- @"RENAME DATABASE",
- @"RENAME TABLE",
- @"REORGANIZE",
- @"REPAIR",
- @"REPAIR TABLE",
- @"REPEAT",
- @"REPEATABLE",
- @"REPLACE",
- @"REPLICATION",
- @"REQUIRE",
- @"RESET",
- @"RESET MASTER",
- @"RESTORE",
- @"RESTORE TABLE",
- @"RESTRICT",
- @"RESUME",
- @"RETURN",
- @"RETURNS",
- @"REVOKE",
- @"RIGHT",
- @"RLIKE",
- @"ROLLBACK",
- @"ROLLUP",
- @"ROUTINE",
- @"ROW",
- @"ROWS",
- @"ROWS IDENTIFIED BY"
- @"ROW_FORMAT",
- @"RTREE",
- @"SAVEPOINT",
- @"SCHEDULE",
- @"SCHEDULER",
- @"SCHEMA",
- @"SCHEMAS",
- @"SECOND",
- @"SECOND_MICROSECOND",
- @"SECURITY",
- @"SELECT",
- @"SELECT DISTINCT",
- @"SENSITIVE",
- @"SEPARATOR",
- @"SERIAL",
- @"SERIALIZABLE",
- @"SESSION",
- @"SET",
- @"SET GLOBAL",
- @"SET NAMES",
- @"SET PASSWORD",
- @"SHARE",
- @"SHOW",
- @"SHOW BINARY LOGS",
- @"SHOW BINLOG EVENTS",
- @"SHOW CHARACTER SET",
- @"SHOW COLLATION",
- @"SHOW COLUMNS",
- @"SHOW CONTRIBUTORS",
- @"SHOW CREATE DATABASE",
- @"SHOW CREATE EVENT",
- @"SHOW CREATE FUNCTION",
- @"SHOW CREATE PROCEDURE",
- @"SHOW CREATE SCHEMA",
- @"SHOW CREATE TABLE",
- @"SHOW CREATE TRIGGERS",
- @"SHOW CREATE VIEW",
- @"SHOW DATABASES",
- @"SHOW ENGINE",
- @"SHOW ENGINES",
- @"SHOW ERRORS",
- @"SHOW EVENTS",
- @"SHOW FIELDS",
- @"SHOW FULL PROCESSLIST",
- @"SHOW FUNCTION CODE",
- @"SHOW FUNCTION STATUS",
- @"SHOW GRANTS",
- @"SHOW INDEX",
- @"SHOW INNODB STATUS",
- @"SHOW KEYS",
- @"SHOW MASTER LOGS",
- @"SHOW MASTER STATUS",
- @"SHOW OPEN TABLES",
- @"SHOW PLUGINS",
- @"SHOW PRIVILEGES",
- @"SHOW PROCEDURE CODE",
- @"SHOW PROCEDURE STATUS",
- @"SHOW PROFILE",
- @"SHOW PROFILES",
- @"SHOW PROCESSLIST",
- @"SHOW SCHEDULER STATUS",
- @"SHOW SCHEMAS",
- @"SHOW SLAVE HOSTS",
- @"SHOW SLAVE STATUS",
- @"SHOW STATUS",
- @"SHOW STORAGE ENGINES",
- @"SHOW TABLE STATUS",
- @"SHOW TABLE TYPES",
- @"SHOW TABLES",
- @"SHOW TRIGGERS",
- @"SHOW VARIABLES",
- @"SHOW WARNINGS",
- @"SHUTDOWN",
- @"SIGNED",
- @"SIMPLE",
- @"SLAVE",
- @"SMALLINT",
- @"SNAPSHOT",
- @"SOME",
- @"SONAME",
- @"SOUNDS",
- @"SPATIAL",
- @"SPECIFIC",
- @"SQL_AUTO_IS_NULL",
- @"SQL_BIG_RESULT",
- @"SQL_BIG_SELECTS",
- @"SQL_BIG_TABLES",
- @"SQL_BUFFER_RESULT",
- @"SQL_CACHE",
- @"SQL_CALC_FOUND_ROWS",
- @"SQL_LOG_BIN",
- @"SQL_LOG_OFF",
- @"SQL_LOG_UPDATE",
- @"SQL_LOW_PRIORITY_UPDATES",
- @"SQL_MAX_JOIN_SIZE",
- @"SQL_NO_CACHE",
- @"SQL_QUOTE_SHOW_CREATE",
- @"SQL_SAFE_UPDATES",
- @"SQL_SELECT_LIMIT",
- @"SQL_SLAVE_SKIP_COUNTER",
- @"SQL_SMALL_RESULT",
- @"SQL_THREAD",
- @"SQL_TSI_DAY",
- @"SQL_TSI_FRAC_SECOND",
- @"SQL_TSI_HOUR",
- @"SQL_TSI_MINUTE",
- @"SQL_TSI_MONTH",
- @"SQL_TSI_QUARTER",
- @"SQL_TSI_SECOND",
- @"SQL_TSI_WEEK",
- @"SQL_TSI_YEAR",
- @"SQL_WARNINGS",
- @"SSL",
- @"START",
- @"START TRANSACTION",
- @"STARTING",
- @"STARTS",
- @"STATUS",
- @"STOP",
- @"STORAGE",
- @"STRAIGHT_JOIN",
- @"STRING",
- @"SUBJECT",
- @"SUBPARTITION",
- @"SUBPARTITIONS",
- @"SUPER",
- @"SUSPEND",
- @"TABLE",
- @"TABLES",
- @"TABLESPACE",
- @"TEMPORARY",
- @"TEMPTABLE",
- @"TERMINATED",
- @"TEXT",
- @"THAN",
- @"THEN",
- @"TIME",
- @"TIMESTAMP",
- @"TIMESTAMPADD",
- @"TIMESTAMPDIFF",
- @"TINYBLOB",
- @"TINYINT",
- @"TINYTEXT",
- @"TO",
- @"TRAILING",
- @"TRANSACTION",
- @"TRIGGER",
- @"TRIGGERS",
- @"TRUE",
- @"TRUNCATE",
- @"TYPE",
- @"TYPES",
- @"UNCOMMITTED",
- @"UNDEFINED",
- @"UNDO",
- @"UNDOFILE",
- @"UNDO_BUFFER_SIZE",
- @"UNICODE",
- @"UNINSTALL",
- @"UNINSTALL PLUGIN",
- @"UNION",
- @"UNIQUE",
- @"UNKNOWN",
- @"UNLOCK",
- @"UNLOCK TABLES",
- @"UNSIGNED",
- @"UNTIL",
- @"UPDATE",
- @"UPGRADE",
- @"USAGE",
- @"USE",
- @"USER",
- @"USER_RESOURCES",
- @"USE_FRM",
- @"USING",
- @"UTC_DATE",
- @"UTC_TIME",
- @"UTC_TIMESTAMP",
- @"VALUE",
- @"VALUES",
- @"VARBINARY",
- @"VARCHAR",
- @"VARCHARACTER",
- @"VARIABLES",
- @"VARYING",
- @"VIEW",
- @"WAIT",
- @"WARNINGS",
- @"WEEK",
- @"WHEN",
- @"WHERE",
- @"WHILE",
- @"WITH",
- @"WITH CONSISTENT SNAPSHOT",
- @"WORK",
- @"WRITE",
- @"X509",
- @"XA",
- @"XOR",
- @"YEAR",
- @"YEAR_MONTH",
- @"ZEROFILL",
-
- nil];
-}
-
-/*
- * List of fucntions for autocompletion. If you add a keyword here,
- * it should also be added to the flex file SPEditorTokens.l
- */
--(NSArray *)functions
-{
- return [NSArray arrayWithObjects:
- @"ABS",
- @"ACOS",
- @"ADDDATE",
- @"ADDTIME",
- @"AES_DECRYPT",
- @"AES_ENCRYPT",
- @"AREA",
- @"ASBINARY",
- @"ASCII",
- @"ASIN",
- @"ASTEXT",
- @"ATAN",
- @"ATAN2",
- @"AVG",
- @"BDMPOLYFROMTEXT",
- @"BDMPOLYFROMWKB",
- @"BDPOLYFROMTEXT",
- @"BDPOLYFROMWKB",
- @"BENCHMARK",
- @"BIN",
- @"BIT_AND",
- @"BIT_COUNT",
- @"BIT_LENGTH",
- @"BIT_OR",
- @"BIT_XOR",
- @"BOUNDARY",
- @"BUFFER",
- @"CAST",
- @"CEIL",
- @"CEILING",
- @"CENTROID",
- @"CHAR",
- @"CHARACTER_LENGTH",
- @"CHARSET",
- @"CHAR_LENGTH",
- @"COALESCE",
- @"COERCIBILITY",
- @"COLLATION",
- @"COMPRESS",
- @"CONCAT",
- @"CONCAT_WS",
- @"CONNECTION_ID",
- @"CONTAINS",
- @"CONV",
- @"CONVERT",
- @"CONVERT_TZ",
- @"CONVEXHULL",
- @"COS",
- @"COT",
- @"COUNT",
- @"COUNT(*)",
- @"CRC32",
- @"CROSSES",
- @"CURDATE",
- @"CURRENT_DATE",
- @"CURRENT_TIME",
- @"CURRENT_TIMESTAMP",
- @"CURRENT_USER",
- @"CURTIME",
- @"DATABASE",
- @"DATE",
- @"DATEDIFF",
- @"DATE_ADD",
- @"DATE_DIFF",
- @"DATE_FORMAT",
- @"DATE_SUB",
- @"DAY",
- @"DAYNAME",
- @"DAYOFMONTH",
- @"DAYOFWEEK",
- @"DAYOFYEAR",
- @"DECODE",
- @"DEFAULT",
- @"DEGREES",
- @"DES_DECRYPT",
- @"DES_ENCRYPT",
- @"DIFFERENCE",
- @"DIMENSION",
- @"DISJOINT",
- @"DISTANCE",
- @"ELT",
- @"ENCODE",
- @"ENCRYPT",
- @"ENDPOINT",
- @"ENVELOPE",
- @"EQUALS",
- @"EXP",
- @"EXPORT_SET",
- @"EXTERIORRING",
- @"EXTRACT",
- @"EXTRACTVALUE",
- @"FIELD",
- @"FIND_IN_SET",
- @"FLOOR",
- @"FORMAT",
- @"FOUND_ROWS",
- @"FROM_DAYS",
- @"FROM_UNIXTIME",
- @"GEOMCOLLFROMTEXT",
- @"GEOMCOLLFROMWKB",
- @"GEOMETRYCOLLECTION",
- @"GEOMETRYCOLLECTIONFROMTEXT",
- @"GEOMETRYCOLLECTIONFROMWKB",
- @"GEOMETRYFROMTEXT",
- @"GEOMETRYFROMWKB",
- @"GEOMETRYN",
- @"GEOMETRYTYPE",
- @"GEOMFROMTEXT",
- @"GEOMFROMWKB",
- @"GET_FORMAT",
- @"GET_LOCK",
- @"GLENGTH",
- @"GREATEST",
- @"GROUP_CONCAT",
- @"GROUP_UNIQUE_USERS",
- @"HEX",
- @"HOUR",
- @"IF",
- @"IFNULL",
- @"INET_ATON",
- @"INET_NTOA",
- @"INSERT",
- @"INSERT_ID",
- @"INSTR",
- @"INTERIORRINGN",
- @"INTERSECTION",
- @"INTERSECTS",
- @"INTERVAL",
- @"ISCLOSED",
- @"ISEMPTY",
- @"ISNULL",
- @"ISRING",
- @"ISSIMPLE",
- @"IS_FREE_LOCK",
- @"IS_USED_LOCK",
- @"LAST_DAY",
- @"LAST_INSERT_ID",
- @"LCASE",
- @"LEAST",
- @"LEFT",
- @"LENGTH",
- @"LINEFROMTEXT",
- @"LINEFROMWKB",
- @"LINESTRING",
- @"LINESTRINGFROMTEXT",
- @"LINESTRINGFROMWKB",
- @"LN",
- @"LOAD_FILE",
- @"LOCALTIME",
- @"LOCALTIMESTAMP",
- @"LOCATE",
- @"LOG",
- @"LOG10",
- @"LOG2",
- @"LOWER",
- @"LPAD",
- @"LTRIM",
- @"MAKEDATE",
- @"MAKETIME",
- @"MAKE_SET",
- @"MASTER_POS_WAIT",
- @"MAX",
- @"MBRCONTAINS",
- @"MBRDISJOINT",
- @"MBREQUAL",
- @"MBRINTERSECTS",
- @"MBROVERLAPS",
- @"MBRTOUCHES",
- @"MBRWITHIN",
- @"MD5",
- @"MICROSECOND",
- @"MID",
- @"MIN",
- @"MINUTE",
- @"MLINEFROMTEXT",
- @"MLINEFROMWKB",
- @"MOD",
- @"MONTH",
- @"MONTHNAME",
- @"NOW",
- @"MPOINTFROMTEXT",
- @"MPOINTFROMWKB",
- @"MPOLYFROMTEXT",
- @"MPOLYFROMWKB",
- @"MULTILINESTRING",
- @"MULTILINESTRINGFROMTEXT",
- @"MULTILINESTRINGFROMWKB",
- @"MULTIPOINT",
- @"MULTIPOINTFROMTEXT",
- @"MULTIPOINTFROMWKB",
- @"MULTIPOLYGON",
- @"MULTIPOLYGONFROMTEXT",
- @"MULTIPOLYGONFROMWKB",
- @"NAME_CONST",
- @"NOW",
- @"NULLIF",
- @"NUMGEOMETRIES",
- @"NUMINTERIORRINGS",
- @"NUMPOINTS",
- @"OCT",
- @"OCTET_LENGTH",
- @"OLD_PASSWORD",
- @"ORD",
- @"OVERLAPS",
- @"PASSWORD",
- @"PERIOD_ADD",
- @"PERIOD_DIFF",
- @"PI",
- @"POINT",
- @"POINTFROMTEXT",
- @"POINTFROMWKB",
- @"POINTN",
- @"POINTONSURFACE",
- @"POLYFROMTEXT",
- @"POLYFROMWKB",
- @"POLYGON",
- @"POLYGONFROMTEXT",
- @"POLYGONFROMWKB",
- @"POSITION",
- @"POW",
- @"POWER",
- @"QUARTER",
- @"QUOTE",
- @"RADIANS",
- @"RAND",
- @"RELATED",
- @"RELEASE_LOCK",
- @"REPEAT",
- @"REPLACE",
- @"REVERSE",
- @"RIGHT",
- @"ROUND",
- @"ROW_COUNT",
- @"RPAD",
- @"RTRIM",
- @"SCHEMA",
- @"SECOND",
- @"SEC_TO_TIME",
- @"SESSION_USER",
- @"SHA",
- @"SHA1",
- @"SIGN",
- @"SIN",
- @"SLEEP",
- @"SOUNDEX",
- @"SPACE",
- @"SQRT",
- @"SRID",
- @"STARTPOINT",
- @"STD",
- @"STDDEV",
- @"STDDEV_POP",
- @"STDDEV_SAMP",
- @"STRCMP",
- @"STR_TO_DATE",
- @"SUBDATE",
- @"SUBSTR",
- @"SUBSTRING",
- @"SUBSTRING_INDEX",
- @"SUBTIME",
- @"SUM",
- @"SYMDIFFERENCE",
- @"SYSDATE",
- @"SYSTEM_USER",
- @"TAN",
- @"TIME",
- @"TIMEDIFF",
- @"TIMESTAMP",
- @"TIMESTAMPADD",
- @"TIMESTAMPDIFF",
- @"TIME_FORMAT",
- @"TIME_TO_SEC",
- @"TOUCHES",
- @"TO_DAYS",
- @"TRIM",
- @"TRUNCATE",
- @"UCASE",
- @"UNCOMPRESS",
- @"UNCOMPRESSED_LENGTH",
- @"UNHEX",
- @"UNIQUE_USERS",
- @"UNIX_TIMESTAMP",
- @"UPDATEXML",
- @"UPPER",
- @"USER",
- @"UTC_DATE",
- @"UTC_TIME",
- @"UTC_TIMESTAMP",
- @"UUID",
- @"VARIANCE",
- @"VAR_POP",
- @"VAR_SAMP",
- @"VERSION",
- @"WEEK",
- @"WEEKDAY",
- @"WEEKOFYEAR",
- @"WITHIN",
- @"YEAR",
- @"YEARWEEK",
-
- nil];
-}
-
-
-/*
* Set whether this text view should apply the indentation on the current line to new lines.
*/
- (void)setAutoindent:(BOOL)enableAutoindent
@@ -3410,6 +2460,12 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Make sure that the notification is from the correct textStorage object
if (textStore!=[self textStorage]) return;
+ // Cancel autocompletion trigger
+ if([prefs boolForKey:SPCustomQueryAutoComplete])
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(doAutoCompletion)
+ object:nil];
+
NSInteger editedMask = [textStore editedMask];
// Start autohelp only if the user really changed the text (not e.g. for setting a background color)
@@ -3417,14 +2473,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[[prefs valueForKey:SPCustomQueryAutoHelpDelay] retain] doubleValue]];
}
- // Cancel autocompletion trigger
- if([prefs boolForKey:SPCustomQueryAutoComplete])
- [NSObject cancelPreviousPerformRequestsWithTarget:self
- selector:@selector(doAutoCompletion)
- object:nil];
-
// Start autocompletion if enabled
- if([prefs boolForKey:SPCustomQueryAutoComplete] && !completionIsOpen && editedMask != 1)
+ if([[NSApp keyWindow] firstResponder] == self && [prefs boolForKey:SPCustomQueryAutoComplete] && !completionIsOpen && editedMask != 1)
[self performSelector:@selector(doAutoCompletion) withObject:nil afterDelay:[[[prefs valueForKey:SPCustomQueryAutoCompleteDelay] retain] doubleValue]];
// Cancel calling doSyntaxHighlighting for large text
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 83ce6996..c21f6d24 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -137,6 +137,7 @@ extern NSString *SPCustomQueryHighlightCurrentQuery;
extern NSString *SPCustomQueryEditorTabStopWidth;
extern NSString *SPCustomQueryAutoComplete;
extern NSString *SPCustomQueryAutoCompleteDelay;
+extern NSString *SPCustomQueryFunctionCompletionInsertsArguments;
// AutoUpdate Prefpane
extern NSString *SPLastUsedVersion;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index aa2c3508..2a8822e0 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -105,6 +105,7 @@ NSString *SPCustomQueryHighlightCurrentQuery = @"CustomQueryHighlightCurrent
NSString *SPCustomQueryEditorTabStopWidth = @"CustomQueryEditorTabStopWidth";
NSString *SPCustomQueryAutoComplete = @"CustomQueryAutoComplete";
NSString *SPCustomQueryAutoCompleteDelay = @"CustomQueryAutoCompleteDelay";
+NSString *SPCustomQueryFunctionCompletionInsertsArguments = @"CustomQueryFunctionCompletionInsertsArguments";
// AutoUpdate Prefpane
NSString *SPLastUsedVersion = @"LastUsedVersion";
diff --git a/Source/SPNarrowDownCompletion.h b/Source/SPNarrowDownCompletion.h
index 6901ffa1..743f7cc5 100644
--- a/Source/SPNarrowDownCompletion.h
+++ b/Source/SPNarrowDownCompletion.h
@@ -62,6 +62,9 @@
NSInteger spaceCounter;
NSMutableCharacterSet* textualInputCharacters;
+
+ NSUserDefaults *prefs;
+
}
- (id)initWithItems:(NSArray*)someSuggestions alreadyTyped:(NSString*)aUserString staticPrefix:(NSString*)aStaticPrefix
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index 3df3d7b6..10d4c1f7 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -33,6 +33,7 @@
#import "SPStringAdditions.h"
#import "ImageAndTextCell.h"
#import "SPConstants.h"
+#import "SPQueryController.h"
#import "RegexKitLite.h"
#import "CMTextView.h"
#include <tgmath.h>
@@ -112,6 +113,8 @@
filtered = nil;
spaceCounter = 0;
+ prefs = [NSUserDefaults standardUserDefaults];
+
tableFont = [NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] dataForKey:SPCustomQueryEditorFont]];
[self setupInterface];
}
@@ -451,11 +454,15 @@
closeMe = YES;
return;
} else {
+ if([theView completionWasReinvokedAutomatically]) return;
if([[self filterString] hasSuffix:@"."]) {
+ [theView setCompletionWasReinvokedAutomatically:YES];
[theView doCompletionByUsingSpellChecker:dictMode fuzzyMode:fuzzyMode autoCompleteMode:NO];
closeMe = YES;
+ return;
+ } else {
+ [newFiltered addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"No completions found", @"no completions found message"), @"display", @"", @"noCompletion", nil]];
}
- [newFiltered addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"No completions found", @"no completions found message"), @"display", @"", @"noCompletion", nil]];
}
}
@@ -656,15 +663,15 @@
[commonPrefix setString:tempPrefix];
}
- // if(![commonPrefix length]) return;
-
- NSString* toInsert = [commonPrefix substringFromIndex:[[self filterString] length]];
- [mutablePrefix appendString:toInsert];
- theCharRange.length += [toInsert length];
- theParseRange.length += [toInsert length];
- [theView insertText:[toInsert lowercaseString]];
- [self checkSpaceForAllowedCharacter];
-
+ // Insert common prefix automatically
+ if([[self filterString] length] < [commonPrefix length]) {
+ NSString* toInsert = [commonPrefix substringFromIndex:[[self filterString] length]];
+ [mutablePrefix appendString:toInsert];
+ theCharRange.length += [toInsert length];
+ theParseRange.length += [toInsert length];
+ [theView insertText:[toInsert lowercaseString]];
+ [self checkSpaceForAllowedCharacter];
+ }
}
- (void)insert_text:(NSString* )aString
@@ -675,11 +682,12 @@
// If completion string contains backticks move caret out of the backticks
if(backtickMode && !triggerMode)
[theView performSelector:@selector(moveRight:)];
- // If it's a function insert () snippet
- else if([[[filtered objectAtIndex:[theTableView selectedRow]] objectForKey:@"image"] hasPrefix:@"func"] && ![aString hasSuffix:@")"]) {
- [theView insertText:@"()"];
- [theView performSelector:@selector(moveLeft:)];
- // [theView insertAsSnippet:@"(${1:})" atRange:[theView selectedRange]];
+ // If it's a function insert () and if given arguments as snippets
+ else if([prefs boolForKey:SPCustomQueryFunctionCompletionInsertsArguments] && [[[filtered objectAtIndex:[theTableView selectedRow]] objectForKey:@"image"] hasPrefix:@"func"] && ![aString hasSuffix:@")"]) {
+ NSString *functionArgumentSnippet = [NSString stringWithFormat:@"(%@)", [[SPQueryController sharedQueryController] argumentSnippetForFunction:aString]];
+ [theView insertAsSnippet:functionArgumentSnippet atRange:[theView selectedRange]];
+ if([functionArgumentSnippet length] == 2)
+ [theView performSelector:@selector(moveLeft:)];
}
}
diff --git a/Source/SPQueryController.h b/Source/SPQueryController.h
index a1948b4b..797d5b6b 100644
--- a/Source/SPQueryController.h
+++ b/Source/SPQueryController.h
@@ -51,6 +51,10 @@
NSMutableDictionary *contentFilterContainer;
NSUInteger numberOfMaxAllowedHistory;
+ NSArray *completionKeywordList;
+ NSArray *completionFunctionList;
+ NSDictionary *functionArgumentSnippets;
+
NSUserDefaults *prefs;
NSDateFormatter *dateFormatter;
}
@@ -78,6 +82,11 @@
- (NSUInteger)consoleMessageCount;
+// Completion List Controller
+- (NSArray*)functionList;
+- (NSArray*)keywordList;
+- (NSString*)argumentSnippetForFunction:(NSString*)func;
+
// DocumentsController
- (NSURL *)registerDocumentWithFileURL:(NSURL *)fileURL andContextInfo:(NSMutableDictionary *)contextInfo;
- (void)removeRegisteredDocumentWithFileURL:(NSURL *)fileURL;
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index 911923bd..fec04630 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -103,6 +103,44 @@ static SPQueryController *sharedQueryController = nil;
favoritesContainer = [[NSMutableDictionary alloc] init];
historyContainer = [[NSMutableDictionary alloc] init];
contentFilterContainer = [[NSMutableDictionary alloc] init];
+ completionKeywordList = nil;
+ completionFunctionList = nil;
+ functionArgumentSnippets = nil;
+
+ NSError *readError = nil;
+ NSString *convError = nil;
+ NSPropertyListFormat format;
+ NSDictionary *completionPlist;
+ NSData *completionTokensData = [NSData dataWithContentsOfFile:[NSBundle pathForResource:@"CompletionTokens.plist" ofType:nil inDirectory:[[NSBundle mainBundle] bundlePath]]
+ options:NSMappedRead error:&readError];
+
+
+ completionPlist = [NSDictionary dictionaryWithDictionary:[NSPropertyListSerialization propertyListFromData:completionTokensData
+ mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&convError]];
+
+ if(completionPlist == nil || readError != nil || convError != nil) {
+ NSLog(@"Error while reading “CompletionTokens.plist”:\n%@\n%@", [readError localizedDescription], convError);
+ NSBeep();
+ } else {
+ if([completionPlist objectForKey:@"core_keywords"]) {
+ completionKeywordList = [[NSArray arrayWithArray:[completionPlist objectForKey:@"core_keywords"]] retain];
+ } else {
+ NSLog(@"No “core_keywords” array found.");
+ NSBeep();
+ }
+ if([completionPlist objectForKey:@"core_builtin_functions"]) {
+ completionFunctionList = [[NSArray arrayWithArray:[completionPlist objectForKey:@"core_builtin_functions"]] retain];
+ } else {
+ NSLog(@"No “core_builtin_functions” array found.");
+ NSBeep();
+ }
+ if([completionPlist objectForKey:@"function_argument_snippets"]) {
+ functionArgumentSnippets = [[NSDictionary dictionaryWithDictionary:[completionPlist objectForKey:@"function_argument_snippets"]] retain];
+ } else {
+ NSLog(@"No “function_argument_snippets” dictionary found.");
+ NSBeep();
+ }
+ }
}
@@ -463,6 +501,30 @@ static SPQueryController *sharedQueryController = nil;
}
#pragma mark -
+#pragma mark Completion List Controller
+
+- (NSArray*)functionList
+{
+ if(completionFunctionList != nil && [completionFunctionList count])
+ return completionFunctionList;
+ return [NSArray array];
+}
+
+- (NSArray*)keywordList
+{
+ if(completionKeywordList != nil && [completionKeywordList count])
+ return completionKeywordList;
+ return [NSArray array];
+}
+
+- (NSString*)argumentSnippetForFunction:(NSString*)func
+{
+ if(functionArgumentSnippets && [functionArgumentSnippets objectForKey:[func uppercaseString]])
+ return [functionArgumentSnippets objectForKey:[func uppercaseString]];
+ return @"";
+}
+
+#pragma mark -
#pragma mark DocumentsController
- (NSURL *)registerDocumentWithFileURL:(NSURL *)fileURL andContextInfo:(NSMutableDictionary *)contextInfo
@@ -735,7 +797,10 @@ static SPQueryController *sharedQueryController = nil;
[favoritesContainer release], favoritesContainer = nil;
[historyContainer release], historyContainer = nil;
[contentFilterContainer release], contentFilterContainer = nil;
-
+
+ if(completionKeywordList) [completionKeywordList release];
+ if(completionFunctionList) [completionFunctionList release];
+ if(functionArgumentSnippets) [functionArgumentSnippets release];
[super dealloc];
}
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index 6c517bf3..5486bf5d 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -237,6 +237,7 @@
BC675A17107203BA00C5ACD4 /* ContentFilterManager.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC675A15107203BA00C5ACD4 /* ContentFilterManager.xib */; };
BC8B0DAF104004F900FC02EC /* EncodingPopupView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC8B0DAD104004F900FC02EC /* EncodingPopupView.xib */; };
BC8C8532100E0A8000D7A129 /* SPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8C8531100E0A8000D7A129 /* SPTableView.m */; };
+ BC962D661144EACA006170BD /* CompletionTokens.plist in Resources */ = {isa = PBXBuildFile; fileRef = BC962D651144EACA006170BD /* CompletionTokens.plist */; };
BC9F0881100FCF2C00A80D32 /* SPFieldEditorController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9F0880100FCF2C00A80D32 /* SPFieldEditorController.m */; };
BCA6271C1031B9D40047E5D5 /* SPTooltip.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA6271B1031B9D40047E5D5 /* SPTooltip.m */; };
BCA6F631100FA7D700E80253 /* FieldEditorSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCA6F62F100FA7D700E80253 /* FieldEditorSheet.xib */; };
@@ -644,6 +645,7 @@
BC8B0DAE104004F900FC02EC /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/EncodingPopupView.xib; sourceTree = "<group>"; };
BC8C8530100E0A8000D7A129 /* SPTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTableView.h; sourceTree = "<group>"; };
BC8C8531100E0A8000D7A129 /* SPTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableView.m; sourceTree = "<group>"; };
+ BC962D651144EACA006170BD /* CompletionTokens.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = CompletionTokens.plist; sourceTree = "<group>"; };
BC9F087F100FCF2C00A80D32 /* SPFieldEditorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPFieldEditorController.h; sourceTree = "<group>"; };
BC9F0880100FCF2C00A80D32 /* SPFieldEditorController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPFieldEditorController.m; sourceTree = "<group>"; };
BCA6271A1031B9D40047E5D5 /* SPTooltip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTooltip.h; sourceTree = "<group>"; };
@@ -922,6 +924,7 @@
17B7B58B1016022C00F057DE /* MCPKit-Info.plist */,
BCB56196106F893F00167321 /* ContentFilters.plist */,
BCB5619A106F8A1B00167321 /* EditorQuickLookTypes.plist */,
+ BC962D651144EACA006170BD /* CompletionTokens.plist */,
);
name = Plists;
sourceTree = "<group>";
@@ -1667,6 +1670,7 @@
58C4593910D0674E00E6E13E /* sqlicon.icns in Resources */,
BC5AD7FF10FB262F008769E3 /* field-small-square.tiff in Resources */,
BC30C011111C98BD002701C9 /* DataMigrationDialog.xib in Resources */,
+ BC962D661144EACA006170BD /* CompletionTokens.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};