Skip to content

Commit

Permalink
Add indentTab settings (#75)
Browse files Browse the repository at this point in the history
* feat: add indentTab settings

* chore: add changeset
  • Loading branch information
tanzaku authored Dec 9, 2024
1 parent 84cbc75 commit 69962a0
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-dolphins-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"uroborosql-fmt": minor
---

Add indentTab settings
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ You can enable format on save for SQL by having the following values in your set
"remove_redundant_nest": true,
"complement_sql_id": true,
"convert_double_colon_cast": false,
"unify_not_equal": true
"unify_not_equal": true,
"indent_tab": true
}
```

Expand All @@ -78,6 +79,7 @@ If there is no configuration file, the default values are used.
| [`complement_sql_id`](https://github.com/future-architect/uroborosql-fmt/blob/main/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`](https://github.com/future-architect/uroborosql-fmt/blob/main/docs/options/convert_double_colon_cast.md) | bool | Convert casts by `X::type` to the form `CAST(X AS type)`. | true |
| [`unify_not_equal`](https://github.com/future-architect/uroborosql-fmt/blob/main/docs/options/unify_not_equal.md) | bool | Convert comparison operator `<>` to `!=` | true |
| [`indent_tab`](https://github.com/future-architect/uroborosql-fmt/blob/main/docs/options/indent_tab.md) | bool | Switch the indentation style between tabs and spaces. | true |

## Available Commands

Expand Down
2 changes: 2 additions & 0 deletions client/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const vsCodeConfigurationsObject = {
complementSqlId: null,
convertDoubleColonCast: null,
unifyNotEqual: null,
indentTab: null,
} satisfies ConfigurationRecord;

type ConfigurationRecord = {
Expand All @@ -46,6 +47,7 @@ type ConfigurationRecord = {
complementSqlId: boolean | null | undefined;
convertDoubleColonCast: boolean | null | undefined;
unifyNotEqual: boolean | null | undefined;
indentTab: boolean | null | undefined;
};

// WorkspaceConfigurationを受け取り、フォーマッタで利用する設定のみのRecordにして返す
Expand Down
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@
],
"default": null,
"markdownDescription": "Convert comparison operator `<>` to `!=`. If this value is null, uroborosql-fmt refers the configuration file or uses the default value."
},
"uroborosql-fmt.indentTab": {
"type": [
"boolean",
"null"
],
"enum": [
true,
false,
null
],
"default": null,
"markdownDescription": "Switch the indentation style between tabs and spaces. If this value is null, uroborosql-fmt refers the configuration file or uses the default value."
}
}
}
Expand Down
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.

1 change: 1 addition & 0 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ type ConfigurationSettings = {
complementSqlId: boolean | null | undefined;
convertDoubleColonCast: boolean | null | undefined;
unifyNotEqual: boolean | null | undefined;
indentTab: boolean | null | undefined;
};

function getSettings(resource: string): Thenable<ConfigurationSettings> {
Expand Down

0 comments on commit 69962a0

Please sign in to comment.