Commit graph

109 commits

Author SHA1 Message Date
Lukas Wirth
8ce30264c8 cargo clippy --fix 2025-07-31 10:55:10 +02:00
Lukas Wirth
4d5bb86ad7 Abtract away json protocol for proc-macro-srv 2025-07-30 15:52:10 +02:00
Vincent Esche
a0e857f7bc Add fn load_workspace_into_db variant for ra_ap_load_cargo's fn load_workspace 2025-07-03 23:09:49 +02:00
Lukas Wirth
d1149cba49 fix: Do not warn about proc-macro srv when sysroot is missing 2025-07-03 11:51:31 +02:00
Lukas Wirth
e54759083a Restructure proc-macro loading erros, differentiate hard error property on kind 2025-07-03 09:28:53 +02:00
Lukas Wirth
9dfbd56bb8 feat: Show what cargo metadata is doing in status 2025-06-16 18:05:44 +02:00
Chayim Refael Friedman
4f54885901 Fix comparison of proc macros
Comparing the TypeId is not enough, they also contain data.
2025-06-12 13:31:55 +03:00
Lukas Wirth
091b7b2465 refactor: Remove unnecessary AsAny trait 2025-05-05 16:42:17 +02:00
Matthias Krüger
573c47c9ba remove a couple of clones 2025-05-01 11:41:42 +02:00
jyn
3b964a7105 allow using null to unset an environment variable
this makes three changes:
- all callsites of `toolchain::command` are changed to use
  `command(path, extra_env)`, instead of manually adding the env after
  the fact.
- all `map<str, str>` are changed to `map<str, option<str>>`.
- `command` checks for None and calls `env_remove` if so.

this caught several places where environment variables weren't being
propagated:
- when running `rustc --print=target-libdir`
- when running `cargo rustc -- --print=target-spec-json`
- when running the custom DiscoverLinkedProjects config. I *think* this
  is for use with non-cargo build systems, so I didn't change it.
2025-04-19 12:15:22 -04:00
BenjaminBrienen
2462624a7d prefer default over new 2025-04-04 15:49:50 +02:00
Lukas Wirth
faf1b49a9a fix: Fix, clarify and require a value for proc_macro_cwd of CrateData 2025-03-29 08:08:48 +01:00
Lukas Wirth
d4122434dd chore: Remove unused dependencies 2025-03-23 08:08:17 +01:00
BenjaminBrienen
7535bb4661 cargo fmt 2025-03-15 21:32:01 +01:00
Chayim Refael Friedman
c94e9efbef Salsify the crate graph
I.e. make it not one giant input but multiple, for incrementality and decreased memory usage for Salsa 3 reasons.
2025-03-12 21:02:30 +02:00
David Barsky
74620e64ec internal: port rust-analyzer to new Salsa 2025-03-10 13:30:51 -04:00
Arthur Baars
ded92f7552 Log build script error output in load_cargo::load_workspace_at 2025-03-07 16:07:56 +01:00
Mehul Arora
3a31741627 Use correct working directory for non-workspace proc-macro execution 2025-02-17 10:36:32 -05:00
Chayim Refael Friedman
549b49fdc8 Do not include excluded files even when the client opens them
This require a pretty big modification, because this is a new kind of file: exists - but ignore it.
2025-02-05 11:11:25 +02:00
David Richey
c0c7d5a2e1 Explicitly add buildfiles when constructing ProjectFolders 2025-01-24 09:59:06 -06:00
Lukas Wirth
52a6f430ef Partially back out "fix: Fix sourceroot construction for virtual manifests" 2025-01-16 10:02:26 +01:00
Chayim Refael Friedman
ceba289f80 Store token trees in contiguous Vec instead of as a tree
I expected this to be faster (due to less allocations and better cache locality), but benchmarked it is not (neither it is slower). Memory usage, however, drops by ~50mb (of `analysis-stats .`). I guess tt construction is just not hot.

This also simplifies using even less memory for token trees by compressing equal span, which I plan to do right after.

