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

Issue: Incorrect syntax highlighting when using TypeScript destructuring operator #243

Open
ProRedCat opened this issue Sep 5, 2024 · 0 comments

Comments

@ProRedCat
Copy link

I've encountered an issue where the code highlight colouring falls apart once it encounters destructuring in TypeScript code blocks.

My solution is to just comment out the destructuring to correctly highlight the remaining code. While this is a niche case it would be great for rehype-pretty-code to support this :)

Here is the code blog which is causing issues, attached after is some screenshots of what rehype-pretty-code colours them as

private async handleSaveMyBusStopQuestion(
        question: SaveMyBusStopQuestion,
    ): Promise<Result<SaveMyBusStopAnswer, Error>> {
        // Destructuring isn't highlighting correctly :(
        const [persistentState, stopRes] = await Promise.all([
            question.persistentState,
            this.edge.getStop(question.userStopId, Optional.none()),
        ]);

        if (stopRes.err) return stopRes;

        persistentState.mutate((pState) => {
            pState.userStop = stopRes.val;
        });

        return Ok(new SaveMyBusStopAnswer(stopRes.val));
}

image

Commenting out the destructuring in this
image

@ProRedCat ProRedCat changed the title Issue: Incorrect code highlight colouring when using TypeScript destructuring operator Issue: Incorrect syntax highlighting when using TypeScript destructuring operator Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant