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

 

16 comments
Comment actions Permalink

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)

0
Comment actions Permalink

Here is the Code Style ->  General SQL:

And Editor General

0
Comment actions Permalink

You need to enable 'Soft-wrap these files' and add *.sql to the list.

0
Comment actions Permalink

What if I'm just using console queries without saving them as *.sql files?

0
Comment actions Permalink

Actually console is a SQL file, you can find it in ''Files' tool window -> 'scratches and consoles' node.

0
Comment actions Permalink

Looks like in File -> Settings -> Editor -> General -> Console I do have soft wrap selected:

 

0
Comment actions Permalink

And it does not work?

0
Comment actions Permalink

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:

0
Comment actions Permalink

and what if you do as I wrote above? it works for me.

0
Comment actions Permalink

What  do you mean?

0
Comment actions Permalink

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

0
Avatar
Yuriy Vinogradov
Comment actions Permalink

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:

 

0
Comment actions Permalink

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:

0
Comment actions Permalink

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:

  • You enable Soft-wrap for these lines in Preferences | Editor | General.
  • That setting contains the pattern: *.md; *.txt; *.rst; *.adoc; *.sql (pay attention that *.sql is added here)
  • Query Console re-opened. It is crucial to apply changes.
0
Comment actions Permalink

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

0
Comment actions Permalink

Are you sure that you added *.sql pattern? Can you share a screenshot of Preferences | Editor | General?

0

Please sign in to leave a comment.