# EditorConfig: https://editorconfig.org
# In VS Code, install the "EditorConfig for VS Code" extension (EditorConfig.EditorConfig).

root = true

# Defaults for every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

# Python
[*.{py,pyi}]
indent_size = 4
max_line_length = 88

# Mojo (`mojo format` is Black-style, 88 columns; the fire emoji extension is also valid)
[*.{mojo,🔥}]
indent_size = 4
max_line_length = 88

# Rust (rustfmt defaults: 4 spaces, 100 columns)
[*.rs]
indent_size = 4
max_line_length = 100

# Cargo manifests and rustfmt config
[{Cargo.toml,Cargo.lock,rustfmt.toml,.rustfmt.toml,clippy.toml}]
indent_size = 4

# Mojo project manifest
[{mojoproject.toml,pixi.toml,pixi.lock}]
indent_size = 4

# YAML
[*.{yml,yaml}]
indent_size = 2

# JSON and friends
[*.{json,jsonc,json5}]
indent_size = 2

# Web
[*.{js,jsx,mjs,cjs,ts,tsx,css,scss,less,html,vue,svelte}]
indent_size = 2

# Config formats
[*.{toml,ini,cfg}]
indent_size = 4

[*.xml]
indent_size = 2

# Markdown: trailing spaces are significant (hard line breaks)
[*.{md,markdown}]
indent_size = 2
trim_trailing_whitespace = false

# typst
[*.{typ}]
indent_size = 4
trim_trailing_whitespace = false

# Shell scripts
[*.{sh,bash,zsh}]
indent_size = 2

# Makefiles require tabs
[{Makefile,makefile,*.mk}]
indent_style = tab

# Go uses tabs
[*.go]
indent_style = tab

# Windows-only scripts need CRLF
[*.{bat,cmd,ps1}]
end_of_line = crlf

# Dockerfiles
[{Dockerfile,Dockerfile.*,*.dockerfile}]
indent_size = 4

# Terraform
[*.{tf,tfvars,hcl}]
indent_size = 2

# Don't touch these
[LICENSE*]
insert_final_newline = false

[*.{diff,patch}]
trim_trailing_whitespace = false

[*.min.{js,css}]
insert_final_newline = unset
trim_trailing_whitespace = unset
