gpt4 book ai didi

How to disable prettier auto adding brackets?(如何禁用更漂亮的自动添加括号?)

转载 作者:bug小助手 更新时间:2023-10-22 17:34:29 28 4
gpt4 key购买 nike



I'm using javascript, when I typing a async code like
fn().then().catch(e=>console.log(e)), my prettier always add brackets at the catch function like fn().then().catch((e)=>console.log(e)).
Is there any way to disable this behavior?

我使用的是javascript,当我键入类似于fn().then().catch(e=>console.log(e))的异步代码时,我的漂亮女孩总是在类似于fn).then).catch的catch函数处添加括号((e)=>console.log(e)。有什么方法可以禁用这种行为吗?


更多回答

What brackets are you talking about?

你在说什么括号?

You mean around the parameter (e)? Why do you insist on removing that. It is good for readability

你的意思是围绕参数(e)?你为什么坚持要去掉它。它有利于可读性

I think no brackets around a function with only one parameter is easier to write and read

我认为只有一个参数的函数周围没有括号更容易写和读

Sorry, I found that has nothing to do about VSCode, It's because my prettier format config

对不起,我发现这与VSCode无关,这是因为我的格式配置更漂亮

This is what I want, thank you guys. prettier.io/docs/en/options.html#arrow-function-parentheses

这就是我想要的,谢谢你们。pieter.io/docs/en/options.html#箭头函数圆括号

优秀答案推荐

in vs code Settings and search for Brackets then set value to never for this option: Auto Closing Brackets.

在vs代码设置中,搜索括号,然后将此选项的值设置为从不:自动闭合括号。


Similarly you can add "editor.autoClosingBrackets": "never" in settings.json page.

同样,您可以在settings.json页面中添加“editor.autoClosingBrackets”:“never”。


Read more here:
How to disable automatically adding a closing curly brace or bracket insertion in VS Code?

在这里阅读更多:如何禁用在VS代码中自动添加大括号或插入括号?


Also, please provide complete details and focus on searching through SO links for any query first then if your question is not asked then only add your question.
Good luck!!

此外,请提供完整的详细信息,并专注于首先在SO链接中搜索任何查询,如果没有询问您的问题,则只添加您的问题。祝你好运


更多回答

This is not what I want, thanks anyway

这不是我想要的,无论如何谢谢

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com