-
Notifications
You must be signed in to change notification settings - Fork 17
ERB injection for other source languages #113
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
ERB injection for other source languages #113
Conversation
I wonder if @marcoroth has thoughts on this given his HERB work. |
I wonder if unmatched |
I think because YAML is a built-in language server, it will actually need to be associated in this file. https://github.com/zed-industries/zed/blob/a067c16c823354da63966273ac15d1aa93c0e922/crates/languages/src/lib.rs#L98 |
bd59c30
to
2848538
Compare
There’s one more problem that’s come up. The language ID is being passed through to Ruby LSP as We will need a way to map I think this will require upstream changes in the zed_extension_api crate. Here is an example of the RPS message with the wrong languageId.
|
Looks like this was already supported, I just need to add the mappings. So the final issue is that the YAML language server isn’t being enabled, but that has to be fixed in the main Zed repo. |
cbf7fe6
to
1f93916
Compare
1f93916
to
9b7fc09
Compare
@joeldrapper Thanks! This awesome improvement works like a charm! |
There was a bug in zed_extension_cli that prevented debug adapters in extensions from being successfully registered. zed_extension_cli has been fixed (zed-industries/extensions#2927), but we need to bump the version of this and the Swift extension so they'll get rebuild and republished using the fixed CLI. This version includes: - #119 - #111 - #113
This version includes: - zed-extensions/ruby#119 - zed-extensions/ruby#111 - zed-extensions/ruby#113 Also, as a result of rebuilding the extension with #2927, the new rdbg debug adapter will be registered successfully.
ERB can be used to template any kind of source file — not just HTML. However, it’s most commonly used for generating HTML, YAML and Ruby source.
This PR updates the
ERB
language to be more generic, treating.erb
files as plain text with Ruby injections within the ERB template tags.It then introduces two new languages:
HTML/ERB
andYAML/ERB
, which handle switching between HTML and Ruby and YAML and Ruby respectively.I attempted to make a specialised language for
Ruby/ERB
, but couldn’t get past some basic syntax highlighting issues. I think it’s quite reasonable to highlight.rb.erb
files as plain text with Ruby inside the ERB tags since it would be very difficult to guess at how the generated Ruby will look structurally. It’s certainly an improvement on treating it like HTML.I’ve configured mappings from
ERB
,HTML/ERB
andYAML/ERB
for Ruby LSP, which will handle them all aserb
. I’ve also updated the Herb LSP to handleHTML/ERB
files specifically.Next steps
I would be nice if the YAML language server was configured to run on
YAML/ERB
files. I believe this can be done by updating this file.However, I don’t think this is a blocker as most YAML/ERB files are actually named
.yml
not.yml.erb
and so will be treated as regular old YAML files.