typstfmt
typstfmt copied to clipboard
Remove linebreaks within a paragraph when performing auto formatting
First thanks for this great extension!
I am using this extension with VSCode. When performing file formatting, automatic linebreaks will be inserted to break a paragraph, leaving a weired display of multiple lines with different length. Is it possible to keep one paragraph as a single line (in the sense that only one line number for one paragraph in VSCode) and leave the 'linebreak' to the word wrap function from VSCode?
Example
This is what initially put in VSCode editor, and what I want as the whole paragraph is one line (line 34).
This is what I got after applying formatting through Typst LSP. One paragraph got broken into multiple lines (line 34-47).
Did you tried setting line_wrap to false?
Not sure where this parameter is, since I did not specifically install typstfmt and assume typst lsp used it inherently.
Besides, I don't think line-wrap and linebreak are the same thing. line-wrap determines how the editor displays the code and has nothing to do with real linebreak.
This is the right place for this ! :)
line_wrap option is exactly what you're looking for but it's a bit tedious to setup with typst-lsp, you have to have a typstfmt config file local to your project.
it's a problem with two solutions:
- disable linewrap per default for the next release
- better config handling in typst-lsp
I would vote for better integration with typst-lsp. Maintaining a local file for each project is tedious.
FYI, I did find below section in typst-lsp's 'package.json' file. If set wordWrap to off, the whole paragraph will be displayed as literally one line without wrap. But automatic formatting through typst-lsp still break it into lines with multiple line numbers.
"configurationDefaults": {
"[typst]": {
"editor.wordWrap": "on",
"editor.semanticHighlighting.enabled": true,
"editor.tabSize": 2
}
},