Updated on 2023-04-03 GMT+08:00

Editor

This section provides details on how to personalize syntax coloring, SQL history information, templates, and formatter.

Syntax Coloring

Follow the steps to customize the SQL highlight color:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Syntax Coloring.

    The Syntax Coloring pane is displayed.

  3. Click the color button to customize the color for the type of syntax.

    For example, click to customize the color for Strings. The color picker dialog box is displayed.

    Use the color picker to set the required color for a specific syntax category. You can choose basic colors or define custom colors in the color picker.

    Click Restore Defaults from Syntax Coloring pane to reset to default color scheme.

  4. Click OK. The Restart Data Studio dialog box is displayed.
  5. Click Yes to restart Data Studio. If any export, import or execution operations are in progress, then Data Studio displays the Process is running dialog box.
  6. Click Force Restart to discard operations and restart Data Studio. Click OK to continue performing operations.

    The Preferences.prefs file contains the custom color settings. If the file is corrupted, Data Studio will display the default values.

    The custom color(s) will be set after you restart Data Studio.

SQL History

You can customize Data Studio to set the number of SQL history count that can be made available and also the number of characters for the query for each of the query saved in SQL history.

Follow the steps to customize the number of executed queries and number of characters in the query to be saved in SQL History:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > SQL History.

    The SQL History pane is displayed.

  3. Set the number of queries to be saved in SQL History Count field.

    Minimum value is 1 and maximum is 1000. The current value set for this preference will be displayed.

  4. Set the number of characters to be allowed in each query that is saved in the SQL History in the SQL Query Characters field.

    Minimum value is 1 and maximum is 1000. Enter "0" in this field to set no character limit. The current value set for this preference will be displayed.

  5. Click Apply.
  6. Click OK.

    • Click Restore Defaults from SQL History pane to reset to default value.
    • The default value for SQL History Count is 50 and SQL Query Characters it is 1000.
    • If the input value is less than the original one, data may be lost. In this case, a message is displayed to notify you of the data loss risk and ask you whether to proceed with the operation.
    • If there are unsaved changes and you navigate away from this pane, then a message displays to state that there are unsaved changes.
    • Pinned queries are not affected by the changes made to the SQL History Count field. Example: If the number of pinned queries is 50 and the SQL History Count is set to 25, then SQL History will show 50 pinned queries.
    • The SQL Query Characters changes affects only queries added post the configuration change.

Adding Templates

You can customize Data Studio to create new, edit existing, and remove templates. Refer to the Using Templates section for detailed information on templates.

Restoring the settings to default removes all user defined templates from the list.

Follow the steps below to create templates:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Templates.

    The Templates pane is displayed.

  3. Click New.
  4. Enter a name for the template in the Name field.
  5. Enter description in the Description field.
  6. Enter the SQL statement pattern in the Pattern field.

    The text entered in Pattern field will be syntax highlighted.

  7. Click OK.

Modifying Templates

Follow the steps below to edit templates:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Templates.

    The Templates pane is displayed.

  3. Click Edit.
  4. Edit the name in the Name field, if required.
  5. Edit the description in the Description field, if required.
  6. Edit the SQL statement pattern in the Pattern field, if required.

    The text entered in Pattern field will be syntax highlighted.

  7. Click OK.

Removing Templates

Follow the steps below to remove templates:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Templates.

    The Templates pane is displayed.

  3. Select the template to be removed, and click Remove.

    The template is removed from the Templates list.

    Default templates that are removed can be added back using Restore Removed option. It will restore the template to the last updated change. Restore Removed option is not applicable to user defined templates.

Reverting to Default Templates

Follow the steps below to revert to default templates:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Templates.

    The Templates pane is displayed.

  3. Select at least one default template that is modified to revert to default template settings.
  4. Click Revert to Default.

Formatter

You can customize Data Studio to set the tab width and convert tab to spaces while performing indent and unindent operation. Refer to Indent/Un-indent Lines section to perform indent/unindent operation and replace tab with spaces.

Follow the steps to customize the indent size and convert tab to spaces:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Formatter.

    The Formatter pane is displayed.

  3. Select the Insert Space option to replace tab with spaces or Insert Tab to add/remove tabs while indenting/unindenting lines.
  4. Enter the indent size in Indent Size. Based on the number specified in this field, the indent/unindent/space length is defined.

Transaction

Follow the steps to edit Transaction settings:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Transaction

    The Transaction pane is displayed.

  3. In the Auto Commit window, you can perform the following operations:

    • Select Enable to switch on the auto commit feature. In this case commit and rollback button will be disabled. Transaction will be committed automatically.

    • Select Disable to switch off the auto commit feature. Commit and Rollback button can be used manually for commiting or reverting changes.

    Default behavior for Auto-Commit is ON.

Folding

Follow the steps for Folding:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Folding.

    The Folding pane is displayed.

  3. Select Enable or Disable. By default, Enable is selected.

    • Enable: This indicates enable SQL folding feature. Supported SQL statements can be folded or unfolded.
    • Disable: This indicates disable SQL folding feature.

      Modification in settings reflects in newly opened editor. The editor which is already opened will remain with previous settings until restart.

Font

Follow the steps to set Font:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Font.

    The Font pane is displayed.

  3. Provide required font size within range from 1 to 50. By default, font size is 10.

Auto Suggest

Follow the steps for Auto Suggest:

  1. Choose Settings > Preferences from the main menu.

    The Preferences dialog box is displayed.

  2. Choose Editor > Auto Suggest.

    The Auto Suggest pane is displayed.

  3. In Auto Suggest pane, provide required number of character in Auto Suggest Min Character. Default value is 2. Range of number of Auto Suggest minimum characters are within 2 to 10.

    For auto suggest, sorting can be as follows:

    1. Keywords
    2. Data types
    3. Loaded Database Objects
      • Each group should be in sorted order.
      • Databases are classified by keyword and data type.
      • If database is not connected, then default keywords must be displayed.
      • When you press dot (.) then only respective database objects should be displayed. Keywords/Data types should not be displayed.
      • Auto suggest should be triggered by shortcuts.