Commit Graph

24464 Commits

Author SHA1 Message Date
Duong Quoc Khanh
a7df61f1d3
Add postfix completion for unsafe.
Wrap receiver_text with { } if it's not a BlockExpr.
2023-02-07 23:55:44 +09:00
Lukas Wirth
f6539b139e fix depth check for float split step 2023-02-07 15:44:00 +01:00
Lukas Wirth
c6e7917d6e Fix up token_tree_to_syntax_node float split handling 2023-02-07 15:21:37 +01:00
bors
1d32a7b7c6 Auto merge of #14094 - HKalbasi:layout, r=flodiebold
Reuse fetching target data layout from rustc function

fix https://github.com/rust-lang/rust-analyzer/pull/14087?notification_referrer_id=NT_kwDOArGpCLM1NTEyMDQ5MjU3OjQ1MTk3NTc2#discussion_r1097850915
2023-02-06 22:35:37 +00:00
hkalbasi
40cf8b45ac reuse fetching target data layout from rustc function 2023-02-06 23:48:20 +03:30
bors
e9ce02ce63 Auto merge of #14087 - HKalbasi:layout, r=Veykril
Support computing layout of RPIT

And some refactoring to make code more type safe.
2023-02-06 19:42:58 +00:00
hkalbasi
443bc7f193 Support layout of RPIT 2023-02-06 20:50:25 +03:30
bors
14ad6087c5 Auto merge of #14090 - MariaSolOs:regions, r=Veykril
Unify language configuration folding markers with server behaviour

Fixes #14089.
2023-02-06 14:37:39 +00:00
bors
62523024d3 Auto merge of #14091 - Veykril:workspace-sysroot, r=Veykril
Support sysroot library source being defined inside the workspace

With this you can now specify `cargo.sysrootSrc`. This is required for the rust workspace such that the `library` folder inside the workspace can be used as the sysroot library sources. We now also recognize if these sources are inside the workspace, tagging the as workspace members.

This does duplicate the sysroot crates still, but I don't think that causes too many problems.
2023-02-06 14:24:51 +00:00
bors
e9d0bfc799 Auto merge of #14092 - Veykril:inlay-hint-panic, r=Veykril
fix: Don't panic on broken syntax trees in adjustment inlay hints

These should be unreachable, but apparently with broken enough syntax trees (I assume mismatched parens), we do reach these unreachable calls. Haven't quite figured out when this happens though.
2023-02-06 11:39:47 +00:00
Lukas Wirth
c6305c5659 fix: Don't panic on broken syntax trees in adjustment inlay hints 2023-02-06 12:38:57 +01:00
Lukas Wirth
cb9a5b9549 Support sysroot library source being defined inside the workspace 2023-02-06 12:07:33 +01:00
bors
0b32b65ca6 Auto merge of #14043 - lowr:fix/completion-within-str-that-changed, r=Veykril
fix: consider relative offset to fake ident token in expansion for completion

Fixes #13836

