Skip to content

Fix loading of mode-rust.js #2710

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

Merged
merged 1 commit into from
May 23, 2025
Merged

Fix loading of mode-rust.js #2710

merged 1 commit into from
May 23, 2025

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented May 23, 2025

The reason the ACE editor was failing to load the rust syntax highlighting is because the syntax highlighting was being created after the editor was created. If the editor is created first, then ACE tries to load ace/mode/rust. Since it isn't already defined, it tried to compute the URL and load it manually. However, since the URLs now have a hash in it (via #1368), it was unable to load.

The solution here is to make sure ace/mode/rust is defined before creating the editors. Then ACE knows that it can just load the module directly instead of trying to fetch it from the server.

Fixes #2700

The reason the ACE editor was failing to load the rust syntax
highlighting is because the syntax highlighting was being created
*after* the editor was created. If the editor is created first, then ACE
tries to load `ace/mode/rust`. Since it isn't already defined, it tried
to compute the URL and load it manually. However, since the URLs now
have a hash in it (via rust-lang#1368),
it was unable to load.

The solution here is to make sure `ace/mode/rust` is defined before
creating the editors. Then ACE knows that it can just load the module
directly instead of trying to fetch it from the server.

Fixes rust-lang#2700
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label May 23, 2025
@ehuss ehuss added this pull request to the merge queue May 23, 2025
Merged via the queue into rust-lang:master with commit 179bd8d May 23, 2025
14 checks passed
@GuillaumeGomez
Copy link
Member

Much better fix, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: waiting on a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mode-rust.js is not found
3 participants