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

fix(semantic/jsdoc): Support multibyte chars #2694

Merged
merged 4 commits into from
Mar 13, 2024
Merged

Conversation

leaysgur
Copy link
Contributor

Fix for #2642 (comment)

Any advice would be appreciated as I'm not too sure about this area. 🥹

@github-actions github-actions bot added the A-semantic Area - Semantic label Mar 12, 2024
Copy link

codspeed-hq bot commented Mar 12, 2024

CodSpeed Performance Report

Merging #2694 will not alter performance

Comparing fix-multibyte-jsdoc (df72c9d) with main (0f86333)

Summary

✅ 29 untouched benchmarks

@leaysgur leaysgur requested a review from Boshen March 13, 2024 00:23
@Boshen
Copy link
Member

Boshen commented Mar 13, 2024

You can improve the whole lexer by using Chars and Peekable:

#[derive(Debug)]
pub struct JSDocParser<'a> {
    chars: Peekable<Chars<'a>>,
}

impl<'a> JSDocParser<'a> {
    pub fn new(source_text: &'a str) -> Self {
        let chars = source_text.trim().chars().peekable();
        Self { chars }
    }

Or maybe just Chars + an offset

#[derive(Debug)]
pub struct JSDocParser<'a> {
    chars: Chars<'a>,
    current: usize,
}

@Boshen Boshen merged commit b00d4b8 into main Mar 13, 2024
18 checks passed
@Boshen Boshen deleted the fix-multibyte-jsdoc branch March 13, 2024 11:00
@leaysgur
Copy link
Contributor Author

Thank you for your time + support @Boshen !!

by using Chars and Peekable:

I will try it again one day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-semantic Area - Semantic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants