hashicorp / hashicorp/hcl

Empty lines in indented heredoc ruins the experience

Open
#258 0 comments 3 reactions 0 assignees View on GitHub
v1
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

When an indented heredoc contains an empty line, modern editors strip off all trailing whitespace, which then leaves all the leading whitespaces in.

Example:

```hcl
item = <<-EOF
foo

bar
EOF
```

### Expected behavior

It should act like `item = "foo\n\nbar\n"`

### Actual behavior

It acts like `item = " foo\n\n bar\n"`

### References
no known references

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the indented heredoc example from the issue, including the empty line, and inspect the heredoc parsing path in the HCL repository. Done means the example evaluates like "foo\n\nbar\n" rather than retaining indentation after the empty line; add or update coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.