OleStrohm
ad0a6bf1a3
Added consteval tests
2022-09-12 20:20:43 +01:00
OleStrohm
2f84b6e2e5
Almost there
2022-09-12 20:20:22 +01:00
OleStrohm
b63234e20b
Cleaned up code
2022-09-12 20:19:49 +01:00
OleStrohm
997fc46efa
Implemented basic enum const eval
2022-09-12 20:19:13 +01:00
bors
b1a4ba3e84
Auto merge of #13223 - lowr:fix/hir-proj-normalization, r=flodiebold
...
fix: handle lifetime variables in projection normalization
Fixes #12674
The problem is that we've been skipping the binders of normalized projections assuming they should be empty, but the assumption is unfortunately wrong. We may get back lifetime variables and should handle them before returning them as normalized projections. For those who are curious why we get those even though we treat all lifetimes as 'static, [this comment in chalk](d875af0ff1/chalk-solve/src/infer/unify.rs (L888-L908)
) may be interesting.
I thought using `InferenceTable` would be cleaner than the other ways as it already has the methods for canonicalization, normalizing projection, and resolving variables, so moved goal building and trait solving logic to a new `HirDatabase` query. I made it transparent query as the query itself doesn't do much work but the eventual call to `HirDatabase::trait_solve_query()` does.
2022-09-12 14:24:57 +00:00
Ryo Yoshida
efb56160c9
fix: handle lifetime variables in projection normalization
2022-09-12 22:52:58 +09:00
bors
e38dfe5536
Auto merge of #13186 - enomado:master, r=Veykril
...
Filter imports on find-all-references
Attempt to #13184
2022-09-12 12:09:57 +00:00
Mathew Horner
8a2803d9ae
Allow configuration of annotation location.
...
Previously, annotations would only appear above the name of an item (function signature, struct declaration, etc).
Now, rust-analyzer can be configured to show annotations either above the name or above the whole item (including doc comments and attributes).
2022-09-11 22:40:33 -05:00
Stanislav
f7f4792f4f
fixes
2022-09-09 20:58:06 +03:00
bors
4e1a3da8f2
Auto merge of #13158 - jonas-schievink:inlayhint-links, r=jonas-schievink
...
feat: make clicking a closing brace inlay hint go to the opening brace
2022-09-08 16:38:40 +00:00
Jonas Schievink
064c9ef9e2
Make clicking closing brace hint go to the opening brace
2022-09-08 17:25:28 +02:00
Stanislav
9f6553e1d6
add config for import filtering
2022-09-08 01:53:20 +03:00
Stanislav
eba54c2fc9
pretty solition works
2022-09-07 04:09:25 +03:00
Stanislav
92d54f9b30
typo and draft
2022-09-07 03:24:55 +03:00
Stanislav
bd0eeb3f04
Update crates/ide/src/references.rs
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-09-07 03:01:06 +03:00
bors
5be2e6574d
Auto merge of #13185 - ChayimFriedman2:insert-ws-in-static-const-macro, r=Veykril
...
fix: Insert whitespaces into static & const bodies if they are expanded from macro on hover
Partially fixes #13143 .
To resolve the other part we need to expand macros in unevaluated static & const bodies, and I'm not sure we want to. If for example it includes a call to `assert!()`, expanding it will lead to worse hover.
2022-09-05 11:10:40 +00:00
Stanislav
6001e7dfb1
fix
2022-09-04 19:45:50 +03:00
Stanislav
ba40aa72ac
Update crates/ide/src/references.rs
...
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2022-09-04 19:41:06 +03:00
Stanislav
29729abc3c
Retain imports on find-all-references
2022-09-04 19:14:52 +03:00
Chayim Refael Friedman
26b5f1f92f
Do not insert a newline after ;
if the next token is a }
...
This creates double newline.
2022-09-04 14:33:15 +00:00
Chayim Refael Friedman
e295f0c29c
Insert whitespaces into static & const bodies if they are expanded from macro on hover
...
Macro expansion erases whitespace information, and so we end with invalid Rust code.
2022-09-04 14:33:15 +00:00
Jonas Schievink
241807dbf9
Allow multi-part inlay hint labels with location links
2022-08-31 18:34:10 +02:00
bors
56d888689b
Auto merge of #12793 - lowr:fix/12739, r=Veykril
...
fix: sort and deduplicate auto traits in trait object types
Fixes #12739
Chalk solver doesn't sort and deduplicate auto traits in trait object types, so we need to handle them ourselves in the lowering phase, just like [`rustc`](880416180b/compiler/rustc_typeck/src/astconv/mod.rs (L1487-L1488)
) and [`chalk-integration`](https://github.com/rust-lang/chalk/blob/master/chalk-integration/src/lowering.rs#L575 ) do.
Quoting from [the Chalk book](https://rust-lang.github.io/chalk/book/types/rust_types.html#dyn-types ):
> Note that -- for this purpose -- ordering of bounds is significant. That means that if you create a `dyn Foo + Send` and a `dyn Send + Foo`, chalk would consider them distinct types. The assumption is that bounds are ordered in some canonical fashion somewhere else.
Also, trait object types with more than one non-auto traits were previously allowed, but are now disallowed with this patch.
2022-08-31 08:28:12 +00:00
Ryo Yoshida
7ecead23c8
fix: sort and deduplicate auto traits in trait object types
2022-08-30 20:52:42 +09:00
bors
ca8093e282
Auto merge of #13116 - Veykril:nohash, r=Veykril
...
Make use of NoHash hashing for FileId and CrateId
Both of these are mere integers so there is nothing to hash here.
Ideally we would use this for `la_arena::Idx` too, but that doesn't work due to the orphan rule, and `la_arena` is unfortunately a public library so we can't really do much here... Unless we remove the trait restriction but I'd like not to
2022-08-25 19:08:57 +00:00
Lukas Wirth
d025c5d8d6
Make use of NoHash hashing for FileId and CrateId
2022-08-25 20:41:49 +02:00
Jonas Schievink
322e7060de
Resolve doc links on impl blocks
2022-08-23 17:50:45 +02:00
Lukas Wirth
f6f0516603
Add config for macro bang token highlighting, disable by default
2022-08-23 14:05:56 +02:00
Lukas Wirth
9700c95ced
Make doc comment highlight injection configurable
2022-08-23 14:05:55 +02:00
Lukas Wirth
9a201873b8
Move highlight configuration from protocol into the feature
2022-08-23 14:05:55 +02:00
Lukas Wirth
16315edaee
Make punctuation highlighting configurable, disable it by default
2022-08-23 14:05:55 +02:00
TJ DeVries
50ecb09da4
feat: emit SCIP via rust-analyzer
2022-08-22 15:13:46 -04:00
bors
1da9156b0d
Auto merge of #12982 - jridgewell:into_future, r=Veykril
...
Implement IntoFuture type inference
One of my projects is using [IntoFuture](https://doc.rust-lang.org/std/future/trait.IntoFuture.html ) to make our async code a little less verbose. However, rust-analyzer can't infer the output type of an await expression if the value uses `IntoFuture` to convert into another type. So we're getting `{unknown}` types everywhere since switching.
`foo.await` itself [desugars](e4417cf020/compiler/rustc_ast_lowering/src/expr.rs (L644-L658)
) into a `match into_future(foo) {}`, with every `Future` impl getting a [default](e4417cf020/library/core/src/future/into_future.rs (L131-L139)
) `IntoFuture` implementation. I'm not sure if we want to disable the old `future_trait` paths, since this only recently [stabilize](https://github.com/rust-lang/rust/pull/98718 ).
2022-08-18 07:37:47 +00:00
Justin Ridgewell
cebf95718c
Find IntoFuture::IntoFuture's poll method
2022-08-16 17:53:10 -04:00
Jonas Schievink
0616cee92b
Add a setting for keyword hover popups
2022-08-16 16:51:40 +02:00
bors
6d6201299c
Auto merge of #13025 - Veykril:simplify2, r=Veykril
...
Simplify
2022-08-15 14:40:26 +00:00
Lukas Wirth
3f149a63d2
Simplify
2022-08-15 16:40:10 +02:00
Jonas Schievink
dcbe892d7c
Add an HIR pretty-printer
2022-08-15 13:51:45 +02:00
Ryo Yoshida
ba6db3e9b0
Add test for runnables with raw identifiers
2022-08-11 03:41:23 +09:00
KaDiWa
232176b46a
remove imports that are also in edition 2021's prelude
2022-08-09 01:16:32 +02:00
Laurențiu Nicola
eca6f2e897
Fix test_rainbow_highlighting gate
2022-08-07 09:29:26 +03:00
bors
97038e55cf
Auto merge of #12949 - Veykril:token-pick, r=Veykril
...
fix: Fix incorrect token pick rankings
2022-08-05 13:06:10 +00:00
Lukas Wirth
6bf674c8e4
fix: Fix incorrect token pick rankings
2022-08-05 14:59:26 +02:00
Lukas Wirth
d6e78b04d0
feat: Handle operators like their trait functions in the IDE
2022-08-05 14:16:36 +02:00
Jean santos
5698e51027
tidy formatting
2022-08-04 09:28:34 -03:00
Jean santos
49dac4070c
on hover fallback error, adds ast::type as possible node
2022-08-03 17:37:11 -03:00
Jonas Schievink
bd7dfac5eb
Fix r-a spelling in some places
2022-08-01 13:47:09 +02:00
Ryo Yoshida
d40ab66186
fix: remove whitespaces from doctest names
2022-08-01 17:57:47 +09:00
Lukas Wirth
618cfd792c
fix: Fix ast-id up when merging raw attributes
2022-07-30 09:43:30 +02:00
Laurențiu Nicola
948c9afc73
Only run rainbow highlighting test on 64-bit Unix
2022-07-28 21:03:59 +03:00
Lukas Wirth
ddad2847ab
Allow name querying for derive helpers
2022-07-26 09:27:22 +02:00
Lukas Wirth
aa1491ecde
Record derive helper attributes, resolve them in IDE layer
2022-07-26 09:26:51 +02:00
Lukas Wirth
4e60db2d07
feat: Downmap tokens inside derive helpers
2022-07-26 09:26:47 +02:00
Amos Wenger
0bffdf2627
Disable all source-gen tests at compile time
2022-07-24 10:38:28 +02:00
Lukas Wirth
1ab862a628
fix: Improve syntax highlighting in attributes
2022-07-22 17:29:03 +02:00
Amos Wenger
7e285e1ef5
Run cargo fmt
2022-07-20 15:06:15 +02:00
Amos Wenger
816f7fe12a
Run cargo fix --edition-idioms
2022-07-20 15:02:08 +02:00
Amos Wenger
23d25a3094
Enable extra warnings required by rust-lang/rust
2022-07-20 15:00:17 +02:00
Lukas Wirth
bb4bfae422
fix: Fix search for associated trait items being inconsistent
2022-07-20 13:59:31 +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
bors
22e53f1d33
Auto merge of #12549 - bitgaoshu:goto_where_trait_m_impl, r=Veykril
...
feat: Go to implementation of trait methods
try goto where the trait method implies, #4558
2022-07-18 16:29:23 +00:00
bors
db6a85d358
Auto merge of #12778 - Logarithmus:feature/fix-negative-const-generics, r=flodiebold
...
Support negative, `char` & `bool` const generics
Before:
![Before](https://user-images.githubusercontent.com/29541480/179379832-0c3b2a74-fef6-427e-b89f-7e31d9c37b3d.png )
After:
![After](https://user-images.githubusercontent.com/29541480/179379863-b62475dd-e7bf-41f2-b437-08dfe55951af.png )
I tried to implement stuff like `Const<{NUM1 + 3 + NUM2}>` by using already existing constant evaluation mechanism for ordinary constants, but turned out to be harder than I thought, maybe because I've never ever tinkered with compilers before
2022-07-17 17:17:39 +00:00
Artur Sinila
a96f0aa7cd
feat: support negative const generic parameters
...
* feat: support `bool` & `char` const generics
2022-07-17 04:18:53 +03:00
Artur Sinila
b9b42e8670
tests: add hover tests for const generics
2022-07-17 02:13:09 +03:00
bors
766c5f0861
Auto merge of #12689 - Veykril:macro-rec, r=Veykril
...
internal: Record all macro definitions in ItemScope
Fixes https://github.com/rust-lang/rust-analyzer/issues/12100
Doesn't resolve the shadowing issues though, fixing those is gonna be really tricky I believe unless we can come up with a nice scheme to "order" item tree items (using syntax ranges and file ids would be a pain and also a bad idea since that'll require us to potentially reparse files in collection).
2022-07-16 16:45:26 +00:00
bors
ac526e029a
Auto merge of #12712 - harpsword:fix-rename-crate-root, r=Veykril
...
fix: ignore renames for crate root
close #12684 . I just ignore renames for crate root in `rename_mod` func.
2022-07-16 16:28:41 +00:00
Lukas Wirth
7ff6c36716
fix: Don't show qualified path completions for private items
2022-07-15 13:30:43 +02:00
hi-rustin
d9ab7f21e4
Fix typos
...
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-07-11 21:42:05 +08:00
harpsword
4b3164f129
fix: ignore renames for crate root
2022-07-10 10:45:03 +08:00
Jonas Schievink
6c6ae965ba
Update remaining GitHub URLs
2022-07-08 15:44:49 +02:00
Lukas Wirth
db49ac8734
internal: Record all macro definitions in ItemScope
2022-07-05 11:28:47 +02:00
Laurențiu Nicola
e6fcb23445
Bump either
2022-07-03 10:09:35 +03:00
Laurențiu Nicola
212f84ab46
Bump crossbeam-channel
2022-07-03 09:56:58 +03:00
Lukas Wirth
531e152390
fix: Simplify macro statement expansion handling
2022-07-01 14:49:30 +02:00
Ryo Yoshida
36d2b43dfd
fix: improve whitespace insertion in pretty printer
2022-06-28 20:44:55 +09:00
bitgaoshu
dcb4837b2d
WellFormed -> Holds
2022-06-26 23:09:06 +08:00
bitgaoshu
408fa148b9
add test for item same name
2022-06-26 22:48:26 +08:00
bitgaoshu
353829fc4e
highlight: trait path
2022-06-24 23:04:35 +08:00
bitgaoshu
9e6bff79f4
fix some test due to resolve to where trait m impl
2022-06-24 19:15:16 +08:00
bitgaoshu
6ecabe352a
functions resolve to impl
2022-06-24 19:11:35 +08:00
Raymond Luo
5107123f9a
clarify comment and add autolink test case
2022-06-23 19:02:30 -04:00
Florian Diebold
f410fdf6e3
Add two more tests
2022-06-23 14:49:05 +02:00
bitgaoshu
1ef5e14c2c
goto where trait method impl
2022-06-23 14:01:22 +02:00
Raymond Luo
96ff235770
condense matches on autolink
2022-06-22 22:07:26 -04:00
Raymond Luo
b7e3f525bd
handle autolink as edge case
2022-06-20 23:15:27 -04:00
Raymond Luo
c6f776c5f9
determine doc link type from start instead of text or code
2022-06-20 21:10:45 -04:00
harpsword
3a78cc5e67
feat: add fold range for multi line match arm list
2022-06-18 16:05:56 +08:00
Lukas Wirth
7d51fc4640
Show proc-macro loading errors in unresolved-proc-macro diagnostics
2022-06-15 17:34:01 +02:00
Lukas Wirth
325ceaef19
fix: Check for the correct proc-macro settings in missing proc-macro diagnostics
2022-06-14 11:00:06 +02:00
Lukas Wirth
9b9c13fc40
feat: On assoc item name hover, render trait decl docs
2022-06-13 11:57:33 +02:00
bors
e9d3fe0484
Auto merge of #12502 - Veykril:deps, r=Veykril
...
internal: Bump Dependencies
2022-06-10 19:51:04 +00:00
Lukas Wirth
76ae5434fa
internal: Bump Dependencies
2022-06-10 17:30:02 +02:00
Luke Chu
6079eeb1bf
Hide param inlay hint when argument is fn-like macro with similar name
2022-06-08 14:37:57 +00:00
feniljain
25f3e7a33c
fix: float display impl
2022-05-31 10:13:03 +05:30
bors
a5d7ab54f9
Auto merge of #12418 - Veykril:completions, r=Veykril
...
internal: More precise completion filtering with existing item qualifiers
Now we are approaching the more complex cases for filtering completions
2022-05-30 14:05:37 +00:00
Lukas Wirth
ea594c4c44
Use char for trigger character
2022-05-30 14:17:58 +02:00
Lukas Wirth
aced76d0ff
Add implicit static lifetime hints
2022-05-30 13:59:58 +02:00
bors
9ceaff91d3
Auto merge of #12406 - harpsword:fix-add-inlayHints-closures-without-block, r=Veykril
...
fix: add an option to show inlay hint for return type of closures wit…
fix #12321
2022-05-30 11:36:55 +00:00
bors
bd0c2344f2
Auto merge of #12387 - 00nktk:fix-mod-rename, r=Veykril
...
fix(ide-db): correct single-file module rename
Fixes a bug where rust-analyzer would emit `WorkspaceEdit`s with paths to dirs instead of files for the following project layout.
lib.rs
```rust
mod foo;
```
foo.rs
```rust
mod bar {
struct Bar;
}
```
Also fixes emitted paths for modules with mod.rs.
The bug resulted in panic in helix editor when attempting to rename a module.
2022-05-30 11:29:55 +00:00
yue4u
1b5f0462ed
fix: visibility completion
2022-05-30 00:06:48 +09:00