jetbrains-ide - Highlight SQL queries inside of YAML file in Goland
问题描述
Goland has a beautiful highlighting mechanism for SQL queries in Go code.
It looks like this:
You can use auto complete option to specify columns and table names. But if you'll move all you queries to configuration file (yaml file in my case), Goland stops highlighting your SQL queries.
Is there an option to enable SQL query highlighting for any specified file type?
解决方案
Accordingly to this IDEA-51664 ticket you should be able to create a custom Language Injection rule in YAML files .. but I personally do not see how it can be done.
At the same time, you can manually inject any language into a value string inside the YAML file. It will be a temporal injection though (will last for one session or so). For this:
- Place caret inside such string
- Invoke "Quick Fix / Show Context Actions" menu (Alt + Enter on Windows/Linux in most keymaps)
Choose
Inject language or reference
actionSelect desired language from a list (use
SQL
to inject current SQL Dialect for that scope (file/folder) or justGeneric SQL
if you do not need specific DB checks etc).Final result:
推荐阅读
- flutter - 在 Flutter 中使用蓝牙打印机打印图像
- svg - Firefox:动画 SVG 半径仅适用于百分比
- eclipse - 如何找到导致修改代码某些部分的 SVN 分支或提交
- simulation - Anylogic 可以与 VR 设备集成吗?
- css - 下一个课后没有播放css动画
- javascript - 为 HH:MM:SS 制作 2 位倒数计时器
- json - 如何使用 v-for 获取本地 json 文件打印 1 个对象
- python - 使用 Django Rest 框架更新 ImageField
- python - 如何随机化列表中的函数?
- xml - 使用 xslt 交换元素或子树的位置