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

fmt: broken mutliline raw string formatting #743

Closed
Sneeezu opened this issue May 18, 2024 · 0 comments · Fixed by #765
Closed

fmt: broken mutliline raw string formatting #743

Sneeezu opened this issue May 18, 2024 · 0 comments · Fixed by #765
Labels
bug Something isn't working fmt help wanted Extra attention is needed NeedsInvestigation Issue needs some investigation before being fixed

Comments

@Sneeezu
Copy link

Sneeezu commented May 18, 2024

templ version: v0.2.680

When formatting a multiline raw string inside of an argument the content of the string gets indented every time you format the code.

This code:

templ something(stuff string) {
	{ stuff }
}

templ someOtherTemplate() {
	@something(`Hi
some cool text

foo 

bar

		`)
}

Gets formatted to this:

templ something(stuff string) {
	{ stuff }
}

templ someOtherTemplate() {
	@something(`Hi
	some cool text
	
	foo 
	
	bar
	
			`)
}

And that code to this:

templ something(stuff string) {
	{ stuff }
}

templ someOtherTemplate() {
	@something(`Hi
		some cool text
		
		foo 
		
		bar
		
				`)
}

This repeats every time you format.

@joerdav joerdav added bug Something isn't working help wanted Extra attention is needed fmt NeedsInvestigation Issue needs some investigation before being fixed labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fmt help wanted Extra attention is needed NeedsInvestigation Issue needs some investigation before being fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants