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

如何让DataGrip识别PLSQL包/方法的注释并显示为快速文档?

如何让DataGrip识别PLSQL包/方法的特定注释并显示为快速文档?

之前用PHP开发时,特定注释风格可被IDE识别为包/方法的快速文档。现在用PLSQL开发,发现DataGrip会自动为表生成这类快速文档,想配置让它也将特定注释识别为PLSQL包/方法的快速文档,实现调用方法时hover显示注释内容。

示例代码:

create or replace package some_pack
/**  
 *  This method has a certain use
 *  @foo INT expects 0 = Testmode or 1 = Live 
 *  @bar VARCHAR2 team notice, leave null to skip the e-mail
 */
function some_method( foo in INT, bar in varchar2 DEFAULT null) return Int;


declare
  l_ret int;
begin
  /* 
   *  If I forgot how to use some_method 
   *  I could hover the method here and get my comment from the package displayed.
   */
  l_ret := some_pack.some_method(0,null);
end;

解决方案

  • 注释编写规范:必须使用/** ... */格式的块注释,放在包或方法定义的上方;参数注释采用@参数名 类型 描述的格式,DataGrip会自动解析这些内容。
  • 检查DataGrip设置:
    1. 打开Settings/Preferences(Windows/Linux按Ctrl+Alt+S,Mac按Cmd+,)
    2. 进入Languages & Frameworks > SQL > Dialects,确保项目SQL方言设置为Oracle
    3. 进入Editor > General > Code Completion,确认Show quick documentation on mouse move已勾选(默认开启)
  • 验证效果:按规范编写注释后,hover调用的方法时,DataGrip会展示注释中的方法描述和参数说明。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.02 23:46:00