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

Don't truncate actual characters out of snippets #242

Conversation

johanandren
Copy link
Contributor

Fixes #241

Copy link
Member

@ennru ennru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an immediate cure to avoid text being thrown away, but it might lead to a strange code layout in the snippets.
So with multi-snippet use, switching off the formatter will still be required to get a nice layout.

@ennru
Copy link
Member

ennru commented Sep 5, 2018

Relates to #228

|<pre class="prettyprint">
|<code class="language-scala">
|object AnotherIndentedExample {
|def rendered(): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ennru Do you mean this, that the inner indentation is lost here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think best would be to base indentation off the indentation of the following non-empty line or something like that rather? But I don't think it is possible to get a solution that works for all use-cases without having some extra flags for deciding if to keep indent level or drop (the imports + main method contents vs "normal" code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I want to jump into trying to fix that here though, I just want to make sure no actual characters except whitespace is truncated for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just a note on what this gives. Not cutting text is the best solution for now. @2m and I discussed some interplay of code formatters and this snippet cutting, but we didn't have this case.

Copy link
Member

@ennru ennru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@johanandren johanandren merged commit 70aa761 into lightbend:master Sep 5, 2018
@johanandren johanandren deleted the wip-241-snippet-left-truncation-johanandren branch September 5, 2018 13:25
ennru added a commit that referenced this pull request Sep 11, 2018
This rolls back the snippet indentation logic introduced by #201. But has special handling for `import` lines, so that they become aligned with the left-most code in other snippets with the same label.

Relates to:
akka/akka#25564
#242
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants