ruby - Visual Studio Code 使用 HEREDOC 和单引号中断突出显示

标签 ruby visual-studio-code heredoc

当我使用那个波浪形的 heredoc 时,如果我在字符串中的某处放置单引号或双引号,Visual Studio Code 会弄乱语法突出显示。

代码可以找到,但 heredoc 下面的所有内容都是绿色的。

有什么办法可以解决这个问题吗?

enter image description here

最佳答案

作为替代方案,您可以使用 %() 语法,它在 VSCode 中得到了完美的突出显示。参见 https://commandercoriander.net/blog/2014/11/09/a-multiline-string-cheatsheet-for-ruby/

并在需要时使用 Rails.squish:https://api.rubyonrails.org/classes/String.html#method-i-squish

关于ruby - Visual Studio Code 使用 HEREDOC 和单引号中断突出显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52683352/

相关文章:

visual-studio-code - 当文本在另一次自动完成后突出显示时,VSCode 不会自动完成

linux - 多个 ssh 命令中的 cat 不起作用

c# - 无法在 VS Code 终端中创建 C# 控制台应用程序

linux - Bash 变量始终为空

linux - 如何使用输出分页 Heredoc 执行 SSH 命令

ruby - 从 Ruby : capturing the output while displaying the output? 运行 shell 命令

ruby - 基于 Ruby 中的列删除重复项

ruby-on-rails - 在 Rails 中创建 Action

ruby-on-rails - 在 Rails 中创建 2 个具有 has_one 关联的对象

angular - Visual Studio Code 在模板中找不到 Angular 变量的引用