Commit Graph

24293 Commits

Author SHA1 Message Date
Swarnim Arun
9a481d1ecf
add: clean api to get raw_ptr type 2023-02-27 10:59:20 +05:30
bors
4e29820f6d Auto merge of #14207 - tomokinat:master, r=lnicola
Respect $CARGO_HOME when looking up toolchains.

Some people set `$CARGO_HOME` to a location other than `~/.cargo` (`$XDG_DATA_DIR/cargo`,  in my case), and I'd be a little nicer if the rust-analyzer extension and server respect that value when looking up toolchains, instead of having us configure all of `$CARGO`, `$RUSTC` ... manually.

The new implementation still defaults to `~/.cargo` if `$CARGO_HOME` is unset, pretty much like cargo itself does (as documented in https://doc.rust-lang.org/cargo/guide/cargo-home.html), so the change is backwards compatible for most people except those who has configured `$CARGO_HOME` explicitly.

I considered using https://crates.io/crates/home as suggested by https://doc.rust-lang.org/cargo/guide/cargo-home.html, but decided to put int on hold because i) we need mirror impl in node, ii) I thought the consistency matters more and iii) the new implementation shouldn't be worse than the current one (i.e. switching to `home` improvement is rather orthogonal and could be done in another PR). If you have any directions on this, please let me know.
2023-02-26 15:45:13 +00:00
Tomoki Nakagawa
e4b184a776 Respect $CARGO_HOME when looking up toolchains. 2023-02-26 15:37:04 +09:00
bors
289208bc9f Auto merge of #14203 - shilangyu:fix/angled-path-segments, r=lnicola
fix: Add check for extra path segments after a fully qualified one

`type A = <()>;` is parsed just fine by rust-analyzer, but then rejected by rustc:

```
error: expected `::`, found `;`
 --> x.rs:7:14
  |
7 | type A = <()>;
  |              ^ expected `::`

```

Fixed by adding a lookahead for the `::` token after fully-qualified path segments.
2023-02-25 16:10:58 +00:00
shilangyu
44e47fe408 Add check for extra path segments after an angled one 2023-02-25 16:16:49 +01:00
bors
9a4efb4cc3 Auto merge of #14202 - lowr:minor/use-either-either, r=lnicola
minor: import `Either` from `either`

This is a clean-up patch to replace `use itertools::Either` with `use either::Either` for the sake of consistency.
2023-02-25 13:23:17 +00:00
Ryo Yoshida
cf0c8fe000
minor: import Either from either 2023-02-25 21:55:11 +09:00
bors
f5401f6206 Auto merge of #14175 - jmviz:openDocs-context-menu, r=lnicola
add openDocs command to context menu in VS Code extension

This adds the `openDocs` command to the VS Code context menu. I believe there are probably many user who are unaware of this command existing in the rust analyzer extension, and that this should enhance the discoverability of the command. Additionally, even if people are aware of this capability, it's helpful to have this in the context menu anyway; for example, one might forget the name of the command, or the keybinding they have assigned to it. I think that opening docs is a common enough action to warrant the extra line added to the context menu.

This makes a few other small changes as well. There are two minor style changes to increase style consistency. First, it changes the titles of the two commands that the rust analyzer extension will contribute to the context menu to title case. All standard VS Code commands that appear in the context menu are in title case. Second, it shortens the title of the `openDocs` command from `Open docs under cursor` to `Open Docs`. The implicit assumption in the standard VS Code context menu command titles is that the action applies to the symbol under the cursor: `Go to Definition`, `Find All References`, etc. Note that since these are changes to the command titles, rather than the command names themselves, these changes will not break any users' existing keybindings for these commands.

Second, this adds further restrictions to the `where` clauses of the two commands that the rust analyzer extension will contribute to the context menu, so that the two commands will appear in the context menu only when in a Rust project **and** within a Rust file. Say you have a Python or bash script inside your Rust project. Having these commands appear in the context menu when you right click a symbol in such a non-Rust file is extraneous and potentially confusing.

![demonstration](https://user-images.githubusercontent.com/6609145/219976062-b46ab21b-5753-48f5-a1da-562566cae71c.gif)
2023-02-24 06:55:02 +00:00
bors
27239fbb58 Auto merge of #14183 - lnicola:rustfmt-command-docs, r=lowr
minor: Try to improve the `rustfmt.overrideCommand` docs

Closes #14078
2023-02-21 10:48:22 +00:00
Laurențiu Nicola
563bd9c24a Try to improve the rustfmt.overrideCommand docs 2023-02-21 12:43:22 +02:00
bors
e59ada921f Auto merge of #14182 - lnicola:rm-profdata, r=lnicola
minor: Remove file added by mistake

This got added somehow in https://github.com/rust-lang/rust-analyzer/pull/14154.
2023-02-21 07:06:16 +00:00
Laurențiu Nicola
f40526b949 Remove file added by mistake 2023-02-21 09:05:19 +02:00
bors
dad6b1417c Auto merge of #14181 - lnicola:sync-from-rust, r=lnicola
minor: Sync from downstream
2023-02-21 06:42:04 +00:00
Laurențiu Nicola
549b53bbea Merge branch 'master' into sync-from-rust 2023-02-21 08:37:01 +02:00
jmviz
dd92e4a507 add to manual 2023-02-20 11:38:33 -05:00
Laurențiu Nicola
7e711da2f0 ⬆️ rust-analyzer 2023-02-20 10:14:12 +02:00
jmviz
2351875e6a change titles of commands in context menu to title case. shorten open docs command 2023-02-19 10:12:44 -05:00
jmviz
ed1f467aab add openDocs to context menu. add further restrictions to context menu when clauses to prevent irrelevant commands in non-rust files 2023-02-17 17:41:39 -05:00
bors
a6603fc21d Auto merge of #14171 - Ethan-000:master, r=matklad
fix link

Fixes https://github.com/rust-lang/rust-analyzer/issues/14170
2023-02-16 21:49:22 +00:00
Ethan-000
936bac31d4
fix link 2023-02-16 21:45:56 +00:00
bors
b881deb66a Auto merge of #14165 - Veykril:completion-item, r=Veykril
internal: Make CompletionItem more POD-like
2023-02-16 08:30:56 +00:00
Lukas Wirth
404a51f26a internal: Make CompletionItem more POD-like 2023-02-16 09:29:55 +01:00
bors
d011e79d90 Auto merge of #14162 - azriel91:bugfix/14161/generate-getter-snippet-cap-check, r=Veykril
Conditionally add snippet marker.

Fixes #14161.

Heya, I just added the code with some tests, but not sure if it's *the way* to do it -- I didn't refactor existing methods for the `check` test method, but added another calling layer.
2023-02-16 08:10:32 +00:00
Azriel Hoh
a6f54d6c5f Conditionally add snippet marker. 2023-02-16 10:50:27 +13:00
bors
1f2d33fb40 Auto merge of #14160 - Veykril:hover-call, r=Veykril
fix: Bring back hovering call parens for return type info
2023-02-15 17:59:31 +00:00
Lukas Wirth
e550e553e0 fix: Bring back hovering call parens for return type info 2023-02-15 18:58:59 +01:00
bors
dd582dac67 Auto merge of #14157 - Veykril:inlay, r=Veykril
Adjust binding mode inlay hints to render better with @ patterns
2023-02-15 13:47:29 +00:00
Lukas Wirth
5859190066 Adjust binding mode inlay hints to render better with @ patterns 2023-02-15 14:47:02 +01:00
bors
a04054ac39 Auto merge of #14156 - Veykril:completion-pod, r=Veykril
internal: Don't reconstruct ref match completion in to_proto manually

cc https://github.com/rust-lang/rust-analyzer/issues/12571
2023-02-15 13:17:27 +00:00
Lukas Wirth
23fc596e40 Don't reconstruct ref match completion in to_proto manually 2023-02-15 14:15:22 +01:00
Lukas Wirth
026a8c976d Simplify 2023-02-15 13:38:42 +01:00
bors
160305b215 Auto merge of #14154 - lnicola:rand-typos, r=lnicola
minor: Fix a pair of typos
2023-02-15 12:11:36 +00:00
Laurențiu Nicola
6e5ec0b3ce Fix a pair of typos 2023-02-15 14:11:11 +02:00
bors
89b9940491 Auto merge of #14153 - CraftSpider:v7-metadata, r=CraftSpider
Add v7 metadata support to rust-analyzer

Paired to https://github.com/rust-lang/rust/pull/101550
2023-02-14 20:03:09 +00:00
Rune Tynan
853f047245
Cargo fmt 2023-02-14 14:45:05 -05:00
Rune Tynan
bc81d582c9
Add v7 support to rust-analyzer 2023-02-14 12:29:33 -05:00
bors
37608f306c Auto merge of #14152 - Veykril:path-opt, r=Veykril
Replace some often empty `Vec`s with boxed slices
2023-02-14 16:58:58 +00:00
bors
523fea8f25 Auto merge of #14149 - Veykril:completion, r=Veykril
Trigger call info for more completions of signature having things
2023-02-14 16:42:30 +00:00
Lukas Wirth
4aee911ce4 Slim down GenericArgs by one usize once more 2023-02-14 17:41:16 +01:00
Lukas Wirth
853ae1927d Slim down GenericArgs by one usize 2023-02-14 17:40:24 +01:00
Lukas Wirth
4c2aef650a Slim down AssociatedTypeBinding by one usize 2023-02-14 17:40:24 +01:00
bors
41db8c2b59 Auto merge of #14151 - Veykril:smallvec, r=Veykril
internal: Enable smallvec's `union` feature
2023-02-14 16:24:21 +00:00
Lukas Wirth
cade9f7020 Trigger call info for more completions of signature having things 2023-02-14 17:05:07 +01:00
bors
9548388534 Auto merge of #14150 - Veykril:path, r=Veykril
internal: Don't allocate the generic_args vec in `hir_def::Path` if it consists only of `None` args

Saves roughly 5mb on self
2023-02-14 16:02:02 +00:00
Lukas Wirth
a18ebf40cb Don't allocate the generic_args vec in hir_def::Path if it consists only of None args 2023-02-14 17:01:38 +01:00
Lukas Wirth
3c0f20a7bd internal: Enable smallvec's union feature 2023-02-14 17:01:01 +01:00
bors
e7bc68f2c3 Auto merge of #14148 - Veykril:lsp-types, r=Veykril
Bump lsp-types
2023-02-14 14:33:32 +00:00
bors
2e86029662 Auto merge of #14147 - Veykril:completion, r=Veykril
Don't assume VSCode internal commands in the server
2023-02-14 14:19:20 +00:00
Lukas Wirth
38144fd914 Bump lsp-types 2023-02-14 14:59:50 +01:00
Lukas Wirth
95fa278f30 Don't assume VSCode internal commands in the server 2023-02-14 14:45:48 +01:00