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

Helix crashes during editing of ERB files #3504

Closed
AlesLulak opened this issue Aug 22, 2022 · 3 comments · Fixed by #3527
Closed

Helix crashes during editing of ERB files #3504

AlesLulak opened this issue Aug 22, 2022 · 3 comments · Fixed by #3527
Assignees
Labels
A-tree-sitter Area: Tree-sitter C-bug Category: This is a bug upstream

Comments

@AlesLulak
Copy link

Summary

During working on Ruby on Rails project with ERB files, Helix freezes and then exits and indefinitely prints the following (I could not stop that, only closing the terminal helps.)

image

Note to Helix log: I don't have any files named text.html.erb in the project.

Reproduction Steps

I opened a required file with space + f which was created by touch.

Immediately pressed i to get into inserted mode. I wrote the following code:

<%= turbo_stream.replace 'scenarios' %>
<% end %>

Still being in the insert mode, I used ctrl + left arrow to get on the begging of the line, then pressed up arrow and then tab and added a character <. After < I wanted to write '%' and here the crash happens. So this is where it got stuck and crashed:

<%= turbo_stream.replace 'scenarios' %>
	<
<% end %>

Helix log

2022-08-18T12:22:02.566 helix_lsp::transport [ERROR] err <- "Solargraph is listening on stdio PID=11806\n"
2022-08-18T12:27:33.300 helix_view::editor [ERROR] Failed to initialize the LSP for source.toml { cannot find binary path }
2022-08-19T10:16:55.455 helix_lsp::transport [ERROR] err <- "Solargraph is listening on stdio PID=202627\n"
2022-08-19T11:58:43.747 helix_term::commands [ERROR] Shell error: touch: cannot touch 'app/views/scenarios/index.html.erb': No such file or directory

2022-08-19T11:59:26.933 helix_term::commands [ERROR] Shell error: touch: cannot touch 'app/views/scenarios/index.html.erb': No such file or directory

2022-08-19T12:00:33.030 helix_view::editor [ERROR] Failed to initialize the LSP for text.html.erb { LSP not defined }
2022-08-19T12:01:55.370 helix_view::editor [ERROR] Failed to initialize the LSP for text.html.erb { LSP not defined }
2022-08-22T10:15:49.998 helix_view::editor [ERROR] Failed to initialize the LSP for text.html.erb { LSP not defined }
2022-08-22T10:16:06.095 helix_view::editor [ERROR] Failed to initialize the LSP for text.html.erb { LSP not defined }
2022-08-22T10:16:26.594 helix_lsp::transport [ERROR] err <- "Solargraph is listening on stdio PID=33284\n"
2022-08-22T10:17:33.231 helix_view::editor [ERROR] Failed to initialize the LSP for text.html.erb { LSP not defined }
2022-08-22T10:19:52.862 helix_view::editor [ERROR] Failed to initialize the LSP for text.html.erb { LSP not defined }
2022-08-22T10:20:49.929 helix_view::editor [ERROR] Failed to initialize the LSP for text.html.erb { LSP not defined }
2022-08-22T10:24:25.646 helix_view::editor [ERROR] Failed to initialize the LSP for text.html.erb { LSP not defined }
2022-08-22T10:38:50.058 helix_view::editor [ERROR] Failed to initialize the LSP for text.html.erb { LSP not defined }

Platform

Linux (Ubuntu 20.04.1 LTS)

Terminal Emulator

xterm-256color

Helix Version

helix 22.05 (c18b542)

@AlesLulak AlesLulak added the C-bug Category: This is a bug label Aug 22, 2022
@the-mikedavis
Copy link
Member

This looks like the same issue as #2997 and #3376 but for the ruby scanner. I don't think it's fixed yet on master in tree-sitter-ruby. I can make a PR later today.

I'll also look around in the grammar sources directory to see if we can find scanners that break on tree-sitter v0.20.8 proactively. There may be a few that need to have their scanners patched.

@the-mikedavis the-mikedavis self-assigned this Aug 22, 2022
@the-mikedavis
Copy link
Member

This loop is slightly different than the others (it looks like tree-sitter isn't repeatedly querying the external scanner here like the others) but tree-sitter-ruby master provides a fix so we should just need to update.

@phillipspc
Copy link
Contributor

phillipspc commented Jan 14, 2023

I'm still encountering freezes in the manner described by the original post. (ie. happens when I type < and then % in an html.erb file, where the % never actually goes through).

Update: for anyone else who comes across this, a decent work around (that someone else posted here as well) for the time being is to add some custom auto-pairs to your ERB language configuration:

# languages.toml
[[language]]
name = "erb"

[language.auto-pairs]
'<' = '>'
'%' = '%'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tree-sitter Area: Tree-sitter C-bug Category: This is a bug upstream
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants