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>
This commit is contained in:
1 parent
245003a5d4
commit
2523581cf4
21 files changed
+788
-217
No files matched your search
@@ -8,7 +8,6 @@ use dioxus_rsx::HotReloadingContext;
|
||||
|
||||
#[cfg(feature = "hot-reload-context")]
|
||||
use crate::{map_global_attributes, map_svg_attributes};
|
||||
use crate::{GlobalAttributes, SvgAttributes};
|
||||
|
||||
pub type AttributeDiscription = (&'static str, Option<&'static str>, bool);
|
||||
|
||||
@@ -115,9 +114,11 @@ macro_rules! impl_element {
|
||||
) => {
|
||||
#[allow(non_camel_case_types)]
|
||||
$(#[$attr])*
|
||||
pub struct $name;
|
||||
pub mod $name {
|
||||
#[allow(unused)]
|
||||
use super::*;
|
||||
pub use crate::attribute_groups::global_attributes::*;
|
||||
|
||||
impl $name {
|
||||
pub const TAG_NAME: &'static str = stringify!($name);
|
||||
pub const NAME_SPACE: Option<&'static str> = None;
|
||||
|
||||
@@ -128,8 +129,6 @@ macro_rules! impl_element {
|
||||
);
|
||||
)*
|
||||
}
|
||||
|
||||
impl GlobalAttributes for $name {}
|
||||
};
|
||||
|
||||
(
|
||||
@@ -141,13 +140,12 @@ macro_rules! impl_element {
|
||||
)*
|
||||
}
|
||||
) => {
|
||||
#[allow(non_camel_case_types)]
|
||||
$(#[$attr])*
|
||||
pub struct $name;
|
||||
pub mod $name {
|
||||
#[allow(unused)]
|
||||
use super::*;
|
||||
pub use crate::attribute_groups::svg_attributes::*;
|
||||
|
||||
impl SvgAttributes for $name {}
|
||||
|
||||
impl $name {
|
||||
pub const TAG_NAME: &'static str = stringify!($name);
|
||||
pub const NAME_SPACE: Option<&'static str> = Some($namespace);
|
||||
|
||||
@@ -171,11 +169,11 @@ macro_rules! impl_element {
|
||||
) => {
|
||||
#[allow(non_camel_case_types)]
|
||||
$(#[$attr])*
|
||||
pub struct $element;
|
||||
pub mod $element {
|
||||
#[allow(unused)]
|
||||
use super::*;
|
||||
pub use crate::attribute_groups::svg_attributes::*;
|
||||
|
||||
impl SvgAttributes for $element {}
|
||||
|
||||
impl $element {
|
||||
pub const TAG_NAME: &'static str = $name;
|
||||
pub const NAME_SPACE: Option<&'static str> = Some($namespace);
|
||||
|
||||
@@ -384,10 +382,23 @@ macro_rules! builder_constructors {
|
||||
);
|
||||
)*
|
||||
|
||||
/// This module contains helpers for rust analyzer autocompletion
|
||||
#[doc(hidden)]
|
||||
pub mod completions {
|
||||
/// This helper tells rust analyzer that it should autocomplete the element name with braces.
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum CompleteWithBraces {
|
||||
$(
|
||||
$(#[$attr])*
|
||||
$name {}
|
||||
),*
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) mod extensions {
|
||||
use super::*;
|
||||
$(
|
||||
impl_extension_attributes![ELEMENT $name { $($fil,)* }];
|
||||
impl_extension_attributes![$name { $($fil,)* }];
|
||||
)*
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user