in example like this:
select *
from USERS
where ACTIVE = 1
and USERNAME = #{userName}
and sysdate between nvl(START_DATE, sysdate) and nvl(END_DATE, sysdate)
field/table names suggestion work perfectly in ACTIVE section, but not in "sysdate between" section.
Literally suggestion does't work in any sql exactly after any named parameters #{...}
named parameter suggestion work in any place.
IntelliJ IDEA 2021.3.1 (Ultimate Edition)
MybatisX 1.5.2
make an investigation/debug.
it's false-positive in
com.baomidou.plugin.idea.mybatisx.system.contributor.SqlParamCompletionContributor:54
// 如果在#{}里面输入字符, 则阻断原生SQL提示
result.stopHere();
plugin should not go in that place.
my cursor is outside of {} bracket
it's seems, that plugin always go here after first { bracket and ignore closing one "}"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
com.baomidou.plugin.idea.mybatisx.system.contributor.SqlParamCompletionContributor.shouldAddElement() method do it wrong - it's definitely just seach pattern #{ before cursor but ignore }
it should be like that
private boolean shouldAddElement(PsiFile file, int offset) {
String text = file.getText();
for (int i = offset - 1; i > 0; i--) {
char c = text.charAt(i);
if (c == '}' ){ ////////////
return false; //////////// here is a new one piece of code
} /////////
if (c == '{' && (text.charAt(i - 1) == '#' || text.charAt(i - 1) == '$')) {
return true;
}
}
return false;
}
more of that - mybatis support ${} parameters too, edit my code in comment before
Any plan to merge that fix in code?? it's wary disappointing see it not merged after half a year.
登录 后才可以发表评论