mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-03 13:23:00 +00:00
That is supposed to help catch some cases, where functions panic, but it missed the two `expect(...)` calls, so it is definitely not a complete solution. I'd love to fuzz this, but AFAICT `rowan` does not support the `arbitrary` crate, so I can not have the fuzzer create random Expressions as input. Fix the few clippy warnings in the LSP. |
||
|---|---|---|
| .. | ||
| fmt.rs | ||
| README.md | ||
| tool.rs | ||
| writer.rs | ||
Slint-fmt
This tool for formatting .slint syntax is in a very early stage. There might be certain parts of the language that are not yet supported. If you find any such examples, please open an issue including the example and the expected output.
Building
This tool is part of slint-lsp. See the README file in lsp for building information.
Usage
The built binary can be used in following ways:
slint-lsp format <path>- reads the file and outputs the formatted version to stdoutslint-lsp format -i <path>- reads the file and saves the output to the same fileslint-lsp format /dev/stdin- using /dev/stdin you can achieve the special behavior of reading from stdin and writing to stdout
Note that .slint files are formatted, while .md and .rs files are searched for .slint blocks.
All other files are left untouched.
Usage with VSCode
While we don't yet have a proper VSCode integration for this formatter, here is a simple way how you can get around it.
- Install the extension Custom Format by Vehmloewff. Marketplace link
- Build slint-lsp locally.
- Add a section like this to your vscode
settings.json:
{
"custom-format.formatters": [
{
"language": "slint",
"command": "/path/to/your/built/slint-lsp format /dev/stdin"
}
]
}
- (Optional) Allow formatting or save, or set this formatter as default for .slint files.
- Enjoy! Your .slint files are now formatted.