Commit graph

285 commits

Author SHA1 Message Date
Wilfred Hughes
3cf28f1fc6 fix: Updating settings should not clobber discovered projects
`linkedProjects` is owned by the user's configuration, so when users
update this setting, `linkedProjects` is reset. This is problematic when
`linkedProjects` also contains projects discovered with `discoverCommand`.

The buggy behaviour occurred when:

(1) The user configures `discoverCommand` and loads a Rust project.

(2) The user changes any setting in VS Code, so rust-analyzer receives
`workspace/didChangeConfiguration`.

(3) `handle_did_change_configuration` ultimately calls
`Client::apply_change_with_sink()`, which updates `config.user_config`
and discards any items we added in `linkedProjects`.

Instead, separate out `discovered_projects_from_filesystem` and
`discovered_projects_from_command` from user configuration, so user
settings cannot affect any type of discovered project.

This fixes the subtle issue mentioned here:
https://github.com/rust-lang/rust-analyzer/pull/17246#issuecomment-2185259122
2024-09-05 15:46:03 -07:00
Lukas Wirth
2e2f798a74 minor: Downgrade cyclic deps error to warning 2024-09-01 10:02:41 +02:00
Laurențiu Nicola
5f7bda743f Fix cwd used for proc macro expansion 2024-08-28 13:20:21 +03:00
bors
06a40a61b0 Auto merge of #17973 - Veykril:proc-macro-curr-dir, r=Veykril
Expand proc-macros in workspace root, not package root

Should fix https://github.com/rust-lang/rust-analyzer/issues/17748. The approach is generally not perfect though as rust-project.json projects don't benefit from this (still, nothing changes in that regard)
2024-08-27 11:53:04 +00:00
Lukas Wirth
9a47e6f2c8 Expand proc-macros in workspace root, not package root 2024-08-27 13:40:24 +02:00
bors
f4dbbac7ca Auto merge of #17956 - Veykril:metadata-err, r=Veykril
fix: Fix metadata retrying eating original errors
2024-08-25 07:30:09 +00:00
Lukas Wirth
191949eabe fix: Fix metadata retrying eating original errors 2024-08-25 09:28:47 +02:00
bors
ae420e353e Auto merge of #17857 - ChayimFriedman2:rust-project-cfg-group, r=Veykril
feat: Allow declaring cfg groups in rust-project.json, to help sharing common cfgs

Closes #17815.
2024-08-23 10:01:35 +00:00
Lukas Wirth
3c4cdbbd1a Improve documentation for InvocationStrategy 2024-08-19 14:23:05 +02:00
Victor Song
b0f20c7deb chore(config): remove invocationLocation in favor of invocationStrategy
These flags were added to help rust-analyzer integrate with repos
requiring non-Cargo invocations. The consensus is that having two
independent settings are no longer needed. This change removes
`invocationLocation` in favor of `invocationStrategy` and changes
the internal representation of `InvocationStrategy::Once` to hold
the workspace root.
2024-08-19 02:25:40 -05:00
Lukas Wirth
07c1b83e98 feat: Make rust-analyzer work partially when missing an internet connection 2024-08-17 19:14:46 +02:00
Chayim Refael Friedman
2607c09fdd Allow declaring cfg groups in rust-project.json, to help sharing common cfgs 2024-08-12 22:03:16 +03:00
winstxnhdw
c2ee843b31
minor: log error when sysroot can't be discovered 2024-08-09 03:50:48 +08:00
Lukas Wirth
6bb29b1b54 Split up flycheck module 2024-08-08 13:08:50 +02:00
Lukas Wirth
ffd28e6ee9 Fix cargo config get env parsing 2024-08-07 14:36:22 +02:00
Lukas Wirth
d2fe906a62 Remove unnecessary CfgFlag definition in project-model 2024-08-07 14:27:59 +02:00
Ali Bektas
2426649661 Allow rust-project.json to be hidden 2024-08-07 03:27:03 +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
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
Lukas Wirth
fcb88832de Simplify FileDelegate 2024-08-05 13:03:03 +02:00
bors
000eed1da8 Auto merge of #17795 - Veykril:library-dep-loading, r=Veykril
feat: Load sysroot library via cargo metadata

