-
Notifications
You must be signed in to change notification settings - Fork 77
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
Don't truncate actual characters out of snippets #242
Conversation
tests/src/test/scala/com/lightbend/paradox/markdown/SnipDirectiveSpec.scala
Show resolved
Hide resolved
There was a problem hiding this 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.
Relates to #228 |
|<pre class="prettyprint"> | ||
|<code class="language-scala"> | ||
|object AnotherIndentedExample { | ||
|def rendered(): Unit = { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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
Fixes #241