A Visual Studio Code extension for uroboroSQL-fmt that is a tool that formats SQL statements according to SQL coding standards created by Future Corporation (Japanese only).
Once installed in Visual Studio Code, "uroborosql-fmt" will be available as a formatter for SQL files. Please select "uroborosql-fmt" (extension id:Future.uroborosql-fmt) as the default formatter. You can do this either by using the context menu (right click on a open SQL file in the editor) and select "Format Document With...", or you can add the following to your settings:
{
  "[sql]": {
    "editor.defaultFormatter": "Future.uroborosql-fmt"
  }
}You can enable format on save for SQL by having the following values in your settings:
{
  "[sql]": {
    "editor.defaultFormatter": "Future.uroborosql-fmt",
    "editor.formatOnSave": true
  }
}| Settings | Defaults | Description | 
|---|---|---|
| uroborosql-fmt.configurationFilePath | null | The path of configuration file. File extension must be .json. If you don't specify the path and./.uroborosqlfmtrc.jsonexists, formatter will use./.uroborosqlfmtrc.json. If you doesn't specify and.uroborosqlfmtrc.jsondoesn't exist, formatter will use formatters default configurations. | 
{
  "debug": false,
  "tab_size": 4,
  "complement_alias": true,
  "trim_bind_param": false,
  "keyword_case": "preserve",
  "identifier_case": "preserve",
  "max_char_per_line": 50,
  "complement_outer_keyword": true,
  "complement_column_as_keyword": true,
  "remove_table_as_keyword": true,
  "remove_redundant_nest": true,
  "complement_sql_id": true,
  "convert_double_colon_cast": false,
  "unify_not_equal": true,
  "indent_tab": true,
  "use_parser_error_recovery": true
}Create .uroborosqlfmtrc.json in the directory where you run the command and write the configuration there.
If there is no configuration file, the default values are used.
| name | type | description | default | 
|---|---|---|---|
| debug | bool | Run in debug mode. | false | 
| tab_size | int | Tab size used for formatting. | 4 | 
| complement_alias | bool | Complement aliases. Currently, column names are auto-completed with the same name. (e.g. COL1→COL1 AS COL1) | true | 
| trim_bind_param | bool | Trim the contents of the bind parameters. (e.g. /* foo */→/*foo*/) | false | 
| keyword_case | [ "upper","lower","preserve"] | Unify the case of keywords. (No conversion in case of "preserve") | lower | 
| identifier_case | [ "upper","lower","preserve"] | Unify the case of identifiers. (No conversion in case of "preserve") | lower | 
| max_char_per_line | int | If the total number of characters in the function name and arguments exceeds max_char_per_line, the arguments are formatted with new lines. | 50 | 
| complement_outer_keyword | bool | Complement the optional OUTER. (e.g.LEFT JOIN→LEFT OUTER JOIN) | true | 
| complement_column_as_keyword | bool | Complement ASin column aliases. | true | 
| remove_table_as_keyword | bool | Remove ASin table aliases. | true | 
| remove_redundant_nest | bool | Remove redundant parentheses. (e.g. (((foo)))→(foo)) | true | 
| complement_sql_id | bool | Complement SQL ID. | false | 
| convert_double_colon_cast | bool | Convert casts by X::typeto the formCAST(X AS type). | true | 
| unify_not_equal | bool | Convert comparison operator <>to!= | true | 
| indent_tab | bool | Switch the indentation style between tabs and spaces. | true | 
| use_parser_error_recovery | bool | Enable error recovery in the SQL parser. | true | 
| command title | description | 
|---|---|
| Format SQL | You can trigger formatting by executing this command. | 
| Export workspace config to uroborosql-fmt config file | You can export workspace configurations to formatter's configuration file (specified in uroborosql-fmt.configurationFilePath). Only the non-null configurations in settings.jsonwill overwrite those in.uroborosqlfmtrc.json. | 
| Import uroborosql-fmt config file config to workspace config | You can import formatter's configuration into workspace configuration. Configuration values that exist in settings.json, but not in.uroborosqlfmtrc.json, will be set tonull. | 
| Import uroborosql-fmt config file config to global config | You can import formatter's configuration into global configuration. Configuration values that exist in settings.json, but not in.uroborosqlfmtrc.json, will be set tonull. | 