When we check if the offset of fake ident token is out of bounds in the "actual expansion" (i.e. expansion without the fake ident token), we should take relative offset to it into account to match [how we'd get token after expansion](f1b257f4eb/crates/ide-completion/src/context/analysis.rs (L53-L54)).
2023-02-05 13:46:22 +00:00
Ryo Yoshida
a4d0b5c522
Add regression tests 2023-02-05 22:28:03 +09:00
Ryo Yoshida
0ec2911857
fix: consider relative offset to fake ident token in expansion for completion 2023-02-05 22:27:52 +09:00
Maria José Solano
3674502a98 Unify language config markers with server 2023-02-04 17:46:11 -08:00
Lukas Wirth
9053bcc65c Make mbe compile with parser changes 2023-02-03 21:39:24 +01:00
Lukas Wirth
6fa6efe90f fix: Fix parsing of nested tuple field accesses in a cursed way 2023-02-03 17:18:48 +01:00
bors
3bc33c7e9f Auto merge of #14010 - silvergasp:ci, r=lnicola
fuzz: Fixes broken Cargo.toml for fuzz tests

Fixes broken Cargo.toml for fuzz tests and adds building of fuzz tests to the CI.
2023-02-03 11:15:54 +00:00
Laurențiu Nicola
05d7d33a0f
Update .github/workflows/fuzz.yml 2023-02-03 13:15:27 +02:00
Lukas Wirth
dab685dd87 De-magic number parser::Output encoding 2023-02-03 11:47:33 +01:00
bors
10891ef090 Auto merge of #14083 - Veykril:issue-templates, r=lnicola
Add more basic issue templates with auto category labeling
2023-02-03 09:54:01 +00:00
Lukas Wirth
b97c191ff3 Add more basic issue templates with auto category labeling 2023-02-03 10:48:37 +01:00
bors
6133e27b83 Auto merge of #14070 - Veykril:proc-macro-api, r=Veykril
Implement proc-macro-api versioning

So as it stands, we can't really change the proc-macro-api protocol at all without breaking all proc-macro servers again. To somewhat alleviate this we can move the supported ABI mess over to the proc-macro-api now by supporting multiple versions there (versions defined by us at least, not by rustc). Since the proc-macro-api protocol has no versioning scheme at the moment though, the best we can do here is add a new request to query the version from a server. Due to how the server currently works though, if it encounters an unknown request it will exit, meaning we can check if it is a server without support by checking if it exited after our version check request, that way we can support the current circulating server as well.

We need this since our span type will change from `TokenId` to something else at some point, but for that to work we need to comply with that the server expects. So knowing the version the server is using we can decide whether to send our new span data, or the tokenid (assuming we keep that information with our span data as well, alternatively we send irrelevant tokenids). That way we can keep old servers working while the user installations slowly migrate to newer servers that support the new spandata.
2023-02-03 09:41:24 +00:00
Lukas Wirth
8e998c4aa7 Fail spawning proc-macro servers when their api version is newer than r-a's 2023-02-03 10:38:38 +01:00
bors
46846eae97 Auto merge of #14082 - lowr:fix/change-non-ascii-cases, r=Veykril
fix: support non-ascii characters in case conversion

Fixes #13521 (the attribute problem is tracked in another issue, as commented)

Note that other functions like `to_camel_case()` and `is_lower_snake_case()` already handle non-ascii characters.
2023-02-03 09:28:49 +00:00
Ryo Yoshida
98c8077495
fix: support non-ascii characters in case conversion 2023-02-03 18:11:11 +09:00
bors
04850a192c Auto merge of #14049 - lnicola:flatpak, r=lnicola
internal: Add a manual section for Flatpak

Fixes #14042
2023-02-02 13:38:06 +00:00
Laurențiu Nicola
f112d3f756 Add a manual section for Flatpak 2023-02-02 15:37:52 +02:00
bors
eeceba7480 Auto merge of #14065 - lowr:patch/generate-generic-function, r=Veykril
Support generic function in `generate_function` assist

Part of #3639

This PR adds support for generic function generation in `generate_function` assist. Now the assist looks for generic parameters and trait bounds in scope, filters out irrelevant ones, and generates new function with them.

See `fn_generic_params()` for the outline of the procedure, and see comments on `filter_unnecessary_bounds()` for criteria for filtering. I think it's good criteria for most cases, but I'm open to opinions and suggestions.

The diff is pretty big, but it should run in linear time w.r.t. the number of nodes we operate on and should be fast enough.

Some notes:
- When we generate function in an existing impl, generic parameters may cause name conflict. While we can detect the conflict and rename conflicting params, I didn't find it worthwhile mainly because it's really easy to resolve on IDE: use Rename functionality.
- I've implemented graph structure myself, because we don't have graph library as a dependency and we only need the simplest one.
  - Although `petgraph` is in our dependency graph and I was initially looking to use it, we don't actually depend on it AFAICT since it's only used in chalk's specialization graph handling, which we don't use. I'd be happy to replace my implementation with `petgraph` if it's okay to use it though.
- There are some caveats that I consider out of scope of this PR. See FIXME notes on added tests.
2023-02-02 09:06:22 +00:00
Ryo Yoshida
493cabbde7
Treat scope info retrieval failure as assist failure 2023-02-02 17:47:11 +09:00
bors
ccd142c616 Auto merge of #14058 - gftea:master, r=Veykril
fix negative trait bound in outline view (#14044)

try to fix and close #14044
2023-02-01 20:00:19 +00:00
bors
a257a58f24 Auto merge of #14072 - ericsink:master, r=lnicola
Expand docs section on Visual Studio to mention all three available extensions

A recent PR (#14012) by `@parthopdas` added mention of rust-analyzer.vs, his extension for Visual Studio 2022.  I am submitting this PR to request that our extension (SourceGear Rust) be mentioned in that section as well, and also, for completeness, the VS_RustAnalyzer extension, by `@cchharris.`

Our extension is closed source, so I have clearly disclosed that.  For consistency, I included brief mention of the licenses for the other two options as well.  Also for the sake of consistency, I added marketplace and GitHub links for all 3.

The previously added paragraph by `@parthopdas` about his extension has been left intact.
2023-02-01 18:55:09 +00:00
bors
23e60c14e2 Auto merge of #14073 - lnicola:zip, r=lnicola
minor: Bump `zip` to avoid `time-macros`

This fixes the compile time regression in #13876 and sneaks in two typo fixes spotted by `@cuishuang` (sorry for not preserving the commit attribution, but it's a little hard to manage it across repositories).
2023-02-01 17:41:56 +00:00
Laurențiu Nicola
ff340f9c21 Bump zip 2023-02-01 19:24:32 +02:00
Eric Sink
24d3e937ca Expand section on Visual Studio to mention all three available rust-analyzer extensions for that IDE. 2023-02-01 09:48:22 -06:00
bors
7acc434f46 Auto merge of #14071 - Veykril:inlay-hints, r=Veykril
fix: Don't render fieldless discriminant inlay hints for datacarrying enums
2023-02-01 10:39:15 +00:00
Lukas Wirth
14f19c73e9 fix: Don't render fieldless discriminant inlay hints for datacarrying enums 2023-02-01 11:38:39 +01:00
bors
bfe82cda48 Auto merge of #14036 - Veykril:write-method-resolution, r=Veykril
Record method resolution for remaining operator expressions

This allows goto def and future substituted hover to work for the concrete impls.
2023-02-01 10:23:33 +00:00
Lukas Wirth
c40b0895f0 Implement proc-macro-api versioning 2023-02-01 11:04:20 +01:00
bors
a4d3a4a75b Auto merge of #14068 - HKalbasi:unsize, r=flodiebold
Unsize cast array only on pointer type

fix #14000
2023-01-31 21:33:04 +00:00
hkalbasi
0bf0d937b8 unsize cast array only on pointer type 2023-01-31 20:23:38 +03:30
bors
0fcef7fdd3 Auto merge of #14067 - jonas-schievink:lazy-trace-output, r=jonas-schievink
fix: Lazily create the trace output channel

Fixes https://github.com/rust-lang/rust-analyzer/issues/13055
2023-01-31 14:59:18 +00:00
Jonas Schievink
5b1187a046 Remove some types ¯\_(ツ)_/¯ 2023-01-31 15:49:39 +01:00
bors
da249539e8 Auto merge of #14061 - Veykril:generic-tt, r=Veykril
Make tt generic over the span data

This also fixes up our delimiter representation in tt, it is no longer optional (we use invisible delims in the same way as before, that is still incorrectly) and we now store two spans instead of one.

These changes should help with adjusting our token map. Though this will probably break proc-macros in some ways, will need to test that for now.
2023-01-31 14:45:45 +00:00
Jonas Schievink
56f81ebc3e Lazily create the trace output channel 2023-01-31 15:43:47 +01:00
Lukas Wirth
41a46a78f2 Make tt generic over the span data 2023-01-31 14:58:16 +01:00
Ryo Yoshida
3edde6fcc1
Support generic function in generate_function assist 2023-01-31 21:05:25 +09:00
Ryo Yoshida
32955c30cd
Add method to get generic parameters in a type 2023-01-31 21:05:23 +09:00
Ryo Yoshida
0df70d37fc
Minor refactoring 2023-01-31 21:05:04 +09:00