Why doesn't VS Code limit each line to a maximum of 80 characters when saving?
P粉129731808
P粉129731808 2023-09-16 23:12:08
0
1
599

I installed the Prettier extension and set the maximum line width to 80. I also set it up to format on save. When I save the file I'm working on, I find that the comments are still very long. The extension should shorten it to the maximum 80 character width, but it doesn't do that. Do I need to use other settings? Or maybe there is a better extension than Prettier? I just want to use any formatting tool that can eliminate the 200 errors I get when deploying my TypeScript cloud functions.

P粉129731808
P粉129731808

reply all (1)
P粉541565322

Prettier does not format comments, seehttps://prettier.io/docs/en/rationale.html#comments

I recommend converting your comments tojsdoc style commentsand wrapping them yourself.

vscode has a nice feature where adding a newline character to a comment will make the new line a comment as well.

By the way, I can't comment on your post because I don't have enough reputation haha, but you can create a basic prettier profile by pressing Ctrl Shift P and typing prettier,

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!