Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require the beginning tag of multiline string to be followed by newline #5950

Open
Tracked by #40488
CarpenterBlue opened this issue Dec 17, 2022 · 6 comments
Open
Tracked by #40488

Comments

@CarpenterBlue
Copy link

Describe the project you are working on

I am writing dialogues for my game into variables stored on a resource.
(Not using Exports.)

Describe the problem or limitation you are having in your project

The syntax expects the body of the text to immediately follow the three quotation marks like this:
image
This makes the first line harder to read and if the user wants to have all text easily readable they are left with whitespace at the beginning. This in my opinion kind of defeats the purpose of the multiline strings.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The syntax should require the newline or at least ignore the first newline in the final string.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

The syntax now requires a newline after the 3 quotation marks.
image

If this enhancement will not be used often, can it be worked around with a few lines of script?

No this can't be worked around with a script.

Is there a reason why this should be core and not an add-on in the asset library?

This seems like it cannot be done with an add-on.

@Calinou
Copy link
Member

Calinou commented Dec 17, 2022

Related to #5794.

I'm personally not fond of requiring a newline in all situations for multiline strings, as it feels too much like magic and is not consistent with how other languages' multiline strings behave.

@YuriSizov
Copy link
Contributor

Pretty sure you can trim the contents of the variable before you use it, to remove any excessive formatting that it may contain, both whitespaces and newlines.

@CarpenterBlue
Copy link
Author

image
I guess this works despite how clunky it looks.

@Mickeon
Copy link

Mickeon commented Dec 19, 2022

No this can't be worked around with a script.

This specific proposal cannot, but the solution to the issue you're experiencing definitely can.

You know, you may only require strip_edges() when you actually use the dialogue (before displaying it in the text box), not at the declaration of the variable. This would cover all cases, while not particularly being needlessly verbose.

@CarpenterBlue
Copy link
Author

No this can't be worked around with a script.

This specific proposal cannot, but the solution to the issue you're experiencing definitely can.

You know, you may only require strip_edges() when you actually use the dialogue (before displaying it in the text box), not at the declaration of the variable. This would cover all cases, while not particularly being needlessly verbose.

Untrue, I require whitespace at the beginning sometimes.

@TheDuriel
Copy link

Not a fan since, magic.

Also, in projects where this becomes an issue. I fully believe that exporting or otherwise abstracting how you handle large amounts of multi line text, is a requirement. Be it by exporting, resources, translation strings, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants