# ruby: Capture the heredoc content only and downcase the language \(\#12532\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/660cf214c706fe9a247a326ec6814f86789687d9)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 660cf214c706fe9a247a326ec6814f86789687d9

Requested commit: 660cf214c706fe9a247a326ec6814f86789687d9

Commit: 660cf214c706fe9a247a326ec6814f86789687d9

Tree: 2fd4f5e70844add33c139b76093cae692b4e0193

Author: Vitaly Slobodin

Committer: GitHub

## Message

````
ruby: Capture the heredoc content only and downcase the language (#12532)

# Summary

Hi. Current `heredoc` injection for Ruby language captures the
`heredoc_end` token. That's a bit incorrect because we want to capture
the content only. Suppose we have the following Ruby code:

```ruby
<<~JS
  function myFunc() {
    const myConstant = [];
  }

  let a = '1'
JS
```

And this is its syntax tree:

```
[program] [0, 0] - [7, 0]
  [heredoc_beginning] [0, 0] - [0, 5]
  [heredoc_body] [0, 5] - [6, 2]
    [heredoc_content] [0, 5] - [6, 0]
    [heredoc_end] [6, 0] - [6, 2]
```

Current injection capture all content of the `heredoc_body`:

![CleanShot 2024-05-31 at 17 03
31@2x](https://github.com/zed-industries/zed/assets/1894248/ff8c5195-b532-42d2-91b1-48405a6d3b50)

But we want to capture the `heredoc_content` only and this PR resolves
that, additionally it downcases the language like Zed does in other
languages like Terraform.

![CleanShot 2024-05-31 at 17 05
17@2x](https://github.com/zed-industries/zed/assets/1894248/e81dabd0-3246-4ef2-9524-a7adcb9242ab)


Release Notes:

- N/A
````

## Parents

- [b2565fadfbcd2e292bc556d9b6b5a0c58099d82b](https://git.cafe/gitcafe/zed/commit/b2565fadfbcd2e292bc556d9b6b5a0c58099d82b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/660cf214c706fe9a247a326ec6814f86789687d9?format=markdown)
