Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ParentIdent to ParentIndent #101

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions formatter/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use syn::{
File, Macro,
};

use crate::{ParentIdent, ViewMacro};
use crate::{ParentIndent, ViewMacro};

struct ViewMacroVisitor<'ast> {
macros: Vec<ViewMacro<'ast>>,
Expand All @@ -26,7 +26,7 @@ impl<'ast> Visit<'ast> for ViewMacroVisitor<'ast> {
let tabs = indent_chars.iter().filter(|&&c| c == '\t').count();
let spaces = indent_chars.iter().filter(|&&c| c == ' ').count();

if let Some(view_mac) = ViewMacro::try_parse(ParentIdent { tabs, spaces }, node) {
if let Some(view_mac) = ViewMacro::try_parse(ParentIndent { tabs, spaces }, node) {
self.macros.push(view_mac);
}
}
Expand Down
10 changes: 5 additions & 5 deletions formatter/src/formatter/mac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use syn::{spanned::Spanned, Macro};
use super::{Formatter, FormatterSettings};

pub struct ViewMacro<'a> {
pub parent_ident: ParentIdent,
pub parent_indent: ParentIndent,
pub cx: Option<TokenTree>,
pub global_class: Option<TokenTree>,
pub nodes: Vec<Node>,
Expand All @@ -17,13 +17,13 @@ pub struct ViewMacro<'a> {
}

#[derive(Default)]
pub struct ParentIdent {
pub struct ParentIndent {
pub tabs: usize,
pub spaces: usize,
}

impl<'a> ViewMacro<'a> {
pub fn try_parse(parent_ident: ParentIdent, mac: &'a Macro) -> Option<Self> {
pub fn try_parse(parent_indent: ParentIndent, mac: &'a Macro) -> Option<Self> {
let mut tokens = mac.tokens.clone().into_iter();
let (cx, comma) = (tokens.next(), tokens.next());

Expand Down Expand Up @@ -56,7 +56,7 @@ impl<'a> ViewMacro<'a> {
let nodes = rstml::parse2(tokens).ok()?;

Some(Self {
parent_ident,
parent_indent,
global_class,
nodes,
span,
Expand All @@ -74,7 +74,7 @@ impl<'a> ViewMacro<'a> {
impl Formatter<'_> {
pub fn view_macro(&mut self, view_mac: &ViewMacro) {
let ViewMacro {
parent_ident: parent_indent,
parent_indent,
cx,
global_class,
nodes,
Expand Down
2 changes: 1 addition & 1 deletion formatter/src/formatter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod mac;
mod node;

pub use mac::format_macro;
pub use mac::{ParentIdent, ViewMacro};
pub use mac::{ParentIndent, ViewMacro};

use serde::Deserialize;
use serde::Serialize;
Expand Down