https://github.com/codeitlikemiley/leptos-fmt
vscode extension for formatting rust leptos project
https://github.com/codeitlikemiley/leptos-fmt
Last synced: 3 months ago
JSON representation
vscode extension for formatting rust leptos project
- Host: GitHub
- URL: https://github.com/codeitlikemiley/leptos-fmt
- Owner: codeitlikemiley
- License: mit
- Created: 2024-10-15T09:12:03.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-02-13T14:56:05.000Z (3 months ago)
- Last Synced: 2025-02-13T15:38:56.735Z (3 months ago)
- Language: TypeScript
- Size: 605 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-leptos - leptos-fmt vscode plugin - autoformat your code with leptosfmt (Tools)
README
# leptos-fmt
> Open VSX | Vscode Marketplace
 
Uses the built in Rust analyzer to auto-format your Leptos code. You can invoke command palette command with `Leptos Init` to generate the override command on your `.vscode/settings.json` file.
For Complex Project , and you dont want to override fmt on workspace level, and avoid pulluting override command on other projects.
You can invoke command palette command with `Format with Leptosfmt` or bind it to a key.
## Demo
[](https://youtu.be/dS92U-yv7co)## Requirements
- **Rust**: Ensure you have Rust installed on your machine.
- **Leptosfmt**: This extension requires `leptosfmt`. Install it using:```bash
cargo install leptosfmt
```## Using built in Rust Analyzer (rust-lang.rust-analyzer)
1. Press `Ctrl+Shift+P` to open the command palette.
2. Type `Leptos Init` to any Leptos project.
Note: it would generate this on `.vscode/settings.json````json
{
"rust-analyzer.procMacro.ignored": {
"leptos_macro": [
"server"
]
},
"rust-analyzer.rustfmt.overrideCommand": [
"leptosfmt",
"--stdin",
"--rustfmt"
],
"rust-analyzer.cargo.features": [
"ssr"
]
}
```## Custom Key Bindings
1. Press `Ctrl+Shift+P` to open the command palette.
2. Type `Keyboard Shortcuts` to open the keyboard shortcuts settings.
3. Search for `leptos-fmt.format`
4. Bind it to a keybinding to your preference e.g. OPT + SHIFT + F## Custom Paths
1. Press CMD or CTRL + , to open the settings.
2. type `leptos`
3. find `leptos-fmt.path` and set it to the path of your `leptosfmt` binary
4. find `leptos-fmt.cargoHome` and set it to the path of your `cargo` home directory