Skip to content

Commit

Permalink
Add description of configuration to readme (#22)
Browse files Browse the repository at this point in the history
* update integrity of uroborosql-fmt-napi

* Update README.md

---------

Co-authored-by: yamada2915 <s.yamada.bg@future.co.jp>
  • Loading branch information
tanzaku and future-yamada2915 authored Oct 11, 2023
1 parent ae207f2 commit e110ded
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,48 @@ You can enable format on save for SQL by having the following values in your set
| ------------------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| uroborosql-fmt.configurationFilePath | null | The path of configuration file. File extension must be `.json`. If you don't specify the path and `./.uroborosqlfmtrc.json` exists, formatter will use `./.uroborosqlfmtrc.json`. If you doesn't specify and `.uroborosqlfmtrc.json` doesn't exist, formatter will use formatters default configurations. |

### Configuration options

```json
{
"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
}
```

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`](docs/options/debug.md) | bool | Run in debug mode. | false |
| [`tab_size`](docs/options/tab_size.md) | int | Tab size used for formatting. | 4 |
| [`complement_alias`](docs/options/complement_alias.md) | bool | Complement aliases. Currently, column names are auto-completed with the same name. (e.g. `COL1``COL1 AS COL1`) | true |
| [`trim_bind_param`](docs/options/trim_bind_param.md) | bool | Trim the contents of the [bind parameters](https://future-architect.github.io/uroborosql-doc/background/#%E3%83%8F%E3%82%99%E3%82%A4%E3%83%B3%E3%83%88%E3%82%99%E3%83%8F%E3%82%9A%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF). (e.g. `/* foo */``/*foo*/`) | false |
| [`keyword_case`](docs/options/keyword_case.md) | [`"upper"`, `"lower"`, `"preserve"`] | Unify the case of keywords. (No conversion in case of `"preserve"`) | lower |
| [`identifier_case`](docs/options/identifier_case.md) | [`"upper"`, `"lower"`, `"preserve"`] | Unify the case of identifiers. (No conversion in case of `"preserve"`) | lower |
| [`max_char_per_line`](docs/options/max_char_per_line.md) | 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`](docs/options/complement_outer_keyword.md) | bool | Complement the optional `OUTER`. (e.g. `LEFT JOIN``LEFT OUTER JOIN`) | true |
| [`complement_column_as_keyword`](docs/options/complement_column_as_keyword.md) | bool | Complement `AS` in column aliases. | true |
| [`remove_table_as_keyword`](docs/options/remove_table_as_keyword.md) | bool | Remove `AS` in table aliases. | true |
| [`remove_redundant_nest`](docs/options/remove_redundant_nest.md) | bool | Remove redundant parentheses. (e.g. `(((foo)))``(foo)`) | true |
| [`complement_sql_id`](docs/options/complement_sql_id.md) | bool | Complement [SQL ID](https://palette-doc.rtfa.as/coding-standards/forSQL/SQL%E3%82%B3%E3%83%BC%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0%E8%A6%8F%E7%B4%84%EF%BC%88uroboroSQL%EF%BC%89.html#sql-%E8%AD%98%E5%88%A5%E5%AD%90). | false |
| [`convert_double_colon_cast`](docs/options/convert_double_colon_cast.md) | bool | Convert casts by `X::type` to the form `CAST(X AS type)`. | true |
| [`unify_not_equal`](docs/options/unify_not_equal.md) | bool | Convert comparison operator `<>` to `!=` | true |

## License

[Business Source License 1.1](https://github.com/future-architect/vscode-uroborosql-fmt/blob/main/LICENSE)
2 changes: 1 addition & 1 deletion server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e110ded

Please sign in to comment.