TL;DR run mach ide vscode to get code completion, go-to definition, etc.
for XPCOM, windows-rs, and other build generated Rust code.

What Changed
rust-analyzer previously did not recognize code outside of the source and
cargo build directories as there was no mechanism for populating its VFS
after construction, and include!()s and other source analysis didn't occur
until after the VFS was populated. In our case this prevented rust-analyzer
from recognizing XPCOM and Glean generated code which are located outside
of crate build directories, and windows-rs which is downloaded separately
from source.

With this PR <https://github.com/rust-lang/rust-analyzer/pull/18880>
rust-analyzer was extended with the config rust-analyzer.vfs.extraIncludes
<https://rust-analyzer.github.io/manual.html#rust-analyzer.vfs.extraIncludes>
which allows explicitly extending the list of directories added to the VFS.
With this revision <https://phabricator.services.mozilla.com/D233589>
support for the config was added for both the build and windows-rs
directories with mach ide vscode.

Known Issues
Go-to definition for XPCOM interface names will navigate to the include!()ing
file instead of the definition itself. All other content for the interface
- i.e. constants, methods, and attributes - resolves correctly to the
generated source. This is likely a result of our include!()s in include!()s
layout.

Additionally navigating to *very* large generated files - notably those
generated by Glean - can result in rust-analyzer running exponentially
slower. Bug tracked here
<https://github.com/rust-lang/rust-analyzer/issues/18879>.

Happy Oxidizing!
Nicholas

-- 
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CAPZ0VW-eRWjj7KdnsYECsWLqzyr5w49m13utMptdvuFB%2Bkjy2g%40mail.gmail.com.

Reply via email to