You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio Code中如何让SQL Formatter兼容.hql文件?

让SQL Formatter支持.hql文件的解决办法
  • VS Code 配置
    如果你用VS Code的SQL Formatter插件,只需把.hql文件关联为SQL类型:

    1. 打开设置(快捷键Ctrl+,),搜索files.associations
    2. 添加如下配置:
      "files.associations": {
        "*.hql": "sql"
      }
      

    之后打开.hql文件,就能直接用SQL Formatter的格式化功能,输出你偏好的风格。

  • CLI 工具处理
    用node.js的sql-formatter命令行工具的话,可直接指定Hive语言来格式化.hql文件:

    1. 全局安装工具:npm install -g sql-formatter
    2. 格式化单个文件:sql-formatter --language hive --output formatted.hql input.hql
    3. 批量处理可以写个shell脚本,遍历目标目录下的所有.hql文件执行格式化命令。
  • JetBrains IDE 适配
    在IntelliJ、DataGrip这类IDE中:

    1. 进入File > Settings > Editor > File Types
    2. 找到SQL类型,在"Registered Patterns"里添加*.hql
    3. 之后就能用SQL Formatter相关的功能处理.hql文件了。

内容的提问来源于stack exchange,提问作者gosia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 23:57:01