How do I stop SQL splitting string literals when I press Enter in DataGrip or IntelliJ Database Editor?

本秂侑毒 提交于 2021-02-07 12:14:01

问题


When my cursor is after an open quote in a SQL statement in an IntelliJ database console and I press Enter, it closes the quote on the current line and adds a concatenation symbol with an open quote on the newline.

I disabled formatting the SQL code style settings but that didn't fix it for me.

UPDATE blah SET blah2 = 'something<pressed enter>' ||
  '<argh!>...';

Is there a way to disable this autoformatting?


回答1:


This request was addressed in 2017.1 version, as a result, Insert string concatenation on Enter setting was added specifically for SQL:




回答2:


This can be archived since IntelliJ 13. You simply need to wrap your code with

// @formatter:off

your code goes here

// @formatter:on 

Since IntelliJ Idea 15-16(pardon if i'm wrong), you can also make permanent set up by Preferences > Editor > Code Style option

Hope it helps



来源:https://stackoverflow.com/questions/42864012/how-do-i-stop-sql-splitting-string-literals-when-i-press-enter-in-datagrip-or-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!