ruby-on-rails - 当我在 vscode 中保存时,我在 .erb 文件中的 ruby 代码丢失了缩进
问题描述
我正在处理一个由设计生成的文件,当我保存更改时,整个代码自动格式化并且似乎丢失了缩进,我不知道如何描述它。
从此走
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
<div class="actions">
<%= f.submit "Update" %>
</div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
<%= link_to "Back", :back %>
对此
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
<div class="actions">
<%= f.submit "Update" %>
</div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
<%= link_to "Back", :back %>
我尝试使用 vscode 扩展安装https://github.com/ruby-formatter/rufoRufo - Ruby formatter
,但没有改变。
如何配置 vscode 以避免这种情况发生?
解决方案
推荐阅读
- c++ - 我怎样才能使 FFTW 希尔伯特变换计算得更快?
- html - 的奇怪行为
代替
- node.js - 目标入口点“@vcd/ui-components”缺少依赖项:
- java - android studio java使用蓝牙错误从arduino接收数据
- c++ - 关于 CMake 错误的问题:没有给目标提供源
- node.js - 从 sql 查询结果中删除 [TextRow]
- spring-boot - QueryDsl BooleanExpression - 嵌套字段为 NULL
- node.js - Puppeteer - 铬 | 无法打开 X 显示器 | Ubuntu 20.04
- angular - 角度垫选择和垫选项未显示
- javascript - 一次导入目录中的所有文件