pkgxdev / pkgx

run anything
https://pkgx.sh
Apache License 2.0
8.92k stars 1.36k forks source link

IDE Support for Rust #685

Open dcvz opened 1 year ago

dcvz commented 1 year ago

This is a "megaticket" of sorts for Rust support in IDE's. The issues encountered so far are:

dcvz commented 1 year ago

Investigation Details

STD Definitions in IDEs

std type referencing in IDE's happens by them referencing Rust's standard library definitions. In my research it seems that this can be defined by RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"

This std definitions are separately installed via rustup using rustup component add rust-src but this is something that tea's Rust is currently not providing. Some IDE's automatically will leverage rustup to find / install these.

Problem is if you use rustup, you first have to install a toolchain and these will be installed to .rustup/toolchains/XXX which is in conflict with tea trying to provide you a rust toolchain that lives in .tea/rust-lang.org

proc macros can't be expanded

The error on VSCode is: cannot find proc-macro server in sysroot. An issue filed seems to ask that the user checks the contents of their $(rustc --print sysroot)/libexec folder. This does not exist in the installation that .tea provides.

However installations done with rustup do include this folder, so https://github.com/teaxyz/pantry/pull/2796 should fix this as well.