Commit graph

1241 commits

Author SHA1 Message Date
bors
11bf2e7ffb Auto merge of #13058 - dpaoliello:extraenv, r=Veykril
Add a new configuration settings to set env vars when running cargo, rustc, etc. commands: cargo.extraEnv and checkOnSave.extraEnv

It can be extremely useful to be able to set environment variables when rust-analyzer is running various cargo or rustc commands (such as `cargo check`, `cargo --print cfg` or `cargo metadata`): users may want to set custom `RUSTFLAGS`, change `PATH` to use a custom toolchain or set a different `CARGO_HOME`.

There is the existing `server.extraEnv` setting that allows env vars to be set when the rust-analyzer server is launched, but using this as the recommended mechanism to also configure cargo/rust has some drawbacks:
- It convolutes configuring the rust-analyzer server with configuring cargo/rustc (one may want to change the `PATH` for cargo/rustc without affecting the rust-analyzer server).
- The name `server.extraEnv` doesn't indicate that cargo/rustc will be affected but renaming it to `cargo.extraEnv` doesn't indicate that the rust-analyzer server would be affected.
- To make the setting useful, it needs to be dynamically reloaded without requiring that the entire extension is reloaded. It might be possible to do this, but it would require the client communicating to the server what the overwritten env vars were at first launch, which isn't easy to do.

This change adds two new configuration settings: `cargo.extraEnv` and `checkOnSave.extraEnv` that can be used to change the environment for the rust-analyzer server after launch (thus affecting any process that rust-analyzer invokes) and the `cargo check` command respectively. `cargo.extraEnv` supports dynamic changes by keeping track of the pre-change values of environment variables, thus it can undo changes made previously before applying the new configuration (and then requesting a workspace reload).
2022-09-18 17:43:46 +00:00
Lukas Wirth
b73fa0be9c Use memmem when searching for usages in ide-db 2022-09-16 16:26:54 +02:00
Daniel Paoliello
c407cc554e Add cargo.extraEnv setting 2022-09-13 11:29:14 -07:00
Lukas Wirth
d025c5d8d6 Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
Lukas Wirth
2a26b054b7 Use lsp-types DECORATOR token type 2022-08-23 14:06:19 +02:00
TJ DeVries
50ecb09da4 feat: emit SCIP via rust-analyzer 2022-08-22 15:13:46 -04:00
Lukas Wirth
f9d1b26a96 Replace crossbeam with std's scoped threads 2022-08-22 14:55:13 +02:00
Laurențiu Nicola
e5d3ac58b3 Bump notify 2022-08-19 21:37:05 +03:00
Laurențiu Nicola
f5f689588f Bump deps 2022-08-19 21:33:09 +03:00
bors
3805067bf5 Auto merge of #12905 - HKalbasi:master, r=Veykril
Generate rust type from json

fix #10118

