0

Eclipse has a feature that makes it easy to separate a long message inside System.out.print. For example, when pressing enter inside the quotes in the following:

System.out.print("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");

Eclipse automatically splits it to:

System.out.print("Lorem ipsum dolor sit amet,"
           + " consectetur adipiscing elit,"
           + " sed do eiusmod tempor incididunt"
           + " ut labore et dolore magna aliqua.");

Is there a way to imitate this behaviour in Vscode?

AvidSeeker
  • 97
  • 2
  • 10
  • Does this answer your question? [Automatically hard wrap lines at column in VSCode](https://stackoverflow.com/questions/43122175/automatically-hard-wrap-lines-at-column-in-vscode) – Omar Abdel Bari Oct 09 '20 at 12:10
  • @OmarAbdelBari Partially. The solutions that I saw in the discussions were mainly about comments. In my case, I need to enter additional characters ( {"} then {Enter} then {+} then {"} ) At the same time have them indented to the same level. – AvidSeeker Oct 09 '20 at 12:22

1 Answers1

0

Here's the work around that I found. (Not the best solution)

CTRL + SHIFT + P > Configure user snippets > java.json,

Type the following snippet:

  "Java newline": {
"prefix": "nn",
"body": [
  "\"",
  "+ \""
],
"description": "Automatically inserts quotations and plus"}

When the cursor is inside 2 quotations, you can type nn then tab to get the desired result.

AvidSeeker
  • 97
  • 2
  • 10