See https://github.com/rust-lang/rust/pull/128534, fixes https://github.com/rust-lang/rust-analyzer/issues/7637

Requires a toolchain from 176e54520 2024-08-04 or later to work.
2024-08-05 10:45:47 +00:00
Lukas Wirth
f053b1aa6a feat: Load sysroot library via cargo metadata 2024-08-05 12:18:19 +02:00
Lukas Wirth
758ad25229 internal: Remove AbsPathBuf::TryFrom impl that checks too many things at once 2024-08-02 11:08:19 +02:00
Ali Bektas
02c066cd1c Set tracing level to debug when cargo config get env fails 2024-07-30 12:57:21 +02:00
Lukas Wirth
7beac14cba Internal: Cleanup proc-macro error handling 2024-07-26 14:38:19 +02:00
Lukas Wirth
c7d6fe5257 fix: Support new cargo config get env format 2024-07-25 12:28:31 +02:00
Ali Bektas
e0db833082 Read rust-analyzer.toml files on startup 2024-07-22 02:42:39 +02:00
bors
fa3dd33c27 Auto merge of #17620 - Veykril:edition-aware-parser, r=Veykril
Edition aware parser

Fixes https://github.com/rust-lang/rust-analyzer/issues/16324 by allowing us to properly thread through the edition to the parser
2024-07-19 14:56:56 +00:00
David Barsky
db43a5a6e9 feature: move linked_projects discovery to the rust-analyzer server 2024-07-18 12:01:27 -04:00
Lukas Wirth
5264f86242 Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
Lukas Wirth
df5f1777b8 More symbol usage 2024-07-16 12:05:16 +02:00
Lukas Wirth
c30bdfcc84 Use symbol in cfg 2024-07-16 10:41:42 +02:00
mo8it
8ecfdec3c3 Remove version check before using --keep-going 2024-07-08 16:41:12 +02:00
Lukas Wirth
21a3d01875 Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
Wilfred Hughes
71a78a9cdc feature: add build system info; runnables to rust-project.json 2024-06-11 11:55:17 -04:00
Lukas Wirth
d4dc3ca83b Register virtual workspace Cargo.toml files in the VFS 2024-06-09 12:54:50 +02:00
Wilfred Hughes
27182bb96b chore: Prefer tracing span shorthand macros 2024-06-06 16:52:25 -07:00
Hamir Mahal
7c34eb3880
style: simplify string interpolation 2024-05-30 16:18:49 -07:00
Lukas Wirth
bd37e2790b Allow sysroots to only consist of the source root dir 2024-05-23 20:12:31 +02:00
Lukas Wirth
eac2e512a1 fix: Don't emit --keep-going for custom build script commands 2024-05-14 21:26:37 +02:00
Lukas Wirth
a268eaf053 fix: Correctly handle no_core/no_std for preludes 2024-05-02 10:50:28 +02:00
Lukas Wirth
18ca22a98e Show workspace info in the status bar 2024-04-26 11:28:33 +02:00
bors
e31c9f3fe1 Auto merge of #17102 - davidbarsky:david/add-some-tracing-to-project-loading, r=lnicola
chore: add some `tracing` to project loading

I wanted to see what's happening during project loading and if it could be parallelized. I'm thinking maybe, but it's not this PR :)
2024-04-22 15:56:06 +00:00
David Barsky
2a030ba755 chore: add some tracing to project loading 2024-04-22 11:39:01 -04:00
Lukas Wirth
fa754becc4 Support flychecking for cargo scripts 2024-04-21 17:40:17 +02:00
Lukas Wirth
ff56cb6e49 Extract common fields out of ProjectWorkspace variants 2024-04-21 17:03:02 +02:00
Lukas Wirth
a2ed6837bc Allow rust files to be used linkedProjects 2024-04-21 16:26:55 +02:00
Lukas Wirth
0ce7179e6b Correctly populate detached files roots 2024-04-19 18:25:10 +02:00
Lukas Wirth
46f05543a2 Patch cargo script root files back to manifest 2024-04-19 18:25:10 +02:00