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
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
Laurențiu Nicola
6e5ec0b3ce
Fix a pair of typos
2023-02-15 14:11:11 +02: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
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
bors
44568007d1
Auto merge of #14128 - Veykril:parser, r=Veykril
...
internal: Improve parser recovery for delimited lists
Closes https://github.com/rust-lang/rust-analyzer/issues/11188 , https://github.com/rust-lang/rust-analyzer/issues/10410 , https://github.com/rust-lang/rust-analyzer/issues/10173
Should probably be merged after the stable release as this might get the parser stuck if I missed something
2023-02-14 12:59:39 +00:00
Lukas Wirth
4f6b5f41d4
Recover better for more delimited sequences
2023-02-14 13:52:15 +01:00
bors
88b3d9f6f4
Auto merge of #14144 - lowr:fix/find-occurrence-of-raw-ident, r=Veykril
...
fix: Search raw identifiers without prefix
When we find references/usages of a raw identifier, we should disregard `r#` prefix because there are keywords one can use without the prefix in earlier editions (see #13034 ; this bug is actually fallout from the PR). `name`, the text we're searching for, has already been stripped of the prefix, but the text of nodes we compare it to hasn't been.
The second commit is strictly refactoring, I can remove it if it's not much of value.
2023-02-14 11:15:55 +00:00
bors
31486a639d
Auto merge of #14141 - matklad:utf-32, r=lnicola
...
Support UTF-32 position encoding
Looks like this is a native encoding for Emacs at least!
2023-02-14 10:53:35 +00:00
Ryo Yoshida
60fa8fefa6
refactor: reduce nesting
2023-02-14 17:34:19 +09:00
Ryo Yoshida
098d9d77b4
Search raw identifiers without prefix
2023-02-14 17:34:14 +09:00
Alex Kladov
9fdcf5787d
Update crates/ide-db/src/line_index.rs
...
Co-authored-by: Stig Brautaset <stig@brautaset.org>
2023-02-14 08:19:58 +00:00
bors
2a57b01980
Auto merge of #14122 - lowr:patch/abort-macro-expansion-on-overflow, r=Veykril
...
fix: Don't expand macros in the same expansion tree after overflow
This patch fixes 2 bugs:
- In `Expander::enter_expand_id()` (and in code paths it's called), we never check whether we've reached the recursion limit. Although it hasn't been reported as far as I'm aware, this may cause hangs or stack overflows if some malformed attribute macro is used on associated items.
- We keep expansion even when recursion limit is reached. Take the following for example:
```rust
macro_rules! foo { () => {{ foo!(); foo!(); }} }
fn main() { foo!(); }
```
We keep expanding the first `foo!()` in each expansion and would reach the limit at some point, *after which* we would try expanding the second `foo!()` in each expansion until it hits the limit again. This will (by default) lead to ~2^128 expansions.
This is essentially what's happening in #14074 . Unlike rustc, we don't just stop expanding macros when we fail as long as it produces some tokens so that we can provide completions and other services in incomplete macro calls.
This patch provides a method that takes care of recursion depths (`Expander::within_limit()`) and stops macro expansions in the whole macro expansion tree once it detects recursion depth overflow. To be honest, I'm not really satisfied with this fix because it can still be used in unintended ways to bypass overflow checks, and I'm still seeking ways such that misuses are caught by the compiler by leveraging types or something.
Fixes #14074
2023-02-14 07:37:53 +00:00
bors
381295144e
Auto merge of #14123 - dqkqd:discard-postfix-completion-for-indivisble-expr, r=Veykril
...
fix: Don't trigger postfix completion in `if` block which has an `else` block
Fix #14096
2023-02-14 07:24:47 +00:00
Laurențiu Nicola
354b1aaa50
Merge branch 'master' into sync-from-rust
2023-02-14 08:40:55 +02:00
Aleksey Kladov
0da27376cf
Support UTF-32 position encoding
...
Looks like this is a native encoding for Emacs at least!
2023-02-14 01:09:50 +00:00
Laurențiu Nicola
bc45c7659a
⬆️ rust-analyzer
2023-02-13 13:55:14 +02:00
bors
c97aae38f2
Auto merge of #14138 - lowr:fix/rename-raw-ident-mod, r=Veykril
...
fix: don't include `r#` prefix in filesystem changes
Fixes #14131
In addition to fix for #14131 , this PR adds raw ident validity checks in rename functionality that we've been missing.
2023-02-13 11:38:32 +00:00
Duong Quoc Khanh
0285acc5f7
Find next_non_trivia_token
of name_ref
.
2023-02-13 20:11:04 +09:00
bors
23871f9dd1
Auto merge of #14140 - Veykril:proc-macro-srv-fix, r=Veykril
...
fix: Fix proc-macro-server incorrectly stripping delimiters
🙄
2023-02-13 11:08:23 +00:00
Lukas Wirth
1c2292e5c6
fix: Fix proc-macro-server incorrectly stripping delimiters
2023-02-13 12:07:31 +01:00
Lukas Wirth
244a48d13d
Cleanup signature help a bit
2023-02-13 11:25:45 +01:00
Ryo Yoshida
57f0e9c100
Disallow invalid raw ident names
2023-02-13 18:45:19 +09:00
Ryo Yoshida
9b0daf20c9
fix: don't include r#
prefix in filesystem changes
2023-02-13 18:44:53 +09:00
Ryo Yoshida
92fdfb548e
Make is_raw_identifier()
public util function
2023-02-13 18:43:59 +09:00
Lukas Wirth
9738f97f8c
Fix active parameter analysis once more
2023-02-12 17:32:11 +01:00
Lukas Wirth
d2cf8c234a
Make else autocompletion work in more places
2023-02-12 10:49:57 +01:00
Lukas Wirth
33cacde04b
Fix active parameter analysis
2023-02-12 10:26:19 +01:00
Lukas Wirth
1be24e0899
internal: Improve parser recovery a bunch
2023-02-11 20:28:36 +01:00
Lukas Wirth
5fdf640fb3
fix: Fix bind pat inlay hints rendering for constant patterns
2023-02-11 16:29:54 +01:00
Duong Quoc Khanh
e1396bde73
Don't trigger postfix completion if
block which has an else
block
...
Discard postfix completion if the next_non_trivia_sibling of dot_token
is an ELSE_KW.
2023-02-11 21:26:00 +09:00
Ryo Yoshida
ae7e62c50f
Don't expand macros in the same expansion tree after overflow
2023-02-11 18:19:08 +09:00
Lukas Wirth
7677f41f41
Preallocate some vecs
2023-02-10 16:42:09 +01:00
Lukas Wirth
79492cb8ae
internal: Revert castable expectation and simplify
2023-02-10 16:08:47 +01:00
Lukas Wirth
8f5deb4ff2
Remove a few allocations in hir-ty::utils
2023-02-10 14:57:03 +01:00
bors
f11cff8976
Auto merge of #14116 - Veykril:inlay-hints-disc, r=Veykril
...
Render discriminant inlay hints for mixed variants if at least one discriminant is specified
2023-02-10 08:59:17 +00:00
Lukas Wirth
557aa1e378
Render discriminant inlay hints for mixed variants if at least one discriminant is specified
2023-02-10 09:57:03 +01:00
lh123
626dc651ff
fix: Insert spaces when inlining macros
2023-02-10 14:22:56 +08:00
bors
7e17b98d17
Auto merge of #14111 - lnicola:squash-proc-macro-server-warning, r=Veykril
...
fix: Hide proc macro server version detection errors
These are harmless, but users tend to blame other things on them.
2023-02-09 10:29:28 +00:00
Laurențiu Nicola
8828f3494e
Hide proc macro server version detection errors
2023-02-09 10:46:36 +02:00
Duong Quoc Khanh
74cd8ecc7e
Add completion without body.
...
Add completion for Fn, Const, TypeAlias without body.
2023-02-09 17:37:11 +09:00
Duong Quoc Khanh
58136b01ba
Add more tests for completion without body.
...
Add tests for Fn, Const, TypeAlias without body inside Trait.
2023-02-09 17:32:55 +09:00
bors
eaed19c539
Auto merge of #14104 - Veykril:castable-expect, r=Veykril
...
fix: Implement Expactation::Castable and add a test case for it
Fixes https://github.com/rust-lang/rust-analyzer/issues/11571
2023-02-08 12:08:15 +00:00
Lukas Wirth
f8f1cb93e0
fix: Implement Expactation::Castable and add a test case for it
2023-02-08 13:07:59 +01:00
bors
5341a6fa7f
Auto merge of #14103 - Veykril:typing-semi, r=Veykril
...
fix: Don't insert a semicolon when typing = if parse errors are encountered
Fixes https://github.com/rust-lang/rust-analyzer/issues/11005
2023-02-08 11:14:58 +00:00
Lukas Wirth
5e6208b1df
fix: Don't insert a semicolon when typing = if parse errors are encountered
2023-02-08 12:06:35 +01:00
bors
885c1ad578
Auto merge of #14102 - Veykril:bump-lexer, r=Veykril
...
minor: Bump `rustc-ap-rustc_lexer`
Closes https://github.com/rust-lang/rust-analyzer/issues/9554
2023-02-08 11:01:32 +00:00
Lukas Wirth
4788c7a056
Bump rustc-ap-rustc_lexer
2023-02-08 11:42:14 +01:00
bors
512a93ac94
Auto merge of #14100 - Veykril:load_cargo-proc-macro-srv-config, r=Veykril
...
Allow specifying what proc-macro server to run in rust_analyzer::load_cargo API
Closes https://github.com/rust-lang/rust-analyzer/issues/10516
2023-02-08 10:12:31 +00:00
Lukas Wirth
f03fb262f7
Allow specifying what proc-macro server to run in rust_analyzer::load_cargo API
2023-02-08 11:05:34 +01:00
bors
6effb26062
Auto merge of #14095 - dqkqd:master, r=Veykril
...
Add postfix completion for `unsafe`.
Fix #13779 .
Hi, this is my first PR. Please tell me if there is anything I should do.
2023-02-08 09:44:22 +00:00
bors
a05ce5a3e7
Auto merge of #13986 - MariaSolOs:limit-completions, r=Veykril
...
Add setting for limiting number of completions
For #13911 .
2023-02-08 09:31:35 +00:00
bors
3c89945e78
Auto merge of #14098 - pascalkuthe:did_change_workspace_folder, r=Veykril
...
Support DidChangeWorkspaceFolders notifications
This PR enables the `WorkspaceFoldersServerCapabilities` capability for rust-analyzer and implemented support for the associated [`DidChangeWorkspaceFolders`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didChangeWorkspaceFolders ) notification to allow clients to update the list of `workspaceFolders` sent during initialization.
## Motivation
This allows clients which lazily autodiscover their workspace roots (like the [helix editor](https://github.com/helix-editor/helix ) once [my PR](https://github.com/helix-editor/helix/pull/5748 ) lands) avoid spawning multiple instances of RA. Right now such clients are forced to either:
* greedily discover all LSP roots in the workspace (precludes the ability to respond to new workspace roots)
* spawn multiple instance of rust-analyzer (one for each root)
* restart rust-analyzer whenever a new workspace is added
Some example use-cases are shown [here](https://github.com/helix-editor/helix/pull/5748#issuecomment-1421012523 ).
This PR will also improve support for VSCode (and Atom) multi workspaces.
## Implementation
The implementation was fairly straightforward as `rust-analyzer` already supports dynamically reloading workspaces, for example on configuration changes. Furthermore, rust-analyzer also already supports auto-discovering internal workspace from the `workspaceFolders` key in the initialization request. Therefore, the necessary logic just needed to be moved to a central place and reused.
2023-02-08 09:14:01 +00:00
bors
b7836e44d3
Auto merge of #14099 - Veykril:inlay-hint-loc, r=Veykril
...
Properly use location links for type hints of impl Future and its assoc type
2023-02-08 08:43:10 +00:00
Maria José Solano
064fcfa016
Sort and truncate final response
2023-02-07 18:41:28 -08:00
Lukas Wirth
2b4a5374ee
Properly use location links for type hints of impl Future and its assoc type
2023-02-07 22:42:03 +01:00
Pascal Kuthe
c7010eda1b
Support DidChangeWorkspaceFolders capability
2023-02-07 22:40:40 +01:00
Duong Quoc Khanh
2666e6eda8
Add test for LetElse
case.
...
Postfix completion is not triggered.
2023-02-08 04:04:10 +09:00
Duong Quoc Khanh
8535f2bb1b
Handle edge cases.
...
Handle case when BlockExpr is child of IfExpr, WhileExpr, LoopExpr,
ForExpr.
An additional { } will be added when:
- It is not a BlockExpr
- It is a BlockExpr and a child of IfExpr, WhileExpr, LoopExpr, ForExpr.
2023-02-08 03:37:20 +09:00
bors
7f1234492e
Auto merge of #14084 - Veykril:float-parse, r=Veykril
...
fix: Fix parsing of nested tuple field accesses in a cursed way
This is absolutely terrible but seems to work. Macro fragment parsing comes next.
2023-02-07 17:25:31 +00:00
bors
57ea9826b5
Auto merge of #13991 - vasilev-alex:add-braces-assist, r=Veykril
...
feat: add braces assist
This assist adds support for adding braces where it may be appropriate (e.g. lambda expressions)
![ex](https://user-images.githubusercontent.com/4973437/213783924-7c8a8ab5-6a52-4d80-837c-cf2a9b56f061.gif )
2023-02-07 17:12:01 +00:00
Lukas Wirth
a756c9ad08
Fixup comments
2023-02-07 18:08:05 +01:00
Duong Quoc Khanh
370ba94ca2
Add more tests.
...
Add tests for control flows and `let`.
2023-02-08 01:50:09 +09:00
Lukas Wirth
27cd509558
fix jointess for floats not being set properly
2023-02-07 17:41:16 +01:00
Lukas Wirth
e59487de38
Add tests for float access macro call inputs
2023-02-07 17:12:24 +01:00
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
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
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
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
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
Lukas Wirth
dab685dd87
De-magic number parser::Output encoding
2023-02-03 11:47:33 +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
Ryo Yoshida
98c8077495
fix: support non-ascii characters in case conversion
2023-02-03 18:11:11 +09: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
Laurențiu Nicola
ff340f9c21
Bump zip
2023-02-01 19:24:32 +02: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
hkalbasi
0bf0d937b8
unsize cast array only on pointer type
2023-01-31 20:23:38 +03:30
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
bors
577e839c0d
Auto merge of #14063 - Veykril:proc-macro-abi-1-58, r=Veykril
...
feat: Remove support for 1.58 proc-macro abi
This seems old enough that we can drop the support for it now, the less ABIs we have the less work it is adjusting our span implementation.
Extracted from https://github.com/rust-lang/rust-analyzer/pull/14061 , will rebase that over this once merged.
2023-01-31 11:17:29 +00:00
bors
06981d4b10
Auto merge of #14062 - WaffleLapkin:сurrent_edition, r=Veykril
...
internal: Set "current" edition to 2021
:p
2023-01-31 11:03:49 +00:00
Lukas Wirth
183f171263
Remove support for 1.58 proc-macro abi
2023-01-31 11:56:12 +01:00
Maybe Waffle
249ea9502d
Set "current" edition to 2021
2023-01-31 10:51:43 +00:00
bors
b4832b3d00
Auto merge of #14056 - Veykril:allow_internal_unsafe, r=Veykril
...
Parse macros `allow_internal_unsafe` attribute
We don't use it for anything yet but it might become part of hygiene
2023-01-31 10:50:47 +00:00
bors
be76f357af
Auto merge of #14034 - lnicola:tweak-change-collapsing, r=Veykril
...
internal: Tweak change collapsing
CC https://github.com/rust-lang/rust-analyzer/pull/14025#discussion_r1087946555 .
2023-01-31 10:37:50 +00:00
gftea
fd1a9a93fe
tidy by rustfmt
2023-01-30 20:34:07 +01:00
gftea
04a4ac1cff
trim trailing whitespaces
2023-01-30 20:17:12 +01:00
gftea
5356a8b157
trim trailing whitespaces ( #14044 )
2023-01-30 20:03:50 +01:00
gftea
75676ebe86
Update crates/ide/src/file_structure.rs
...
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2023-01-30 19:17:48 +01:00
gftea
28b7460db1
fix negative trait bound in outline view ( #14044 )
2023-01-30 17:57:27 +01:00
Jonas Schievink
6321b25a21
Apply the assist to itself
2023-01-30 17:52:15 +01:00
Jonas Schievink
1f20804b6e
Improve "match to let-else" assist
2023-01-30 17:50:02 +01:00
Lukas Wirth
c65782e64a
Parse macros allow_internal_unsafe attribute
2023-01-30 15:41:08 +01:00
Laurențiu Nicola
deff5f22f6
Tweak change collapsing
2023-01-29 17:20:22 +02:00
Jonas Schievink
cad4cb38cd
Make it work with Self { .. }
2023-01-27 19:25:31 +01:00
Jonas Schievink
e993072661
Provide signature help when typing record literal
2023-01-27 19:17:23 +01:00
Jonas Schievink
e7a2d13ff6
Fix "add missing impl members" assist for impls inside blocks
2023-01-27 16:51:55 +01:00
bors
0063e89469
Auto merge of #14038 - Veykril:no-sysroot-hard-err, r=Veykril
...
Don't fail workspace loading if sysroot can't be found
2023-01-27 13:03:45 +00:00
Lukas Wirth
b2598f4801
Don't fail workspace loading if sysroot can't be found
2023-01-27 13:49:28 +01:00
Lukas Wirth
6829190611
Handle boolean scrutinees in match <-> if let replacement assists better
2023-01-27 12:33:40 +01:00
Lukas Wirth
4ff6f3845f
Update ide test outputs
2023-01-27 11:40:44 +01:00
Lukas Wirth
4b4eabad3c
Record method resolution for try expressions
2023-01-27 11:25:34 +01:00
Lukas Wirth
a7f81e3cdc
Record method resolution for index expressions
2023-01-27 11:15:05 +01:00
Lukas Wirth
54da0bfbf0
Record method resolution for call expressions
2023-01-27 11:06:41 +01:00
bors
9814d79841
Auto merge of #14035 - Veykril:ast-id-arg, r=Veykril
...
minor: Remove unnecessary arg in `LowerCtx::ast_id`
2023-01-26 15:37:10 +00:00
Lukas Wirth
4a677e91aa
minor: Remove unnecessary arg in LowerCtx::ast_id
2023-01-25 21:52:28 +01:00
bors
dd673eea33
Auto merge of #14025 - Veykril:changekind-fix, r=jonas-schievink
...
fix: Fix process-changes not deduplicating changes correctly
probably fixes https://github.com/rust-lang/rust-analyzer/issues/12873 (will close it with this nevertheless as its not really reproducible)
2023-01-25 15:43:01 +00:00
bors
6fd5769996
Auto merge of #14011 - bvanjoi:fix-unwrap-block, r=jonas-schievink
...
fix(ide-assists): unwrap block when it parent is let stmt
fix #13990
2023-01-25 15:04:03 +00:00
Lukas Wirth
d712e52940
fix: Fix process-changes not deduplicating changes correctly
2023-01-25 15:01:15 +01:00
bors
46084a1e71
Auto merge of #14015 - vasilev-alex:lifetime-rename, r=Veykril
...
Don't include lifetime or label apostrophe when renaming
Closes #13907
2023-01-25 13:57:29 +00:00
bvanjoi
90b1222b0b
fix(ide-assists): unwrap block when it parent is let stmt
2023-01-25 10:25:59 +08:00
Nathaniel Brough
6c4749e8f5
fix(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-01-24 10:54:10 -08:00
Alex Vasilev
3c898dd9a1
fix
2023-01-24 23:22:30 +05:30
bors
cd4ac0d87b
Auto merge of #14020 - Veykril:search-fix, r=Veykril
...
fix: Fix assoc item search finding unrelated definitions
Fixes https://github.com/rust-lang/rust-analyzer/issues/14014
2023-01-24 13:11:30 +00:00
Lukas Wirth
951ee3d0b5
fix: Fix assoc item search finding unrelated definitions
2023-01-24 14:11:02 +01:00
Ryo Yoshida
e9f14c505f
Remove TypeWalk
and use TypeFlags
instead
2023-01-24 19:44:58 +09:00
Alex Vasilev
5d013a79d6
exclude '
2023-01-24 13:19:20 +05:30
Alex Vasilev
5f1796f837
uncomment check
2023-01-24 12:45:51 +05:30
Alex Vasilev
8678b92218
Allow renaming lifetiems and labels without leading apostrophe
2023-01-24 12:43:13 +05:30
bors
c552e5a55f
Auto merge of #14004 - lowr:patch/no-need-to-escape-non-snippet, r=Veykril
...
Don't escape non-snippets in assist
I was misunderstanding that we're always sending snippets as response to assist request. For assists that never return snippets like `move_const_to_impl` we don't need to escape, and I don't think `utils::escape_non_snippet()` is useful at the moment since we guarantee that only a single edit will have `InsertTextFormat.Snippet` and we have `utils::render_snippet()` for that.
2023-01-23 16:32:53 +00:00
Lukas Wirth
b9fe5afb30
Add a 'open server logs' button to the error notification
2023-01-23 13:24:42 +01:00
Lukas Wirth
84239a1454
REplace soft breaks in markdown with spaces
2023-01-23 12:21:23 +01:00
Ryo Yoshida
01d8b8947c
Don't escape non-snippets in assist
2023-01-23 00:22:46 +09:00
Alex Vasilev
2a4837089e
fixes
2023-01-21 23:42:11 +05:30
Lukas Wirth
f8ed4d7ae4
Use lang item resolution instead of known paths
2023-01-21 19:03:36 +01:00
Lukas Wirth
1535881836
Replace SmolStr usage with lang item enum for lang items
2023-01-21 17:55:45 +01:00
bors
1afa032f34
Auto merge of #13996 - lnicola:bump-deps, r=lnicola
...
minor: Bump deps
2023-01-21 12:27:40 +00:00
Laurențiu Nicola
8f678a0169
Bump snap
2023-01-21 14:05:22 +02:00
Laurențiu Nicola
1431264646
Bump rayon
2023-01-21 14:05:22 +02:00
Laurențiu Nicola
25a5bd9b13
Bump object
2023-01-21 14:05:22 +02:00
Laurențiu Nicola
f2397638f5
Bump arbitrary and derive-arbitrary
2023-01-21 14:05:22 +02:00
Laurențiu Nicola
d26c8ccc89
Bump num_cpus
2023-01-21 08:49:50 +02:00
Laurențiu Nicola
392a6ee422
Bump once_cell
2023-01-21 08:48:46 +02:00
bors
303737dad7
Auto merge of #13989 - Veykril:hover, r=Veykril
...
internal: Remove hover fallback in favor of ranged hover
The fallback is usually more annoying than useful at this point (it messes with the range of diagnostic popups a lot), we now have a ranged hover to check the type of something which works a lot better.
Closes https://github.com/rust-lang/rust-analyzer/issues/11602
2023-01-20 22:00:22 +00:00
Lukas Wirth
4685b97f74
Remove hover fallback in favor of ranged hover
2023-01-20 21:52:05 +01:00
Alex Vasilev
dd9dcca7a2
assist id fix
2023-01-21 00:47:02 +05:30
Alex Vasilev
1ab58b190e
cargo test
2023-01-21 00:42:29 +05:30
Alex Vasilev
ddb2f8760b
typo fix
2023-01-21 00:30:38 +05:30
Alex Vasilev
69ffbe25a1
feat: add braces assist
2023-01-21 00:17:23 +05:30
Lukas Wirth
a542bd46bf
Split out some hover functions
2023-01-20 16:30:08 +01:00
bors
ce67dea2ac
Auto merge of #13988 - Veykril:hover-no-markdown, r=Veykril
...
Fix markdown removal in hover handling whitespace weirdly
Fixes https://github.com/rust-lang/rust-analyzer/issues/10028
2023-01-20 15:23:54 +00:00
Lukas Wirth
c5b1e3f2ae
Fix markdown removal in hover handling whitespace weirdly
2023-01-20 14:29:12 +01:00
bors
d46d012c38
Auto merge of #13978 - bvanjoi:array-match, r=Veykril
...
feat: array match
fixed https://github.com/rust-lang/rust-analyzer/issues/13970
2023-01-20 10:30:18 +00:00
bvanjoi
8fa69f9f7d
feat: array match
2023-01-20 10:59:30 +08:00
Maria José Solano
f7fcdb6218
Order alphabetically
2023-01-19 18:34:01 -08:00
Maria José Solano
d044bc3504
Format code
2023-01-19 18:33:47 -08:00
Maria José Solano
d5fb7a4ba4
Limit number of completions
2023-01-19 18:23:21 -08:00
Maria José Solano
ec89fc85a8
Add limit setting
2023-01-19 18:21:43 -08:00
bors
6e52c64031
Auto merge of #13985 - Veykril:content-modified, r=Veykril
...
Don't respond with a ContentModified while loading the workspace
Initially this was done to prevent frequent inlay hint flickering, but this causes a lot of problems for a bunch of clients. We can (and already kind of have) move this into the semantic token request handlers instead.
Fixes https://github.com/rust-lang/rust-analyzer/issues/10910
2023-01-19 21:00:26 +00:00
Lukas Wirth
7385467f2e
Don't respond with a ContentModified while loading the workspace
2023-01-19 21:52:27 +01:00
bors
56fb0cad6d
Auto merge of #13984 - Veykril:target-data-layout, r=Veykril
...
fix: Fix target-data-layout fetching incorrectly passing 'rustc' to rustc
2023-01-19 20:45:29 +00:00
Lukas Wirth
384fa4b84a
fix: Fix target-data-layout fetching incorrectly passing 'rustc' to rustc
2023-01-19 21:31:08 +01:00
onestacked
872408500b
Parse const_closures syntax.
...
Enables parsing of the syntax for `#![features(const_closures)]` introduced in https://github.com/rust-lang/rust/pull/106004
2023-01-19 15:40:07 +01:00
Lukas Wirth
c9d33cddc9
Don't run flycheck on startup unless checkOnSave is enabled
2023-01-18 21:38:30 +01:00
Lukas Wirth
1e4a182954
Fix checkOnSave to check config patching not always working
2023-01-18 20:29:55 +01:00
Laurențiu Nicola
210757769d
Fix replace_arith label
2023-01-17 16:31:34 +02:00
Ryo Yoshida
c53064fb58
Enforce builtin binop expectations even without lang items
2023-01-17 20:17:15 +09:00
Ryo Yoshida
461435adab
Enforce builtin binop expectations on single references
...
Also don't enforce them on non-builtin types
2023-01-17 20:17:09 +09:00
bors
fa874627f0
Auto merge of #13969 - Veykril:workspace.dependencies, r=Veykril
...
Use workspace.dependencies to declare local dependencies
2023-01-17 10:29:27 +00:00
bors
62907858d5
Auto merge of #13964 - Veykril:workspace.package, r=Veykril
...
Specify authors, edition, license and rust-versian via workspace.package
2023-01-17 10:13:24 +00:00
Lukas Wirth
bed4db3c62
Use workspace.dependencies to declare local dependencies
2023-01-17 10:52:26 +01:00
bors
e11c0e3e85
Auto merge of #13966 - HKalbasi:layout, r=Veykril
...
Don't compute layout if `TargetDataLayout` is not available
2023-01-17 09:39:32 +00:00
hkalbasi
ec65b3b3aa
fix tests
2023-01-16 23:45:12 +03:30
hkalbasi
77efa0267d
Don't compute layout if TargetDataLayout
is not available
2023-01-16 22:43:27 +03:30
bors
455ef0c806
Auto merge of #13935 - ModProg:assist_desugar_doc_comment, r=Veykril
...
Assist: desugar doc-comment
My need for this arose due to wanting to do feature dependent documentation and therefor convert parts of my doc-comments to attributes.
Not sure about the pub-making of the other handlers functions, but I didn't think it made much sense to reimplement them.
2023-01-16 19:11:19 +00:00
Roland Fredenhagen
ec06313a6d
fix test for required_hashes
2023-01-16 19:25:30 +01:00
Roland Fredenhagen
5e66e49c73
move required_hashes into utils
2023-01-16 18:39:16 +01:00
Lukas Wirth
e4858fe480
Specify authors, edition and license via workspace.package
2023-01-16 16:44:00 +01:00
Lukas Wirth
679df2adf1
Specify rust-version via workspace.package
2023-01-16 16:33:01 +01:00
Lukas Wirth
3a95864df5
Unconditionally enable location links in inlay hints again
2023-01-16 16:04:38 +01:00
bors
5306eb06cc
Auto merge of #13947 - WaffleLapkin:adjustment_hint_tooltips, r=Veykril
...
Add basic tooltips to adjustment hints
![2023-01-16_16-45](https://user-images.githubusercontent.com/38225716/212681383-a60b60bb-a8e7-410d-8b24-f6b72c197311.png )
I'm not sure how to make them look nicer, but it's at least something.
2023-01-16 13:11:16 +00:00
Maybe Waffle
81d7e302ed
Add basic tooltips to adjustment hints
2023-01-16 12:44:39 +00:00
Ryo Yoshida
fc56cacfc1
Test TraitRef
equality before generating missing impl method body
2023-01-16 20:55:56 +09:00
Ryo Yoshida
8afaaa54b0
Add TraitRef
for HIR
2023-01-16 20:55:51 +09:00
Niels Sascha Reedijk
8aa1d2d789
Update command-group from 1.0.8 to 2.0.1
...
With #13552 the depencency of on the command-group crate was introduced, which also
introduced a dependency on nix. That version of nix does not build on Haiku. This
change introduces a newer version of command-group, which also updates nix from
0.22.3 to 0.26.1, which is compatible on Haiku.
2023-01-15 08:20:25 +00:00
Maybe Waffle
a7787533af
Use the fact that Either
: AstNode
2023-01-14 15:20:32 +00:00
bors
c78b9f0068
Auto merge of #13949 - WaffleLapkin:either_ast_node, r=Veykril
...
minor: implement `AstNode` for `Either`
Makes code a little bit nicer
2023-01-14 13:50:11 +00:00
bors
ce86f12e8d
Auto merge of #13945 - bvanjoi:orpat-match, r=lnicola
...
fix: check orpat in missing match
fixed #13942
2023-01-14 13:37:30 +00:00
bors
8800ea6461
Auto merge of #13950 - WaffleLapkin:iterate_over_arrays_directly, r=Veykril
...
minor: Iterate over arrays dirrectly, instead of going through a slice
Minor code improvement.
2023-01-14 13:08:36 +00:00
Maybe Waffle
bd04416aaa
Iterate over arrays dirrectly, instead of going through a slice
2023-01-14 13:02:28 +00:00
bors
6673e515b7
Auto merge of #13948 - Veykril:inlay-hints, r=Veykril
...
Make inlay hint location links work for more types
2023-01-14 12:50:26 +00:00
Maybe Waffle
cfc01150bf
implement AstNode
for Either
2023-01-14 12:45:20 +00:00
Lukas Wirth
27ba598dfe
Make inlay hint location links work for more types
2023-01-14 13:30:56 +01:00
bors
ce6955c10e
Auto merge of #13946 - Veykril:inlay-hints, r=Veykril
...
Remove hover inlay tooltips, replace them with location links
Turns out we re-implemented what clients can already figure out through the use of location-links. We might want lazy resolves tooltips later on still, but for now this simplifies things again.
2023-01-14 12:22:43 +00:00
Lukas Wirth
f2444b2a40
Remove unnecessary Hint suffix on InlayKind variants
2023-01-14 13:08:45 +01:00
Lukas Wirth
60075a6625
Remove hover inlay tooltips, replace them with location links
2023-01-14 12:19:29 +01:00
bvanjoi
e9724e55df
fix: check orpat in missing match
2023-01-14 18:54:45 +08:00
bors
32be158630
Auto merge of #13941 - matklad:rpj, r=Veykril
...
internal: explain the idea behind rust-project.json
2023-01-14 09:40:40 +00:00
Lukas Wirth
aafb0f1f8d
Use smallvec for inlay-hint parts
2023-01-13 15:03:37 +01:00
bors
a119352ada
Auto merge of #13937 - danieleades:recursive-display, r=lnicola
...
remove recursive 'Display' implementations
closes #13920
`@lnicola` is this the solution you were looking for?
having explicitly unimplemented methods seems preferable to apparently implemented methods that can't be called
2023-01-13 12:07:28 +00:00
Alex Kladov
bd350085f6
Update crates/project-model/src/project_json.rs
...
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2023-01-13 12:01:04 +00:00
Alex Kladov
87315ef5c3
Apply suggestions from code review
...
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2023-01-13 11:57:02 +00:00
bors
15fb082cc1
Auto merge of #13753 - kdy1:limit, r=lnicola
...
fix: Increase token limit of proc macro
Fixes #13738
[The swc project](https://swc.rs ) has lots of type definitions, and the current limit is too low for the ECMAScript/CSS visitors.
[rustdoc](https://rustdoc.swc.rs/swc_ecma_visit )
---
With this fix, the rust-analyzer shows trait-related actions.
<img width="1840" alt="image" src="https://user-images.githubusercontent.com/29931815/206839269-d7a04589-7dba-449b-ad0b-1f69d52bd039.png ">
2023-01-13 11:45:50 +00:00
Aleksey Kladov
aa73366b0b
internal: explain the idea behind rust-project.json
2023-01-13 11:44:02 +00:00
bors
cdbe025232
Auto merge of #13922 - danieleades:loop-that-never-loops, r=lnicola
...
minor: loop-that-never-loops
closes #13921
2023-01-13 11:23:51 +00:00
Neel Yadav
9721505bf1
Fix panicking Option unwraping in match arm analysis
2023-01-12 22:33:58 -06:00
bors
fb39efe26c
Auto merge of #13934 - Veykril:unlinked-file-inline-modules, r=Veykril
...
feat: Make unlinked_file diagnostic quickfixes work for inline modules
Finally got myself to fix this, bothered me quite a bit that this never worked
![Code_Qe3WlMvt5Q](https://user-images.githubusercontent.com/3757771/211927799-023e48ee-7cdd-4dd7-8e25-a23eddc7d897.gif )
(Just gotta fix up the indentation still)
2023-01-12 15:25:12 +00:00
Daniel Eades
c4b36b64aa
remove recursive 'Display' implementations
2023-01-12 11:53:45 +00:00
Daniel Eades
7413a9954f
interior-mutable types should be 'static' rather than 'const
2023-01-12 10:48:10 +00:00
Lukas Wirth
14777ce751
fix indentation of unlinked_file quickfix
2023-01-12 11:24:44 +01:00
Roland Fredenhagen
03bc46f96b
Convert pub to pub(crate)
2023-01-12 09:54:48 +01:00
Roland Fredenhagen
6f201cfc56
Assist: desugar doc-comment
2023-01-12 02:28:13 +01:00
Lukas Wirth
5214a98d9c
Simplify
2023-01-11 23:04:35 +01:00
Lukas Wirth
1ce3e820dc
feat: Make unlinked_file diagnostic quickfixes work for inline modules
2023-01-11 22:39:05 +01:00
Lukas Wirth
bb4e272d8a
Refine search for const and function assoc items
2023-01-11 17:10:04 +01:00
daniel.eades
a3114c3697
move loop index inside iterator
2023-01-11 16:07:35 +00:00
bors
f32f64bffc
Auto merge of #13929 - danieleades:simplify, r=lnicola
...
internal: a number of code simplifications
2023-01-11 09:38:34 +00:00
Albert Larsan
3e0e51c108
Change src/test
to tests
in source files, fix tidy and tests
2023-01-11 09:32:13 +00:00
bors
75877d78d9
Auto merge of #13897 - bvanjoi:nearest-block-search, r=Veykril
...
fix(ty): should query impls in nearest block
fix https://github.com/rust-lang/rust-analyzer/issues/13895
2023-01-10 22:44:29 +00:00
Daniel Eades
d218b237fd
collapse some nested blocks
2023-01-10 20:40:08 +00:00
Daniel Eades
95fc3ba41c
fixup
2023-01-10 19:51:21 +00:00
Daniel Eades
5b1cd8245f
fixup
2023-01-10 19:44:19 +00:00