Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Remove linebreaks within a paragraph when performing auto formatting #163

Open
yjcui opened this issue Mar 29, 2024 · 4 comments
Open

Remove linebreaks within a paragraph when performing auto formatting #163

yjcui opened this issue Mar 29, 2024 · 4 comments

Comments

@yjcui
Copy link

yjcui commented Mar 29, 2024

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).
image

This is what I got after applying formatting through Typst LSP. One paragraph got broken into multiple lines (line 34-47).
image

@FlandiaYingman
Copy link

Did you tried setting line_wrap to false?

@yjcui
Copy link
Author

yjcui commented Mar 29, 2024

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.

@astrale-sharp
Copy link
Owner

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

@yjcui
Copy link
Author

yjcui commented Mar 29, 2024

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
			}
		},

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

No branches or pull requests

3 participants