“格式选择”用漂亮的扩展名中的整个文档格式化整个文档
我正在研究一个打字稿项目,并且有VS代码最新版本(版本:1.68.1(Universal))。我在VS代码中安装了更漂亮的,并且当我尝试格式化选定的代码时,我会出现问题。它不是格式化选择,而是格式化整个文档,这使得由于较大数量的git diffs而变得困难。
我尝试编辑设置。正如少数帖子中提到的那样,但无济于事,似乎被弃用了。当右键单击VS代码中时,我也不会看到“格式选择”选项。
为什么会发生这种情况?
I am working on a typescript project and i have VS code latest version (Version: 1.68.1 (Universal)).I have prettier installed in VS code and i am having issue when i try to format a selected code. rather than formatting the selection, it format the entire document which makes it hard while code review because of the larger number of git diffs.
I tried editing the settings.json as mentioned in few of the posts but did not help and seems to be deprecated. I also don't see the "Format Selection with" option when in right click in VS code.
Why does this happen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很长一段时间以来,更漂亮, 建立VS代码的扩展名,存在与范围格式相关的问题。过去(固定)有它们,仍然有它们(不是固定),并且可能会继续被发现。维护者自己这样说在这里。您可以通过浏览 httpps:// htttps:// github.com/prettier/prettier/issues?q = is%3aissue+is%3aopen+range+。
有关
esbenp.prettier-vscode
扩展名单中的发行票证的示例(我只是通过谷歌搜索找到的“网站:github.com/prettier/prettier/prettier-vscode/issues format /code>“),请参见#134 (2017年6月),#137 (2017年6月),#2041 (2021年6月),#3145 (2023年9月)。
即使从历史上看,
esbenp.prettier-vscode
也有某些设置将其视为已知问题。前任。 <For a long time, Prettier itself, which the
esbenp.prettier-vscode
extension for VS Code is built on, has had issues related to range formatting. It's had them in the past (fixed), still has them (not fixed), and more will probably keep being discovered. The maintainers say so themselves here. You can find a list by going through https://github.com/prettier/prettier/issues?q=is%3Aissue+is%3Aopen+range+.For examples for issue tickets in the
esbenp.prettier-vscode
extension's repo (which I found just by googling "site:github.com/prettier/prettier-vscode/issues format selection whole document
"), see #134 (June 2017), #137 (June 2017), #2041 (June 2021), #3145 (Sept 2023).Even historically, there have been releases of
esbenp.prettier-vscode
where certain setups would treat this as a known issue. Ex. 1.18.0: