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

LSP auto-format breaks documentation due to wrapping #4669

Closed
andreystepanov opened this issue Feb 5, 2024 · 2 comments · Fixed by #4670
Closed

LSP auto-format breaks documentation due to wrapping #4669

andreystepanov opened this issue Feb 5, 2024 · 2 comments · Fixed by #4670
Assignees

Comments

@andreystepanov
Copy link

Recent LSP auto-format feature breaks documentation in specific cases.

Here's a quick example of one of them:

issue.doc = {{
    Ea et fuga incidunt expedita non et recusandae. Consequatur doloremque excepturi et nesciunt officia doloremque odio similique. Saepe porro rerum aliquam consequatur et quia. Asperiores accusantium sed assumenda temporibus debitis.

    **Ea et fuga incidunt expedita non et recusandae. Consequatur doloremque excepturi et nesciunt officia doloremque odio similique. Saepe porro rerum aliquam consequatur et quia. Asperiores accusantium sed assumenda temporibus debitis.**
}}

After formatting applied by LSP it becomes:

issue.doc = {{
    Ea et fuga incidunt expedita non et recusandae. Consequatur doloremque excepturi et nesciunt 
    officia doloremque odio similique. Saepe porro rerum aliquam consequatur et quia. Asperiores 
    accusantium sed assumenda temporibus debitis.

    **Ea et fuga incidunt expedita non et recusandae. Consequatur doloremque excepturi et nesciunt 
    officia doloremque odio similique. Saepe porro rerum aliquam consequatur et quia. Asperiores a 
    ccusantium sed assumenda temporibus debitis.**
}}

As you can see officia... and accusantium... are places on separate line, and as a result it breaks italic text formating in the beginning of the paragraph (**Ea et...), so ucm complains.

offset=1055:
unexpected "<newline>excepturi et "
expecting "**", "@eval", "@foldedSource", "@inlineSignature", "@signature", "@signatures", "@source", code (examples: ''**unformatted**'', `words` or '''_words_'''), hyperlink (example: [link name](https://destination.com)), inline code (examples: ``List.map f xs``, ``[1] :+ 2``), link (examples: {type List}, {Nat.+}), or transclusion (examples: {{ doc2 }}, {{ sepBy s [doc1, doc2] }})

And in order to fix it and commit changes to database i would need to disable auto-format or lsp altogether.

@ChrisPenner
Copy link
Contributor

Thanks for the detailed bug report! 😄
This should have it patched up soon, sorry for the trouble,

#4670

@andreystepanov
Copy link
Author

Thank you for a quick fix, @ChrisPenner 🙏

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

Successfully merging a pull request may close this issue.

3 participants