ஃபார்மேட்டர்கள்
Dropstone மொழி-குறிப்பிட்ட ஃபார்மேட்டர்களைப் பயன்படுத்துகிறது.
Dropstone கோப்புகள் எழுதப்பட்ட அல்லது திருத்தப்பட்ட பிறகு மொழி-குறிப்பிட்ட ஃபார்மேட்டர்களைப் பயன்படுத்தி அவற்றை வடிவமைக்க முடியும். ஃபார்மேட்டர்கள் முன்னிருப்பாக முடக்கப்பட்டுள்ளன; Dropstone அவற்றை இயக்குவதற்கு முன் உங்கள் கட்டமைப்பில் அவற்றை இயக்கவும்.
உள்ளமைக்கப்பட்ட
Dropstone பிரபலமான மொழிகள் மற்றும் கட்டமைப்புகளுக்கான பல உள்ளமைக்கப்பட்ட ஃபார்மேட்டர்களுடன் வருகிறது. கீழே ஃபார்மேட்டர்கள், ஆதரிக்கப்பட்ட கோப்பு நீட்டிப்புகள் மற்றும் அதற்கு தேவையான கட்டளைகள் அல்லது கட்டமைப்பு விருப்பங்களின் பட்டியல் உள்ளது.
| Formatter | Extensions | Requirements |
|---|---|---|
| air | .R | air command available |
| biome | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and more | biome.json(c) config file |
| cargofmt | .rs | cargo fmt command available |
| clang-format | .c, .cpp, .h, .hpp, .ino, and more | .clang-format config file |
| cljfmt | .clj, .cljs, .cljc, .edn | cljfmt command available |
| dart | .dart | dart command available |
| dfmt | .d | dfmt command available |
| gleam | .gleam | gleam command available |
| gofmt | .go | gofmt command available |
| htmlbeautifier | .erb, .html.erb | htmlbeautifier command available |
| ktlint | .kt, .kts | ktlint command available |
| mix | .ex, .exs, .eex, .heex, .leex, .neex, .sface | mix command available |
| nixfmt | .nix | nixfmt command available |
| ocamlformat | .ml, .mli | ocamlformat command available and .ocamlformat config file |
| ormolu | .hs | ormolu command available |
| pint | .php | laravel/pint dependency in composer.json |
| prettier | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and more | prettier dependency in package.json |
| rubocop | .rb, .rake, .gemspec, .ru | rubocop command available |
| ruff | .py, .pyi | ruff command available with config |
| rustfmt | .rs | rustfmt command available |
| shfmt | .sh, .bash | shfmt command available |
| standardrb | .rb, .rake, .gemspec, .ru | standardrb command available |
| terraform | .tf, .tfvars | terraform command available |
| uv | .py, .pyi | uv command available |
| zig | .zig, .zon | zig command available |
ஃபார்மேட்டர்கள் இயக்கப்பட்டால், உங்கள் திட்டத்தில் package.json இல் prettier இருந்தால் Dropstone பொருந்தக்கூடிய கோப்புகளுக்கு prettier ஐப் பயன்படுத்தும்.
இது எவ்வாறு செயல்படுகிறது
Dropstone ஒரு கோப்பை எழுதும் அல்லது திருத்தும் போது மற்றும் ஃபார்மேட்டர்கள் இயக்கப்பட்டால், இது:
- கோப்பு நீட்டிப்பை அனைத்து இயக்கப்பட்ட ஃபார்மேட்டர்களுக்கு எதிராக சரிபார்க்கிறது.
- கோப்பில் பொருத்தமான ஃபார்மேட்டர் கட்டளையை இயக்குகிறது.
- வடிவமைப்பு மாற்றங்களைப் பயன்படுத்துகிறது.
இந்த செயல்முறை இயக்கப்பட்ட ஃபார்மேட்டர்களுக்கு பின்னணியில் நிகழ்கிறது.
கட்டமைக்கவும்
உங்கள் Dropstone கட்டமைப்பில் formatter பிரிவின் மூலம் ஃபார்மேட்டர்களை இயக்கவும் மற்றும் தனிப்பயனாக்கவும் முடியும்.
அனைத்து உள்ளமைக்கப்பட்ட ஃபார்மேட்டர்களை இயக்க, formatter ஐ true ஆக அமைக்கவும்.
{
"$schema": "https://dropstone.io/schema/config.json",
"formatter": true
}
உள்ளமைக்கப்பட்டவற்றை இயக்கியே வைத்துக்கொண்டு மேலெழுதல்கள் அல்லது தனிப்பயன் ஃபார்மேட்டர்களை கட்டமைக்க ஒரு பொருளைப் பயன்படுத்தவும்.
{
"$schema": "https://dropstone.io/schema/config.json",
"formatter": {}
}
ஒவ்வொரு ஃபார்மேட்டர் கட்டமைப்பு பின்வருவனவற்றை ஆதரிக்கிறது:
| Property | Type | Description |
|---|---|---|
disabled | boolean | ஃபார்மேட்டரை முடக்க இதை true ஆக அமைக்கவும் |
command | string[] | வடிவமைப்புக்கு இயக்க வேண்டிய கட்டளை. தனிப்பயன் ஃபார்மேட்டர்களுக்கு தேவை; உள்ளமைக்கப்பட்டவற்றுக்கு விருப்பமுள்ளது. |
environment | object | ஃபார்மேட்டரை இயக்கும் போது அமைக்க வேண்டிய சுற்றுச்சூழல் மாறிகள் |
extensions | string[] | இந்த ஃபார்மேட்டர் கையாள வேண்டிய கோப்பு நீட்டிப்புகள் |
சில உதாரணங்களைப் பார்ப்போம்.
ஃபார்மேட்டர்களை முடக்குதல்
formatter தவிர்க்கப்பட்டால், அனைத்து ஃபார்மேட்டர்களும் முடக்கப்பட்டுள்ளன. மற்றொரு கட்டமைப்பு அவற்றை இயக்கிய பிறகு அனைத்து ஃபார்மேட்டர்களையும் முடக்க, formatter ஐ false ஆக அமைக்கவும்:
{
"$schema": "https://dropstone.io/schema/config.json",
"formatter": false
}
குறிப்பிட்ட ஃபார்மேட்டரை முடக்க, disabled ஐ true ஆக அமைக்கவும்:
{
"$schema": "https://dropstone.io/schema/config.json",
"formatter": {
"prettier": {
"disabled": true
}
}
}
தனிப்பயன் ஃபார்மேட்டர்கள்
environment அல்லது extensions போன்ற விருப்பங்களுடன் உள்ளமைக்கப்பட்ட ஃபார்மேட்டர்களை நீங்கள் கட்டமைக்கலாம். தனிப்பயன் ஃபார்மேட்டரைச் சேர்க்க, command மற்றும் extensions ஐ குறிப்பிடவும்:
{
"$schema": "https://dropstone.io/schema/config.json",
"formatter": {
"prettier": {
"command": ["npx", "prettier", "--write", "$FILE"],
"environment": {
"NODE_ENV": "development"
},
"extensions": [".js", ".ts", ".jsx", ".tsx"]
},
"custom-markdown-formatter": {
"command": ["deno", "fmt", "$FILE"],
"extensions": [".md"]
}
}
}
கட்டளையில் $FILE பிரதிநிதி வடிவமைக்கப்படும் கோப்பின் பாதையுடன் மாற்றப்படும்.