Fix rsx autocomplete and diagnostics in the root; provide better completions after attributes are finished (#2656)
* fix rsx autocomplete and diagnostics in the root; provide better completions after attributes are finished * clean up pr to use internal child parsing * Fix peek_lowercase name * fix comma diagnostics in the root * Fix parsing components with a path * remove simple routes trailing comma * Fix incomplete_root_elements test * Remove trailing commas from root body node in tests --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
71a48686dc
commit
fa4e5dbf62
8 files changed
+179
-79
No files matched your search
@@ -7,7 +7,7 @@ use quote::ToTokens;
|
||||
use syn::{
|
||||
parse::{Parse, ParseStream},
|
||||
spanned::Spanned,
|
||||
token::{self, Brace},
|
||||
token::{self},
|
||||
Ident, LitStr, Result, Token,
|
||||
};
|
||||
|
||||
@@ -76,16 +76,17 @@ impl Parse for BodyNode {
|
||||
return Ok(BodyNode::Element(stream.parse::<Element>()?));
|
||||
}
|
||||
|
||||
// this is an Element if path match of:
|
||||
// this is an Element if the path is:
|
||||
//
|
||||
// - one ident
|
||||
// - followed by `{`
|
||||
// - 1st char is lowercase
|
||||
// - no underscores (reserved for components)
|
||||
// And it is not:
|
||||
// - the start of a path with components
|
||||
//
|
||||
// example:
|
||||
// div {}
|
||||
if stream.peek(Ident) && stream.peek2(Brace) {
|
||||
if stream.peek(Ident) && !stream.peek2(Token![::]) {
|
||||
let ident = stream.fork().parse::<Ident>().unwrap();
|
||||
let el_name = ident.to_string();
|
||||
let first_char = el_name.chars().next().unwrap();
|
||||
|
||||
Reference in new issue
Block a user