ApexSQL Database Power Tools for VS Code version 2020 R6 comes with an exciting new productivity feature that will speed up the development process by inserting MySQL and MariaDB keywords, database, schema, object, parameter, and variable names from a hint-list of suggestions as you type queries.
In a database world, this is known as IntelliSense, a general term used for a diversity of code editing utilities including code completion. This post is a short introduction to this feature of the VS Code extension and if you want to find out more about it, continue to read below.
Configure code completion
Most ApexSQL Database Power Tools for VS Code options are on by default. The same goes for code completion.
To access any of these settings, click on the Manage icon in the lower-left corner of Visual Studio Code, and choose Settings (Crtl+,). Expand Extensions, and then click ApexSQL Database Power Tools for VS Code:
Notice the Enable auto-complete hint-list in query editor option is checked. You can trigger code completion in any ApexSQL editor by simply start typing or using a trigger character such as space or dot. This behavior is controlled by the Show hint-list when space or dot key is typed option, also enabled by default.
In a query editor, a browsable visual hints-list is shown while typing query as shown below:
This feature is inherited from the very popular ApexSQL Complete add-in for SQL Server Management Studio and Visual Studio from the SQL Server world. Since this is the initial version of the feature, it’s not nearly as powerful as his big brother but this is only the first step. The future versions of the VS Code extension will follow the steps of his big brother and more utilities and options will be available in the extension soon.
Back to configuration, another option for controlling code completion is keyword capitalization. This option enforces the selected capitalization rule for keywords inserter by auto-complete. By default, the Upper option is selected. The other two options are Proper and Lower:
Depending on the selected keywords formatting, the same formatting style will be displayed in the hint-list of suggestion:
When keywords are inserted in a query editor, individually and in the order already mentioned above, it will look like this:
This initial version of this feature is not context-sensitive. Code completion will list all member lists in the current database. The content of the hint-list is also filtered to only include members containing typed characters. You can call the auto-complete hint-list in any query editor manually by pressing Ctrl + Space or by typing a trigger character mentioned before.
If you prefer or for some reason don’t need help while you type, you can turn off code completion by simply unchecking the Enable auto-complete hint-list in query editor option from settings.
This version of the VS Code extension includes also known bug fixes, usability improvements, and improved quality. Always check official release notes for more details and stay tuned for more.
September 8, 2020