mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
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`:

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.

Release Notes:
- N/A
This commit is contained in:
parent
b2565fadfb
commit
660cf214c7
1 changed files with 3 additions and 1 deletions
|
|
@ -1,2 +1,4 @@
|
|||
(heredoc_body
|
||||
(heredoc_end) @language) @content
|
||||
(heredoc_content) @content
|
||||
(heredoc_end) @language
|
||||
(#downcase! @language))
|
||||
|
|
|
|||
Loading…
Reference in a new issue