Hard/soft wrap on type & paste
I'm still having problems configuring my DataGrip to what I would like it to be.
Here is a screenshot:
I have hard wrap guideline but as I type I would like the code to wrap with breaking only on white space but without creating a new physical line (until I press enter manually).
Is it possible? I unchecked `hard wrap` setting but it doesn't seem to force the code to softly wrap
Please sign in to leave a comment.
what are your settings here File | Settings | Editor | General and here File | Settings | Editor | Code Style ? also it depends on 'Wrap elements' setting for each section here File | Settings | Editor | Code Style | SQL | General (or particular SQL dialect)
Here is the Code Style -> General SQL:
And Editor General
You need to enable 'Soft-wrap these files' and add *.sql to the list.
What if I'm just using console queries without saving them as *.sql files?
Actually console is a SQL file, you can find it in ''Files' tool window -> 'scratches and consoles' node.
Looks like in File -> Settings -> Editor -> General -> Console I do have soft wrap selected:
And it does not work?
Unfortunately not.
Here is a snippet of a query that I pased into a console window:
As you can see it goes over the line but even if I bring the window to that line, nothing wraps. Instead I'm getting a scroll:
and what if you do as I wrote above? it works for me.
What do you mean?
Any news on this? I still have problems with the wrapping - I want the code to always wrap to the size of the window.. Regardless if it be copy&paste, sql, or console
But I still can't make it work
So, if you set soft-wraps as below, you will get code fitting the available editor size and it will wrap strings only visually, you can check it on gutter with string numbers:
Hard-wrap works in different way - it will wrap strings upon they reach visual guide line(can be configured in 'Hard wrap at') when you call 'Reformat code' OR if you enable 'Wrap on typing' option, and this will be real new string:
I have hard wrap enabled at 120 and it still doesn't work. When I copy and paste a query to a console, I get one long line.
Bear in mind I don't want two physical lines (like a new parapgraph in text), I just want to visually wrap them, just like other IDEs do it
Soft wraps do not wrap the code to the available space, instead, the scrollbar is created:
There is also Active Editor: Soft-Wrap that you can enable (Shift+Shift) per console.
To make it work globally for all consoles make sure:
But this one only works on current window. I would have to do this every time I open a new console window. How to make it global?
Settings --> Editor --> General --> Soft-wrap-these files is ticked
Are you sure that you added *.sql pattern? Can you share a screenshot of Preferences | Editor | General?