Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » The formatter joins multiline string on a single line
The formatter joins multiline string on a single line [message #1687681] Thu, 19 March 2015 19:05 Go to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
Eclipse for PHP Developers
Version: Luna Service Release 2 (4.4.2)
Build id: 20150219-0600

When I have something like


$a = "aaaaaaaaaaaaaaaaaaaaaaaaa".
     "bbbbbbbbbbbbbbbbbbbb";


using CTR+SHIF+F results in
$a = "aaaaaaaaaaaaaaaaaaaaaaaaa" . "bbbbbbbbbbbbbbbbbbbb";

Imagine what happens to a long sql statement splitted in a proper way using ctrl+shif+f !!! Evil or Very Mad

I've already taken a look at every option in
preferences->php->code style->formatter
and
preferences->php->editor
and
preferences->General->editors

... but no luck.
hope there is an option other then @formatter:off Confused

Thanks in advance,
Rik

[Updated on: Thu, 19 March 2015 20:31]

Report message to a moderator

Re: The formatter joins multiline string on a single line [message #1688279 is a reply to message #1687681] Fri, 20 March 2015 12:13 Go to previous messageGo to next message
Dawid Pakula is currently offline Dawid PakulaFriend
Messages: 290
Registered: March 2013
Senior Member
No, now it's not possible to preserve new lines between operators.

Re: The formatter joins multiline string on a single line [message #1688349 is a reply to message #1688279] Fri, 20 March 2015 14:17 Go to previous messageGo to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
OH MY GOSH! It's incredible!
For every string I have to set on and off the format option?! Shocked

What is the criterion used by the decision makers of this "feature"?
What's for, a formatter that change this
$stm = 'CREATE TABLE queue(' . 
   'id INTEGER PRIMARY KEY,' . 
   'rec TEXT NOT NULL,' .
   'subject TEXT NOT NULL,' .
   'body TEXT NOT NULL,' .
   'headers TEXT NOT NULL);';


into a single line that need horizontal scroll? (Not in this forum because it's more intelligent than Eclipse)?
$stm = 'CREATE TABLE queue(' . 'id INTEGER PRIMARY KEY,' . 'rec TEXT NOT NULL,' . 'subject TEXT NOT NULL,' . 'body TEXT NOT NULL,' . 'headers TEXT NOT NULL);'

I can't do it. I give up.
Do you know a previous version without this problem?
Keplero? Juno? Or I'd better to restore the Indigo version I was using before this bad attemp with Luna?
Re: The formatter joins multiline string on a single line [message #1688352 is a reply to message #1688349] Fri, 20 March 2015 14:20 Go to previous messageGo to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
PS: I suggest to add the option: "Please, don't touch my string!" Very Happy
It will be very appreciated (and will avoid many migrations to Netbeans).
Re: The formatter joins multiline string on a single line [message #1688367 is a reply to message #1688352] Fri, 20 March 2015 14:54 Go to previous messageGo to next message
Dawid Pakula is currently offline Dawid PakulaFriend
Messages: 290
Registered: March 2013
Senior Member
Netbeans haven't as advanced formatter as we now Wink

Two options should fix your problem:
1. Initializer justification
2. Preserve new lines after "." operator

$x = "sdfsdf" .
"sdfsdfsdfsdf" .
"sf";

You can prepare enhancement request on bugzilla. If not I'll do it later.


Re: The formatter joins multiline string on a single line [message #1688407 is a reply to message #1688367] Fri, 20 March 2015 16:45 Go to previous messageGo to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
Quote:
Netbeans haven't as advanced formatter as we now Wink

Yes I know, but in a way, too much advanced could be harmful if its beyond certain limits and becomes annoying! Razz
It's a bit like the linux distros: Ubuntu+Unity it's surely modern and advanced, but just for this reason Ubuntu is now number 2 and Mint Mate is the nr 1.

For me, indigo+PDT was already the top.
I didn't need anything more.
Unfortunately once per decade it's necessary to upgrade (e.g. new php features not supported) and that's why I'm here with Luna... but I knew in advance that this migration it would be full of complications and basically nothing better because I didn't need another formatter, GTK graphics, etc.... by the way: gtk theme on Mint + NVidia sucks: when I try to move tabs it flicker both monitor and every windows. I've found a solution and I reported on my wiki
Eclipse Luna speed up and fix flickering

Quote:
Two options should fix your problem:
1. Initializer justification
2. Preserve new lines after "." operator
You can prepare enhancement request on bugzilla. If not I'll do it later.

OK, I'm going to try this solution first.

Thanks for you mega-help in any case.
Re: The formatter joins multiline string on a single line [message #1688411 is a reply to message #1688407] Fri, 20 March 2015 16:55 Go to previous messageGo to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
Ehm... I don't even find those options. I exported everything in xml to search the key words in a text editor, but I don't find them.
Is it in the PHP formatter or somewhere else? I continue to search...
Re: The formatter joins multiline string on a single line [message #1688416 is a reply to message #1688411] Fri, 20 March 2015 17:07 Go to previous messageGo to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
Uhm... maybe I misunderstood and
1. Initializer justification
2. Preserve new lines after "." operator
is what I have to ask as enhancement request on bugzilla? Rolling Eyes
Re: The formatter joins multiline string on a single line [message #1688420 is a reply to message #1688416] Fri, 20 March 2015 17:16 Go to previous messageGo to next message
Dawid Pakula is currently offline Dawid PakulaFriend
Messages: 290
Registered: March 2013
Senior Member
Hmm something like: "Improve string concat formatting" + example in description should be enough Wink

Re: The formatter joins multiline string on a single line [message #1688423 is a reply to message #1688420] Fri, 20 March 2015 17:23 Go to previous messageGo to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
I didn't understand if
1. Initializer justification
2. Preserve new lines after "." operator
is something already existing or is what I have to ask for.
Re: The formatter joins multiline string on a single line [message #1688424 is a reply to message #1688423] Fri, 20 March 2015 17:24 Go to previous messageGo to next message
Dawid Pakula is currently offline Dawid PakulaFriend
Messages: 290
Registered: March 2013
Senior Member
This is a potential way how this could be implemented. Ignore this Wink

Re: The formatter joins multiline string on a single line [message #1688427 is a reply to message #1688424] Fri, 20 March 2015 17:27 Go to previous messageGo to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
Ah ok. Have you any idea how many centuries it will take to be realised?
Re: The formatter joins multiline string on a single line [message #1688430 is a reply to message #1688427] Fri, 20 March 2015 17:35 Go to previous messageGo to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
... and any chance for a workaround (in the meantime) to have the PHP code formatter behaving like the HTML one, wrapping the strings in a way I don't have to scroll horizontally?
Re: The formatter joins multiline string on a single line [message #1688455 is a reply to message #1688430] Fri, 20 March 2015 18:44 Go to previous messageGo to next message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
Bug report created
https://bugs.eclipse.org/bugs/show_bug.cgi?id=462711
Re: The formatter joins multiline string on a single line [message #1688665 is a reply to message #1688455] Sat, 21 March 2015 10:13 Go to previous message
Rik Bartolini is currently offline Rik BartoliniFriend
Messages: 44
Registered: July 2010
Location: Italy
Member
Any workaround to remove completely the format rules on the code, but the indentation?
I actually prefer no code formatting except the indentation that helps when I loose manual control and there is a } that don't mach something.
Just as it was PDT 3.1

[Updated on: Sat, 21 March 2015 10:18]

Report message to a moderator

Previous Topic:Tasklist with TODO in code not working
Next Topic:Need help taking and displaying multiple photos on the same layout
Goto Forum:
  


Current Time: Wed Oct 09 23:32:04 GMT 2024

Powered by FUDForum. Page generated in 0.05348 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top