Some workflows are more easily expressed with a flat tt, while some are better expressed with a tree. With the right helpers, though (which was mostly a matter of trial and error), even the worst workflows become very easy indeed.
2025-01-02 19:21:46 +02:00
Lukas Wirth
b2d9486ebd Move proc-macro protocol into legacy module 2024-12-30 11:47:08 +01:00
Lukas Wirth
714b81bec1 Decouple proc-macro server protocol from the server implementation 2024-12-30 10:33:57 +01:00
Lukas Wirth
3d63140758 Remove salsa from proc-macro server dep tree 2024-12-18 10:24:26 +01:00
Lukas Wirth
ab46e97188 fix: Fix sourceroot construction for virtual manifests 2024-12-12 12:58:18 +01:00
Lukas Wirth
10a07a443d Fix config guard lock for ratoml tests 2024-12-09 09:33:02 +01:00
Ali Bektas
4fcecbb55e Watch for user config ratoml 2024-12-07 15:22:35 +01:00
Chayim Refael Friedman
4a06675e9c Gate #[test] expansion under cfg(test).
This will mean users opting to not activate `cfg(test)` will lose IDE experience on them, which is quite unfortunate, but this is unavoidable if we want to avoid false positives on e.g. diagnostics. The real fix is to provide IDE experience even for cfg'ed out code, but this is out of scope for this PR.
2024-09-30 00:12:45 +03:00
Chayim Refael Friedman
4ea09dd9f6 Provide an config option to not set cfg(test) 2024-09-30 00:12:45 +03:00
David Richey
85ca217765 Include buildfiles in vfs 2024-09-26 12:54:55 -04:00
Lukas Wirth
c2258d8880 Properly set the working directory for proc-macro execution 2024-09-11 12:23:12 +02:00
Lukas Wirth
db04f514f2 Lift out workspace related data into a separate query to preserve crategraph deduplication 2024-09-11 12:16:41 +02:00
bors
18414cdf64 Auto merge of #17864 - Veykril:lsif, r=Veykril
fix: Build and run build scripts in lsif command
2024-08-12 12:34:31 +00:00
Lukas Wirth
154a9a15db Build and run build scripts in lsif command 2024-08-12 14:33:11 +02:00
mo8it
3b560a550a Use Sender instead of boxed closure in vfs 2024-08-09 23:40:32 +02:00
Vincent Esche
7dec7e92ea Replace [package.repository] = "…" of published crates with [package.repository.workspace] = true 2024-08-06 00:26:42 +02:00
Vincent Esche
624f2ead7b Unify package descriptions by adding references to "rust-analyzer"
With the lack of a README on the individually published library crates and the somewhat cryptic `ra_ap_` prefix it is hard to figure out where those crates belong to, so mentioning "rust-analyzer" feels like auseful hint there.
2024-08-06 00:25:02 +02:00
Vincent Esche
6f329e6d5b Add repository URL for published crates' missing [package.repository] fields 2024-08-06 00:25:02 +02:00
Vincent Esche
b5b0f4bc5a Replace "TBD" with more helpful desciptions in published crates' [package.description] fields 2024-08-06 00:25:02 +02:00
bors
ce73b7cba2 Auto merge of #17771 - Veykril:parallel-vfs-config, r=Veykril
internal: Load VFS config changes in parallel

Simple attempt to make some progress f or https://github.com/rust-lang/rust-analyzer/issues/17373
No clue if those atomic orderings are right, though I don't think they are really too relevant either.

A more complete fix would probably need to replace our `ProjectFolders` handling a bit.
2024-08-05 14:07:22 +00:00
Lukas Wirth
f053b1aa6a feat: Load sysroot library via cargo metadata 2024-08-05 12:18:19 +02:00
Lukas Wirth
8286847bee internal: Load VFS config changes in parallel 2024-08-02 13:04:15 +02:00
Lukas Wirth
7beac14cba Internal: Cleanup proc-macro error handling 2024-07-26 14:38:19 +02:00
Ali Bektas
af88940dca minor changes 2024-07-23 15:50:12 +02:00
Ali Bektas
e0db833082 Read rust-analyzer.toml files on startup 2024-07-22 02:42:39 +02:00
bors
b333f85a9d Auto merge of #17639 - Veykril:salsa-perf, r=Veykril
Some more small salsa memory improvements

This does limit our lru limits to 2^16 but if you want to set them higher than that you might as well not set them at all. Also makes `LRU` opt-in per query now, allowing us to drop all the unnecessary LRU stuff for most queries
2024-07-19 18:45:16 +00:00
Lukas Wirth
8e3133f118 Reduce maximum LRU size to 2^16 entries, reducing memory footprint of LRU entries 2024-07-19 17:48:12 +02:00
David Barsky
db43a5a6e9 feature: move linked_projects discovery to the rust-analyzer server 2024-07-18 12:01:27 -04:00
Lukas Wirth
2346a80ab4 Remove Name::to_smol_str 2024-07-16 12:43:58 +02:00