在 VS Code 中为 dart 禁用自动格式化 [英] Disable autoformat in VS Code for dart

查看:44
本文介绍了在 VS Code 中为 dart 禁用自动格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想在我的应用程序上工作,但是当我保存时,文档突然自动格式化.昨天我没有问题,但现在我有.我已经通过自动格式化进行了检查,但这是关闭的.当我打开 VS Code 时,我收到一条消息,要求为默认语言或类似的语言设置 dart,也许这就是问题所在?

So i wanted to work on my app but suddenly when i save, the document autoformats. Yesterday i had no problems but now i have. I have checked by autoformatting but that is off. When i opened VS Code i got a message to set dart for default language or something like that, maybe that is the problem?

我想要这样:

      theme: ThemeData(
      backgroundColor: Colors.white70,
      primarySwatch: Colors.blue,
      brightness: Brightness.light
    ),

但我是这样理解的:

      theme: ThemeData(
      backgroundColor: Colors.white70,
      primarySwatch: Colors.blue,
      brightness: Brightness.light),

推荐答案

我遇到了和你一样的问题.我找不到修复它的方法,但有一种方法可以在不格式化的情况下保存代码.在 Windows 上,如果您依次单击 Ctrl + KCtrl + Shift + S,它将保存文件而不进行格式化.我不确定在 Mac 上,但如果您转到命令面板并搜索 save without format,它会向您显示执行此操作的快捷方式.希望这会有所帮助!

I am having the same problem that you have. I couldn't find a way to fix it but there is a way to save the code without formatting. On Windows, if you click Ctrl + K then Ctrl + Shift + S, it will save the file without formatting. I am not sure on Mac but if you go to command palette and search save without format, it will show you the shortcut to do it. Hope this helps!

这篇关于在 VS Code 中为 dart 禁用自动格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