Files
dioxus/packages/rsx/src/errors.rs
T
Evan AlmloffandJonathan Kelley 2523581cf4 Autocomplete rsx (#2421)
* autocomplete rsx

* hide the completions module

* fix autocomplete for identifiers that start with a raw identifier

* add field completion hints for props

* remove extra import

* Revert "add field completion hints for props"

This reverts commit 194899c73783e0f9b5d601d53365746d838f2048.

* fix autocomplete inside raw expressions

* fix autofmt

* feat: just use regular ifmt if it's compatible

reuses the tokens for ifmt so RA provides its HIR lowering on simple formatted strings

* fix merging ifmt strings

* add a better error message for components called like functions

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-05-22 07:24:50 -05:00

43 lines
1.2 KiB
Rust

use proc_macro2::Span;
pub(crate) fn missing_trailing_comma(span: Span) -> syn::Error {
syn::Error::new(span, "missing trailing comma")
}
macro_rules! missing_trailing_comma {
($span:expr) => {
return Err(crate::errors::missing_trailing_comma($span));
};
}
macro_rules! attr_after_element {
($span:expr) => {
return Err(syn::Error::new($span, "expected element\n = help move the attribute above all the children and text elements"));
};
}
macro_rules! component_path_cannot_have_arguments {
($span:expr) => {
return Err(Error::new(
$span,
"expected a path without arguments\n = try remove the path arguments",
));
};
}
macro_rules! invalid_component_path {
($span:expr) => {
return Err(Error::new($span, "Invalid component path syntax"));
};
}
macro_rules! invalid_key {
($_key:ident) => {
let val = $_key.to_static().unwrap();
return Err(syn::Error::new(
$_key.span(),
format!("Element keys must be a dynamic value. Considering using `key: {{{val}}}` instead.\nStatic keys will result in every element using the same key which will cause rendering issues or panics."),
));
};
}