question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autoclose multiline strings (JEP 368)

See original GitHub issue

Typing """ should automatically insert a new line, indent the cursor position to below the opening quotes, and finally autoclose with a triple quote eg:

String foo = """|

autocloses/completes to (displaying spaces):

String foo = """
.............|
............."""

See https://openjdk.java.net/jeps/368 for more details.

@aeschli any pointers on the best way to achieve that?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
fbriconcommented, Mar 4, 2022

@rgrunber not worth doing imo

1reaction
tommai78101commented, May 1, 2020

While you’re at it, can I request that you enclose the center region of text in a C-style indentation?

String foo = """|

will turn into this after pressing Enter key:

String foo = """
....|
"""

Where the center region’s indentation is based on the user-configured indentation size (1, 2, 4, or custom sized indents).

Otherwise, I think this would actually make the enclosures go a bit wild:

String testStringVariableForSpringJUnitMockito_WithMultiLineValues = """|

Would turn into this upon pressing Enter key:

String testStringVariableForSpringJUnitMockito_WithMultiLineValues = """
....................................................................|
....................................................................."""
Read more comments on GitHub >

github_iconTop Results From Across the Web

Text Blocks (JEP 368). In Java writing multi line strings is…
Ease to write multi line strings · Remove escape sequence and enhance readability · Handle white spaces and indentation intelligently ...
Read more >
Does Java have support for multiline strings? - ...
Multiline Strings are now supported in Java via Text Blocks. In Java 13 and 14, this feature requires you to set the ––enable–preview...
Read more >
Java multi-line string, text blocks
This article shows you how to declare a multi-line string in Java, including the new Java 8 and Java 14 text blocks """....
Read more >
Java 14 - Text Blocks (Second Preview)
JEP 368 – Text Blocks ... In Java 13, JEP 355 allows you to create a multiline string or you can say a...
Read more >
Please, Java. Do Finally Support Multiline Strings : r/programming
In C#, @"" is a half-assed stab at multiline strings though; you can't enter ... Stringing out SQL queries is close to primitive...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found