Hi Suraj,

nice feature.
Just one suggestion.

Suraj Acharya wrote:
<snip/>

(defcustom jde-gen-complete-multi-line-string t "Typing enter at the end of a line with an unterminated string constant will result in the generation of the required string by adding a \\n character to the end of the line, closing the string, adding the string append operator (+) and starting a new string on the next line. Before: String a = \"This is a multi-line string ^ After: String a = \"This is a multi-line string\\n\" + \" ^" :type 'boolean )


According to SUN's Java Code Conventions section 4.2, the newline should be inserted before the operator. Therefore, the result should look like this:

  String a = "abc"
    + "
       ^

Additionally, I don't think, it is a good idea
to force a \n at the end of the string.
So, what about this additional check:
If the line ends with "\"\\(\\s-*\\+\\)?$"
- insert a newline
- indent
- insert "+ " if there is no (+) at the end of the previous line
- insert a quote
With this, I can avoid the \n by closing the string
before I hit enter.
This would also allow users to insist on the (+)
at the end of the line.

Regards,

Martin

Reply via email to