如何让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设置:
- 打开
Settings/Preferences(Windows/Linux按Ctrl+Alt+S,Mac按Cmd+,) - 进入
Languages & Frameworks > SQL > Dialects,确保项目SQL方言设置为Oracle - 进入
Editor > General > Code Completion,确认Show quick documentation on mouse move已勾选(默认开启)
- 打开
- 验证效果:按规范编写注释后,hover调用的方法时,DataGrip会展示注释中的方法描述和参数说明。
内容的提问来源于stack exchange,提问作者Peter Frey
相关产品推荐
相关产品推荐