Should this be a diagnostic? I made it a diagnostic because of issue label.
2022-08-08 11:46:22 +00:00
hkalbasi
c1a175f61e Generate rust type from json 2022-07-29 20:06:01 +04:30
Amos Wenger
5f54ec0e85 Add a proc-macro-srv-cli crate 2022-07-25 15:19:57 +02:00
bors
0b131bc78e Auto merge of #12849 - Veykril:no-parse, r=Veykril
internal: Don't parse files unnecessarily in scope_for_offset
2022-07-22 23:00:35 +00:00
Lukas Wirth
cb6703fe06 internal: Don't parse files unnecessarily in scope_for_offset 2022-07-23 00:50:59 +02:00
Amos Wenger
32ee097580 Run proc macro expansion in a separate thread (for the thread-local interner) 2022-07-21 18:11:50 +02:00
Amos Wenger
05d8f5fee7 Use a thread-local for the symbol interner (1/2) 2022-07-21 14:57:09 +02:00
Amos Wenger
d25b61030e Add literal/ident conversion, tests pass 2022-07-20 19:18:39 +02:00
Amos Wenger
1b416473a3 Upgrade to expect-test@1.4.0
cf. https://github.com/rust-analyzer/expect-test/issues/33
cf. https://github.com/rust-lang/rust/pull/99444#issuecomment-1188844202
2022-07-19 13:00:45 +02:00
Jonas Schievink
d2fd137252 Use SmallVec to slightly shrink ModPath size 2022-07-06 19:49:05 +02:00
Laurențiu Nicola
993a19a19a Bump the rest of the deps 2022-07-03 10:24:07 +03:00
Laurențiu Nicola
78beb4c444 Bump chalk 2022-07-03 10:22:10 +03:00
Laurențiu Nicola
e05e6c60a7 Bump object 2022-07-03 10:14:48 +03:00
Laurențiu Nicola
5381811368 Bump tracing-subscriber 2022-07-03 10:12:58 +03:00
Laurențiu Nicola
a3011e5ed2 Bump arbitrary and derive_arbitrary 2022-07-03 10:10:45 +03:00
Laurențiu Nicola
9e7ca80c82 Bump cargo_metadata 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
2d3f0b4841 Bump semver 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
6669f388a2 Bump indexmap 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
b24ece5220 Bump serde_json 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
87572bee23 Bump serde 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
791f2a0bec Bump smallvec 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
2af61bc9ba Bump pulldown-cmark-to-cmark 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
e6fcb23445 Bump either 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
c7c314d462 Bump quote 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
416787d26d Bump anyhow 2022-07-03 09:57:01 +03:00
Laurențiu Nicola
212f84ab46 Bump crossbeam-channel 2022-07-03 09:56:58 +03:00
Florian Diebold
c80c34867f Improve proc macro errors a bit
Distinguish between
 - there is no build data (for some reason?)
 - there is build data, but the cargo package didn't build a proc macro dylib
 - there is a proc macro dylib, but it didn't contain the proc macro we expected
 - the name did not resolve to any macro (this is now an
 unresolved_macro_call even for attributes)

I changed the handling of disabled attribute macro expansion to
immediately ignore the macro and report an unresolved_proc_macro,
because otherwise they would now result in loud unresolved_macro_call
errors. I hope this doesn't break anything.

Also try to improve error ranges for unresolved_macro_call / macro_error
by reusing the code for unresolved_proc_macro. It's not perfect but
probably better than before.
2022-06-24 13:45:19 +02:00
Lukas Wirth
76ae5434fa internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
Lukas Wirth
0cf677ab42 internal: Update dashmap and freeze its version 2022-06-10 16:19:52 +02:00
Brennan Vincent
364dd5ff89 Fix build on OpenBSD (and probably other BSDs too)
notify-5.0.0-pre.14 does not build on these systems; this was fixed in
41a74f0e98 , which landed in pre.15.
2022-05-22 17:04:57 -04:00
Aleksey Kladov
e64ccddcc7 ⬆️ deps 2022-05-19 17:08:18 +01:00
Aleksey Kladov
57cb65bb7a internal: vendor lsp-server 2022-05-14 21:15:43 +01:00
Aleksey Kladov
59dcb63309 ⬆️ deps 2022-05-03 11:57:40 +01:00
Peh
1f011fa4a3 style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
Laurențiu Nicola
c7396a5c64 Downgrade kqueue to fix NetBSD 2022-04-30 19:02:24 +03:00
Lukas Wirth
4255996965 Re-export FxHashMap and FxHashSet from ide_db 2022-04-25 18:51:59 +02:00
Lukas Wirth
8154365b00 minor: Remove either dependency from ide_completion 2022-04-25 18:40:38 +02:00
Laurențiu Nicola
117f902d55 Bump deps 2022-04-17 19:36:08 +03:00
Lukas Wirth
e2f1a9a558 feat: Attempt to format expand_macro output with rustfmt if possible 2022-04-17 13:33:39 +02:00
Laurențiu Nicola
5901eddb02 Bump chalk 2022-04-12 20:10:10 +03:00
Lukas Wirth
2d445de170 minor: bump lsp-server version 2022-04-09 00:13:47 +02:00