mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
docs: add section on small DX wins (closes #1310)
This commit is contained in:
parent
23d48d4c0e
commit
e8a7086546
2 changed files with 50 additions and 0 deletions
|
@ -47,3 +47,4 @@
|
|||
- [Deployment](./deployment.md)
|
||||
- [Appendix: How Does the Reactive System Work?](./appendix_reactive_graph.md)
|
||||
- [Appendix: Optimizing WASM Binary Size](./appendix_binary_size.md)
|
||||
- [Appendix: Some Small DX Improvements](./appending_dx.md)
|
||||
|
|
49
docs/book/src/appendix_dx.md
Normal file
49
docs/book/src/appendix_dx.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
# A Running List of Small Developer Experience Improvements
|
||||
|
||||
## Autocompletion inside `#[component]` and `#[server]`
|
||||
|
||||
Because of the nature of macros (they can expand from anything to anything, but only if the input is exactly correct at that instant) it can be hard for rust-analyzer to do proper autocompletion and other support.
|
||||
|
||||
But you can tell rust-analyzer to ignore certain proc macros. For `#[component]` and `#[server]` especially, which annotate function bodies but don't actually transform anything inside the body of your function, this can be really helpful.
|
||||
|
||||
Note that this means that rust-analyzer doesn't know about your component props, which may generate its own set of errors or warnings in the IDE.
|
||||
|
||||
VSCode `settings.json`:
|
||||
|
||||
```json
|
||||
"rust-analyzer.procMacro.ignored": {
|
||||
"leptos_macro": [
|
||||
"server",
|
||||
"component"
|
||||
],
|
||||
}
|
||||
```
|
||||
|
||||
neovim with lspconfig:
|
||||
|
||||
```lua
|
||||
require('lspconfig').rust_analyzer.setup {
|
||||
-- Other Configs ...
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
-- Other Settings ...
|
||||
procMacro = {
|
||||
ignored = {
|
||||
leptos_macro = {
|
||||
"server",
|
||||
"component",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Helix, in `.helix/languages.toml`:
|
||||
|
||||
```toml
|
||||
[[language]]
|
||||
name = "rust"
|
||||
config = { procMacro = {ignored = {leptos_macro = ["component"]}}}
|
||||
```
|
Loading…
Reference in a new issue