Skip to content

Commit e038a25

Browse files
committed
Use an enum for shfmt language dialect config
1 parent 0c9504c commit e038a25

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

server/src/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export const ConfigSchema = z.object({
4646
// Controls the executable used for Shfmt formatting. An empty string will disable formatting
4747
path: z.string().trim().default('shfmt'),
4848

49+
// Language dialect to use when parsing (bash/posix/mksh/bats).
50+
languageDialect: z.enum(['auto', 'bash', 'posix', 'mksh', 'bats']).default('auto'),
51+
4952
// Allow boolean operators (like && and ||) to start a line.
5053
binaryNextLine: z.boolean().default(false),
5154

@@ -58,9 +61,6 @@ export const ConfigSchema = z.object({
5861
// (Deprecated) Keep column alignment padding.
5962
keepPadding: z.boolean().default(false),
6063

61-
// Language dialect to use when parsing (bash/posix/mksh/bats).
62-
languageDialect: z.string().trim().default('auto'),
63-
6464
// Simplify code before formatting.
6565
simplifyCode: z.boolean().default(false),
6666

vscode-client/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@
8686
"bashIde.shfmt.languageDialect": {
8787
"type": "string",
8888
"default": "auto",
89+
"enum": [
90+
"auto",
91+
"bash",
92+
"posix",
93+
"mksh",
94+
"bats"
95+
],
8996
"description": "Language dialect to use when parsing (bash/posix/mksh/bats)."
9097
},
9198
"bashIde.shfmt.binaryNextLine": {

0 commit comments

Comments
 (0)