Skip to content

Commit

Permalink
Add formatters for Elm, Haskell, Python, and TypeScript
Browse files Browse the repository at this point in the history
This commit adds `elm-format` for Elm, `ormolu` for Haskell, `ruff`
for Python (with `black` as a backup), and `prettier` (with `biome`
and `deno` as backups) for TypeScript, Javascript, TSX, JSX, etc.
  • Loading branch information
heyakyra committed Nov 29, 2024
1 parent e1d1a5c commit 6c9653f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,10 @@ roots = [ "package.json" ]
comment-token = "//"
block-comment-tokens = { start = "/*", end = "*/" }
language-servers = [ "typescript-language-server" ]
formatter = { command = "prettier" }
# Alternative formatters (comment the above and un-comment one below to use it)
# formatter = { command = "biome", args = ["format"] }
# formatter = { command = "deno", args = ["format"] }
indent = { tab-width = 2, unit = " " }

[language.debugger]
Expand Down Expand Up @@ -778,6 +782,10 @@ roots = [ "package.json" ]
comment-token = "//"
block-comment-tokens = { start = "/*", end = "*/" }
language-servers = [ "typescript-language-server" ]
formatter = { command = "prettier" }
# Alternative formatters (comment the above and un-comment one below to use it)
# formatter = { command = "biome", args = ["format"] }
# formatter = { command = "deno", args = ["format"] }
indent = { tab-width = 2, unit = " " }
grammar = "javascript"

Expand All @@ -792,6 +800,10 @@ roots = [ "package.json", "tsconfig.json" ]
comment-token = "//"
block-comment-tokens = { start = "/*", end = "*/" }
language-servers = [ "typescript-language-server" ]
formatter = { command = 'prettier', args = ["--parser", "typescript"] }
# Alternative formatters (comment the above and un-comment one below to use it)
# formatter = { command = "biome", args = ["format"] }
# formatter = { command = "deno", args = ["format"] }
indent = { tab-width = 2, unit = " " }

[[grammar]]
Expand Down Expand Up @@ -825,6 +837,10 @@ roots = [ "package.json", "tsconfig.json" ]
comment-token = "//"
block-comment-tokens = { start = "/*", end = "*/" }
language-servers = [ "typescript-language-server" ]
formatter = { command = "prettier", args = ["--parser", "typescript"] }
# Alternative formatters (comment the above and un-comment one below to use it)
# formatter = { command = "biome", args = ["format"] }
# formatter = { command = "deno", args = ["format"] }
indent = { tab-width = 2, unit = " " }

[[grammar]]
Expand Down Expand Up @@ -882,6 +898,9 @@ shebangs = ["python"]
roots = ["pyproject.toml", "setup.py", "poetry.lock", "pyrightconfig.json"]
comment-token = "#"
language-servers = ["ruff", "jedi", "pylsp"]
formatter = { command = "ruff", args = ["format"]}
# Alternative formatters (comment the above and un-comment one below to use it)
# formatter = { command = "black", args = ["-"] }
# TODO: pyls needs utf-8 offsets
indent = { tab-width = 4, unit = " " }

Expand Down Expand Up @@ -1354,6 +1373,7 @@ roots = ["Setup.hs", "stack.yaml", "cabal.project"]
comment-token = "--"
block-comment-tokens = { start = "{-", end = "-}" }
language-servers = [ "haskell-language-server" ]
formatter = { command = "ormolu" }
indent = { tab-width = 2, unit = " " }

[[grammar]]
Expand Down Expand Up @@ -1807,6 +1827,7 @@ auto-format = true
comment-token = "--"
block-comment-tokens = { start = "{-", end = "-}" }
language-servers = [ "elm-language-server" ]
formatter = { command = "elm-format", args = ["--stdin"] }
indent = { tab-width = 4, unit = " " }

[[grammar]]
Expand Down Expand Up @@ -3793,6 +3814,10 @@ language-servers = [
"vscode-eslint-language-server",
"ember-language-server",
]
formatter = { command = "prettier" }
# Alternative formatters (comment the above and un-comment one below to use it)
# formatter = { command = "biome", args = ["format"] }
# formatter = { command = "deno", args = ["format"] }
indent = { tab-width = 2, unit = " " }
grammar = "javascript"

Expand All @@ -3817,6 +3842,10 @@ language-servers = [
"vscode-eslint-language-server",
"ember-language-server",
]
formatter = { command = "prettier", args = ["--parser", "typescript"] }
# Alternative formatters (comment the above and un-comment one below to use it)
# formatter = { command = "biome", args = ["format"] }
# formatter = { command = "deno", args = ["format"] }
indent = { tab-width = 2, unit = " " }
grammar = "typescript"

Expand Down

0 comments on commit 6c9653f

Please sign in to comment.