bors
94ac1cdbf5
Auto merge of #14715 - Veykril:symbol-index, r=Veykril
...
Refactor symbol index
Closes https://github.com/rust-lang/rust-analyzer/issues/14677
instead of eagerly fetching the source data in symbol index we do it lazily now, this shouldn't make it much more expensive as we had to parse the source most of the time anyways even after fetching.
2023-05-02 10:34:53 +00:00
Lukas Wirth
f501c6a516
Refactor symbol index
2023-05-02 12:11:42 +02:00
bors
466b4ec547
Auto merge of #14714 - jhgg:hover/exclude-sized-trait-in-goto-actions, r=Veykril
...
fix: ide: exclude sized in go-to actions in hover
fixes #13163
i opted to just simply omit `Sized` entirely from go-to actions, as opposed to including it if even someone writes an explicit `T: Sized`, as i think a go-to on Sized is of dubious value practically.
2023-05-02 08:30:17 +00:00
Jake Heinz
3132a9e7fc
fix: ide: exclude sized in go-to actions
2023-05-02 08:19:59 +00:00
bors
7d48bbadd4
Auto merge of #14713 - jhgg:fix/do-not-highlight-escapes-in-raw-strings, r=Veykril
...
fix: ide: do not highlight escapes in raw strings
fixes #14688
2023-05-02 07:39:02 +00:00
Jake Heinz
157069e232
fix: ide: do not highlight escapes in raw strings
2023-05-02 07:16:25 +00:00
Lukas Wirth
5a97a326a9
Simplify
2023-05-02 09:05:28 +02:00
Lukas Wirth
8907533536
Highlight defs in highlight related
2023-05-02 08:59:43 +02:00
Lukas Wirth
a64626d99e
Highlight closure captures when cursor is on pipe
2023-05-02 08:59:40 +02:00
hkalbasi
6312fbf521
MIR episode 4
2023-05-01 23:23:10 +03:30
hkalbasi
5df545b3f0
Add hover for closure
2023-04-30 14:31:43 +03:30
Lukas Wirth
e8f5d7620f
fix: Fix status command panicking when additional LRU caches are set up
2023-04-25 10:41:05 +02:00
bors
1379b5fac7
Auto merge of #14630 - Veykril:arc, r=Veykril
...
internal: `Arc<String>` -> `Arc<str>`
2023-04-22 07:58:13 +00:00
Lukas Wirth
f00dcf9a69
internal: Arc<String> -> Arc<str>
2023-04-22 09:48:37 +02:00
bors
11c55b2e27
Auto merge of #14629 - Veykril:stats, r=Veykril
...
internal: Add some additional status ouput
We should be able to use this infra to get a better grasp about what we might want to LRU
2023-04-22 07:35:29 +00:00
Lukas Wirth
63e3bf118d
internal: Add some additional status ouput
2023-04-22 09:34:47 +02:00
Jake Heinz
a497e9a05e
mbe: fix token conversion for doc comments
2023-04-22 03:06:06 +00:00
bors
2400b36a2e
Auto merge of #14577 - jsoref:spelling, r=lnicola
...
Spelling
This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling ).
The misspellings have been reported at https://github.com/jsoref/rust-analyzer/actions/runs/4699991040#summary-12751355796
The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-analyzer/actions/runs/4699991284#summary-12751356293
closes #14567
2023-04-19 14:05:40 +00:00
Josh Soref
bc7d84c3ce
Spelling
...
* a rule
* access
* after
* amount
* annotations
* assignment
* assist
* associated
* attribute
* borrowed
* built-in type
* clarification
* command
* const
* constructor
* corresponding
* counterparts
* curlies
* dependencies
* deterministic
* diagnostic
* duplicates
* edge
* edited
* efficient
* elsewhere
* execution
* expression
* extensions
* extracted
* fill
* github
* helper
* heuristic
* incomplete
* indent end
* inlay
* invocation
* lifetime
* looking
* maybe
* move
* mutability
* mutable
* necessarily
* necessary
* negative
* nonexistent
* occurred
* offsets
* offsetted
* overridden
* parameters
* params
* params_and_where_preds_in_scope
* paredit
* parent
* parentheses
* prepended if
* punctuation
* receive
* receiver
* referring
* repeated
* representing
* semantically
* separately
* shouldnot
* siblings
* similar
* something's
* statement
* struct
* structure
* surprise
* the
* this
* transparent
* unimplemented
* unnamed
* unnecessary
* unneeded
* unreachable
* unterminated
* utilities
* variant
* variants
* visibility
* work around (v)
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-19 09:45:55 -04:00
hkalbasi
f05f7ab082
Add minicore smoke test
2023-04-18 17:38:38 +03:30
Lukas Wirth
a2a3fecae3
Option begone part 2
2023-04-16 19:20:48 +02:00
Lukas Wirth
96a774261f
Option begone part 1
2023-04-16 19:20:42 +02:00
Jonas Schievink
901c8a4259
Map tokens from include!
expansion to the included file
2023-04-13 17:41:24 +02:00
Ryo Yoshida
c978d4bf0c
Implement text edits for inlay hints
2023-04-12 19:03:57 +09:00
Ryo Yoshida
fcbc250723
Add field for text edits to InlayHint
2023-04-12 19:03:55 +09:00
Ryo Yoshida
584d2697cc
Add toolchain
meta for tests
2023-04-11 21:21:10 +09:00
hkalbasi
59b6f2d9f2
Compute closure captures
2023-04-10 23:04:34 +03:30
hkalbasi
c54cb88950
Add bounds for associated types in derive macro
2023-04-07 19:33:14 +03:30
Lukas Wirth
435d585d0c
Revert "Add bounds for fields in derive macro"
2023-04-07 11:01:17 +02:00
hkalbasi
0241b52dad
Add bounds for fields in derive macro
2023-04-07 02:21:46 +03:30
bors
e739c999cd
Auto merge of #14511 - HKalbasi:dev, r=Veykril
...
Always reborrow mutable reference receiver in methods
Dependency of #14470
2023-04-06 21:18:15 +00:00
hkalbasi
7ba93cb8cf
Always reborrow reference receiver in methods
2023-04-07 00:32:28 +03:30
bvanjoi
f0c74b30ed
fix(ide): highlight escapes in char
2023-04-06 23:20:12 +08:00
bors
ea22d245b6
Auto merge of #14499 - DropDemBits:drive-by-fixmes, r=Veykril
...
minor: Fix some simple FIXMEs
Each FIXME fix has been split into its own commit, since they're all pretty independent changes.
(Forgot to open a PR for this a few days ago, oops)
2023-04-05 20:42:55 +00:00
Lukas Wirth
7f0fbf7f9d
Switch crate graph to use an Arena instead of a hashmap
2023-04-05 10:32:02 +02:00
Ryo Yoshida
613e008593
Don't append "!" to non-bang macro name
2023-04-02 20:13:34 +09:00
DropDemBits
0a144f7fff
Use bind by-move to get the parent from the match
2023-03-31 17:48:59 -04:00
Lukas Wirth
b3919ea80d
Cleanup crate_graph construction
2023-03-31 14:14:04 +02:00
Lukas Wirth
31db1fc75f
internal: Refine CrateOrigin variants
2023-03-31 10:36:13 +02:00
Lukas Wirth
e244942209
internal: Set Durability to HIGH for enable_proc_attr_macros input
2023-03-30 15:11:22 +02:00
bors
fc8c5139fa
Auto merge of #14410 - Veykril:query-lru-capacities, r=Veykril
...
internal: Add config to specifiy lru capacities for all queries
Might help figuring out what queries should be limited by LRU by default, as currently we only limit `parse`, `parse_macro_expansion` and `macro_expand`.
2023-03-30 12:20:24 +00:00
Lukas Wirth
5616d91b73
internal: Add config to specifiy lru capacities for all queries
2023-03-30 12:52:28 +02:00
Lukas Wirth
798990bf33
fix: Add missing autoborrow adjustment for index expressions
2023-03-29 16:11:48 +02:00
Lukas Wirth
d154ea88f9
Split out proc-macros from the CrateGraph
2023-03-25 16:46:44 +01:00
hkalbasi
3303a6eff5
Implement some intrinsics
2023-03-20 21:48:01 +03:30
Laurențiu Nicola
dbf04a5ee2
⬆️ rust-analyzer
2023-03-20 08:31:01 +02:00
hkalbasi
eb4939e217
Support overloaded deref MIR lowering
2023-03-17 14:02:55 +03:30
hkalbasi
b7b9ae59a0
desugar ? operator
2023-03-17 13:08:35 +03:30
Lukas Wirth
55120b3d83
Add signature help for tuple struct patterns
2023-03-15 10:17:30 +01:00
Lukas Wirth
03a6ab0b62
Add signature help for record struct patterns
2023-03-14 21:55:03 +01:00
Lukas Wirth
2c364f6e5a
Fix tests
2023-03-14 19:55:20 +01:00
Lukas Wirth
228b44cb18
fix: Only skip adjustment hints for block, if and match expressions for reborrows
2023-03-13 16:10:49 +01:00
Laurențiu Nicola
b2f6fd4f96
⬆️ rust-analyzer
2023-03-13 10:42:24 +02:00
Lukas Wirth
b6e7cf3201
Highlight unresolved derives as being unresolved
2023-03-08 13:51:14 +01:00
bors
44ff3c407a
Auto merge of #14232 - HKalbasi:mir, r=Veykril
...
MIR episode 2
This PR adds:
1. `need-mut` and `unused-mut` diagnostics
2. `View mir` command which shows MIR for the body under cursor, useful for debugging
3. MIR lowering for or-patterns and for-loops
2023-03-07 09:49:49 +00:00
bors
31c12ec282
Auto merge of #14266 - Veykril:generalize-eager-lazy, r=Veykril
...
feature: Make replace_or_with_or_else assists more generally applicable
2023-03-06 21:41:46 +00:00
Lukas Wirth
0ce06088f8
Fix inlay-hint tests
2023-03-06 22:39:42 +01:00
Lukas Wirth
199bc82ce8
feature: Make replace_or_with_or_else assists more generally applicable
2023-03-06 22:17:30 +01:00
hkalbasi
ac04bfd7a7
Add View Mir
command and fix some bugs
2023-03-06 21:09:09 +03:30
hkalbasi
61ad6a96ad
Add BindingId
2023-03-06 21:09:08 +03:30
hkalbasi
ae8ce99d97
Bring back the hex in const hover
2023-03-05 13:53:49 +03:30
Lukas Wirth
5a91f015b4
internal: Handle fields called as method calls as the fields they resolve to
2023-03-04 20:33:28 +01:00
bors
6756294aa0
Auto merge of #14184 - lowr:feat/trait-alias-def, r=Veykril
...
Handle trait alias definitions
Part of #2773
This PR adds a bunch of structs and enum variants for trait aliases. Trait aliases should be handled as an independent item because they are semantically distinct from traits.
I basically started by adding `TraitAlias{Id, Loc}` to `hir_def::item_tree` and iterated adding necessary stuffs until compiler stopped complaining what's missing. Let me know if there's still anything I need to add.
I'm opening up this PR for early review and stuff. I'm planning to add tests for IDE functionalities in this PR, but not type-related support, for which I put FIXME notes.
2023-03-03 15:45:18 +00:00
Ryo Yoshida
f8eac19b33
Support trait aliases in IDE where type support isn't needed
2023-03-04 00:24:08 +09:00
Ryo Yoshida
29c957f973
Lower and handle trait aliases in HIR
2023-03-04 00:24:07 +09:00
Lukas Wirth
ec273c3d12
Split pattern inference into more functions
2023-03-03 10:42:46 +01:00
bors
32424d0aba
Auto merge of #14176 - lowr:fix/assoc-func-vis-in-local-impl, r=Veykril
...
Fix associated item visibility in block-local impls
Fixes #14046
When we're resolving visibility of block-local items...
> `self` normally refers to the containing non-block module, and `super` to its parent (etc.). However, visibilities must only refer to a module in the DefMap they're written in, so we restrict them when that happens. ([link])
...unless we're resolving visibility of associated items in block-local impls, because that impl is semantically "hoisted" to the nearest (non-block) module. With this PR, we skip the adjustment for such items.
Since visibility representation of those items is modified, this PR also adjusts visibility rendering in `HirDisplay`.
[link]: a6603fc21d/crates/hir-def/src/nameres/path_resolution.rs (L101-L103)
2023-03-01 12:40:55 +00:00
hkalbasi
f64fe66c2a
Add tuple to render_const_scalar
2023-02-28 23:12:30 +03:30
bors
c386316fe0
Auto merge of #14185 - anergictcell:fix_14142, r=HKalbasi
...
Fix: Run doctests for structs with lifetime parameters from IDE
Fixes #14142 : Doctests can't be triggered for structs with lifetimes
This MR adds lifetime parameters to the structs path for runnables so that they can be triggered from an IDE as well.
This is my first MR for rust-analyzer, please let me know if I should change something, either in code or the description here.
2023-02-28 09:52:03 +00:00
Jonas Marcello
af79491ae6
Rename method to generic_parameters
2023-02-28 10:32:42 +01:00
bors
a0be16b0b2
Auto merge of #14040 - HKalbasi:mir, r=HKalbasi
...
Beginning of MIR
This pull request introduces the initial implementation of MIR lowering and interpreting in Rust Analyzer.
The implementation of MIR has potential to bring several benefits:
- Executing a unit test without compiling it: This is my main goal. It can be useful for quickly testing code changes and print-debugging unit tests without the need for a full compilation (ideally in almost zero time, similar to languages like python and js). There is a probability that it goes nowhere, it might become slower than rustc, or it might need some unreasonable amount of memory, or we may fail to support a common pattern/function that make it unusable for most of the codes.
- Constant evaluation: MIR allows for easier and more correct constant evaluation, on par with rustc. If r-a wants to fully support the type system, it needs full const eval, which means arbitrary code execution, which needs MIR or something similar.
- Supporting more diagnostics: MIR can be used to detect errors, most famously borrow checker and lifetime errors, but also mutability errors and uninitialized variables, which can be difficult/impossible to detect in HIR.
- Lowering closures: With MIR we can find out closure capture modes, which is useful in detecting if a closure implements the `FnMut` or `Fn` traits, and calculating its size and data layout.
But the current PR implements no diagnostics and doesn't support closures. About const eval, I removed the old const eval code and it now uses the mir interpreter. Everything that is supported in stable rustc is either implemented or is super easy to implement. About interpreting unit tests, I added an experimental config, disabled by default, that shows a `pass` or `fail` on hover of unit tests (ideally it should be a button similar to `Run test` button, but I didn't figured out how to add them). Currently, no real world test works, due to missing features including closures, heap allocation, `dyn Trait` and ... so at this point it is only useful for me selecting what to implement next.
The implementation of MIR is based on the design of rustc, the data structures are almost copy paste (so it should be easy to migrate it to a possible future stable-mir), but the lowering and interpreting code is from me.
2023-02-28 09:12:19 +00:00
hkalbasi
cd67589f63
beginning of MIR
2023-02-27 23:45:54 +03:30
Jonas Marcello
f494d1199d
Remove empty line
2023-02-27 18:10:20 +01:00
Jonas Marcello
7abcc7d862
Add const to doctest runnable definition
...
Refactor method to get type parameters to add const parameters
Remove unused methods
2023-02-27 18:08:20 +01:00
Jonas Marcello
4ee2e469a2
Rename the method that returns struct paramaters
2023-02-27 18:08:20 +01:00
Jonas Marcello
9957bb361d
Add const generics to doctest names for structt
2023-02-27 18:08:20 +01:00
Jonas Marcello
8bc75c4c28
return Iterator instead of Vec for combined lifetime and argument parameters
2023-02-27 18:08:20 +01:00
Jonas Marcello
9942cc425b
Fix 14142: Annotate lifetime paramaters in doctest runnables
2023-02-27 18:08:17 +01:00
bors
2e479158bb
Auto merge of #14208 - Kohei316:master, r=Veykril
...
fix:add a case in which remainig is None in resolveing types when resolving hir path.
fix #14030 The variable type is being determined incorrectly
This PR fixed a problem in which `go to definition` is jumping to the incorrect position because it was failing to resolve the type in case it defined in the module when resolving hir.
In addition, I added a test for this issue and refactored the related code.
This is my first PR and I am using a translation tool to write this text. Let me know if you have any problems.
2023-02-27 08:40:39 +00:00
morine0122
aa877645a6
Fix resolving types when resolving HIR and add a related test
2023-02-26 21:50:39 +09: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
Ryo Yoshida
d4166234ef
Adjust block-local impl item visibility rendering
2023-02-20 00:44:51 +09: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
Lukas Wirth
5859190066
Adjust binding mode inlay hints to render better with @ patterns
2023-02-15 14:47:02 +01:00
Lukas Wirth
3c0f20a7bd
internal: Enable smallvec's union
feature
2023-02-14 17:01:01 +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
Ryo Yoshida
098d9d77b4
Search raw identifiers without prefix
2023-02-14 17:34:14 +09: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
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
Lukas Wirth
9738f97f8c
Fix active parameter analysis once more
2023-02-12 17:32:11 +01:00
Lukas Wirth
5fdf640fb3
fix: Fix bind pat inlay hints rendering for constant patterns
2023-02-11 16:29:54 +01: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
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
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
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
Lukas Wirth
c6305c5659
fix: Don't panic on broken syntax trees in adjustment inlay hints
2023-02-06 12:38:57 +01: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
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
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
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
Lukas Wirth
4ff6f3845f
Update ide test outputs
2023-01-27 11:40:44 +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
Lukas Wirth
951ee3d0b5
fix: Fix assoc item search finding unrelated definitions
2023-01-24 14:11:02 +01: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
Lukas Wirth
84239a1454
REplace soft breaks in markdown with spaces
2023-01-23 12:21:23 +01:00
Lukas Wirth
4685b97f74
Remove hover fallback in favor of ranged hover
2023-01-20 21:52:05 +01:00
Lukas Wirth
a542bd46bf
Split out some hover functions
2023-01-20 16:30:08 +01:00
Lukas Wirth
c5b1e3f2ae
Fix markdown removal in hover handling whitespace weirdly
2023-01-20 14:29:12 +01:00
Lukas Wirth
384fa4b84a
fix: Fix target-data-layout fetching incorrectly passing 'rustc' to rustc
2023-01-19 21:31:08 +01: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
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
Maybe Waffle
81d7e302ed
Add basic tooltips to adjustment hints
2023-01-16 12:44:39 +00:00
Maybe Waffle
a7787533af
Use the fact that Either
: AstNode
2023-01-14 15:20:32 +00:00
Lukas Wirth
27ba598dfe
Make inlay hint location links work for more types
2023-01-14 13:30:56 +01: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
Lukas Wirth
aafb0f1f8d
Use smallvec for inlay-hint parts
2023-01-13 15:03:37 +01:00
Lukas Wirth
14777ce751
fix indentation of unlinked_file quickfix
2023-01-12 11:24:44 +01:00
Lukas Wirth
bb4e272d8a
Refine search for const and function assoc items
2023-01-11 17:10:04 +01: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
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
bvanjoi
9a15cc81b4
fix(ty): should query impls in nearest block
2023-01-10 10:28:17 +08:00
arcnmx
25242fe93f
⬆️ rust-analyzer
...
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
2023-01-09 10:36:22 -08:00
Maybe Waffle
b6169c2a2e
Add a fixme to remove hacks
2023-01-09 13:37:37 +00:00
Maybe Waffle
a9676cfbe3
Add a "bug" test for adjustment hints to check for status quo
2023-01-09 13:35:21 +00:00
Maybe Waffle
12b7f9f7bf
Add an option to minimize parentheses for adjustment hints
2023-01-09 13:35:17 +00:00
Maybe Waffle
b89c4f0a05
Implement postfix adjustment hints
...
I'd say "First stab at implementing..." but I've been working on this
for a month already lol
2023-01-09 13:27:59 +00:00
bors
f77b68a3cb
Auto merge of #13860 - danieleades:clippy, r=lnicola
...
fix a bunch of clippy lints
fixes a bunch of clippy lints for fun and profit
i'm aware of this repo's position on clippy. The changes are split into separate commits so they can be reviewed separately
2023-01-08 17:29:57 +00:00
Lukas Wirth
b996a54cd8
Skip lifetime elision on fn pointers and fn trait types
2023-01-03 11:58:31 +01:00
Lukas Wirth
506895fa2f
Fix spelling mistake
2023-01-02 23:16:26 +01:00
Daniel Eades
4f8ffd0ba4
remove unnecessary lifetimes that can be elided
2023-01-02 15:02:54 +00:00
Daniel Eades
efd2c20e96
remove useless conversions
2023-01-02 15:02:54 +00:00
Daniel Eades
cc80c5bd07
remove unnecessary lazy evaluations
2023-01-02 15:02:54 +00:00
Daniel Eades
ed128872eb
remove needless borrows
2023-01-02 14:52:32 +00:00
bors
17cc78f169
Auto merge of #13832 - Veykril:discriminant-hints, r=Veykril
...
Enum variant discriminants hints
![image](https://user-images.githubusercontent.com/3757771/209320042-eced617a-9a47-4808-ac23-916f469dc90c.png )
2023-01-02 13:20:33 +00:00
Lukas Wirth
ec125fe46a
Improve exit point highlighting for non-loop loops in tail position
2022-12-31 12:08:25 +01:00
Maybe Waffle
346bf5fb5b
Implement do yeet
expression
2022-12-28 23:17:13 +00:00
Maybe Waffle
4a16afa264
Parse do yeet
expressions
2022-12-28 22:42:26 +00:00
bors
74ae2dd303
Auto merge of #13840 - lowr:fix/hir-callable-sig-escaping-boundvars, r=lowr
...
fix: handle lifetime variables in `CallableSig` query
Fixes #13838
The problem is similar to #13223 : we've been skipping non-empty binders, letting lifetime bound variables escape.
I ended up refactoring `hir_ty::callable_sig_from_fnonce()`. Like #13223 , I chose to make use of `InferenceTable` which is capable of handling variables (I feel we should always use it when we solve trait-related stuff instead of manually building obligations/queries).
I couldn't make up a test that crashes without this patch (since the function I'm fixing is only used *outside* `hir-ty`, simple `hir-ty` test wouldn't cause crash), but at least I tested with my local build and made sure it doesn't crash with the code in the original issue. I'd appreciate any help to find a regression test.
2022-12-25 14:53:16 +00:00
Ryo Yoshida
a1a408367e
Add regression test
2022-12-25 23:29:33 +09:00
Yuri Astrakhan
e16c76e3c3
Inline all format arguments where possible
...
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.
The change was automatically created with, so there are far less change
of an accidental typo.
```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Lukas Wirth
df8fc78ece
Enum variant discriminants hints
2022-12-23 11:37:42 +01:00
Yuri Astrakhan
e341e996f7
Clippy-fix explicit auto-deref
...
Seems like these can be safely fixed. With one, I was particularly
surprised -- `Some(pats) => &**pats,` in body.rs?
```
cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref
```
2022-12-23 02:52:14 -05:00
Yuri Astrakhan
1d59c7b667
Remove non-needed clones
...
I am not certain if this will improve performance,
but it seems having a .clone() without any need should be removed.
This was done with clippy, and manually reviewed:
```
cargo clippy --fix -- -A clippy::all -D clippy::redundant_clone
```
2022-12-23 02:20:03 -05:00
bors
a06525517b
Auto merge of #13820 - Veykril:or-pat-bm-fix, r=Veykril
...
Fix binding mode hints always adding parentheses to or-patterns
2022-12-22 23:02:19 +00:00
Maybe Waffle
ef4c8167e8
Pass FamousDefs
around in inlay hints
2022-12-22 11:00:25 +00:00
bors
eb3963b22e
Auto merge of #13817 - WaffleLapkin:hide_adjustment_hints_outside_of_unsafe, r=Veykril
...
feat: Add an option to hide adjustment hints outside of `unsafe` blocks and functions
As the title suggests: this PR adds an option (namely `rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe`) that allows to hide adjustment hints outside of `unsafe` blocks and functions:
![2022-12-21_23-11](https://user-images.githubusercontent.com/38225716/208986376-d607de62-8290-4e16-b7fe-15b762dc5f60.png )
Requested by `@BoxyUwU` <3
2022-12-22 09:37:00 +00:00
Lukas Wirth
b9341e2fe6
Fix binding mode hints always adding parentheses to or-patterns
2022-12-22 10:35:35 +01:00
Waffle Maybe
1038db5f1d
Apply suggestions from code review
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-12-21 23:00:12 +00:00
bors
271f7b44d3
Auto merge of #13699 - HKalbasi:inlaylink, r=Veykril
...
Implement location link for type inlay hints
fix #11701
This actually doesn't work due a problem in vscode: https://github.com/microsoft/vscode/issues/167564
2022-12-21 21:43:38 +00:00
Maybe Waffle
608dc492ea
Move is_inside_unsafe
to Semantics
impl
2022-12-21 20:36:05 +00:00
bors
c2840c809a
Auto merge of #13814 - Veykril:layout, r=Veykril
...
Calculate the TargetDataLayout correctly for the selected target
This fails the tests still since those don't call into rustc yet
2022-12-21 19:38:51 +00:00
Maybe Waffle
3bfe7040e8
Add an option to hide adjustment hints outside of unsafe blocks
2022-12-21 19:20:42 +00:00
hkalbasi
e1aa73ef40
Disable inlay hint location links on vscode < 1.76
2022-12-21 18:54:49 +03:30
Lukas Wirth
33591cd3f4
Calculate the TargetDataLayout correctly for the selected target
2022-12-21 15:11:24 +01:00
hkalbasi
801a2231bf
Implement location link for type inlay hints
2022-12-21 02:18:02 +03:30
Maybe Waffle
874ff2bc9d
Skip adjustment hints if the adjustment doesn't adjust
2022-12-20 20:04:10 +00:00
Maybe Waffle
91a89efcf2
Save source & target types in hir
's expr_adjustments
2022-12-20 19:33:27 +00:00
Maybe Waffle
046a5679e3
Add docs to make tidy tests happy :')
2022-12-20 13:30:53 +00:00
Maybe Waffle
1c8bcf0d4e
Move inlay hints tests into implementation modules
2022-12-20 13:05:18 +00:00
Maybe Waffle
191cfba9d2
Split inlay hints into modules
2022-12-20 12:58:57 +00:00
bors
19c2ede549
Auto merge of #13784 - Veykril:bm-hints, r=Veykril
...
Deduplicate inserted parentheses in binding mode hints
2022-12-16 20:51:20 +00:00
Lukas Wirth
ba3e3282da
Deduplicate inserted parentheses in binding mode hints
2022-12-16 21:17:10 +01:00
bors
8f6d0cd1b0
Auto merge of #13783 - Veykril:bm-hints, r=Veykril
...
Add parentheses for binding mode hints when they attach to an Or-pattern
2022-12-16 19:53:06 +00:00
Lukas Wirth
b6c2bb21ab
Add parentheses for binding mode hints when they attach to an Or-pattern
2022-12-16 20:52:31 +01:00
Ryo Yoshida
bb99d2a6fb
fix: resolve all inference vars in InferenceResult::assoc_resolutions
2022-12-14 23:07:43 +09:00
bors
a3ea20a142
Auto merge of #13725 - bvanjoi:resolve-const-triat-impls, r=flodiebold
...
feat: resolve const for trait impls
Fixed #13694
2022-12-10 13:58:28 +00:00
bvanjoi
7012b50db5
feat: resolve const for trait impls( close #13694 )
2022-12-10 20:06:25 +08:00
bors
14492043db
Auto merge of #13749 - WaffleLapkin:remove_some_redudant_adjustment_hints, r=Veykril
...
fix: Don't show duplicated adjustment hints for blocks, ifs and matches
Before:
![2022-12-09_21-10](https://user-images.githubusercontent.com/38225716/206761100-5511d91b-2543-4166-aa2c-abdb8bad3613.png )
After:
![2022-12-09_21-22](https://user-images.githubusercontent.com/38225716/206761113-c58dbb5a-8616-4287-a3b4-69c13703294d.png )
----
I want to improve adjustment hints, this is the first step :)
2022-12-09 19:36:05 +00:00
Maybe Waffle
7c9a85bc43
fix: Don't show duplicated adjustment hints for blocks, ifs and matches
2022-12-09 18:45:01 +00:00
Lukas Wirth
e80674e6b3
Show type info on hover of enum variant fields
2022-12-09 10:09:55 +01:00
hkalbasi
05906da0ec
use rustc crates instead of copy paste
2022-12-07 01:59:38 +03:30
hkalbasi
86b5b609f1
Compute data layout of types
2022-12-04 00:29:34 +03:30
Allan Brondum Rasmussen
30736b54c9
fmt
2022-12-03 01:20:27 +01:00
Allan Brondum Rasmussen
cc4f9db086
remove unneeded test
2022-12-03 00:53:56 +01:00
Allan Brondum Rasmussen
bce3b63700
check reference is a NameRef (and not Name)
2022-12-02 23:50:39 +01:00
Jonas Schievink
b65b02fd97
Fix signature help not showing up when cursor is between ))
or >>
2022-11-29 18:50:21 +01:00
bors
99daf23e11
Auto merge of #13671 - Veykril:goto-decl, r=Veykril
...
Improve goto declaration
Closes https://github.com/rust-lang/rust-analyzer/issues/13599
- goto decl now goes to assoc items of trait declarations over the items of trait implementations
- goto decl now goes to the field declaration (opposed to goto def which shows both the field decl and binding created/local being used)
- also adds back the goto definition fallback that seems to have been dropped at some point.
2022-11-25 09:28:39 +00:00
Lukas Wirth
ae0bdffcc9
Go to declaration goes to field declaration in pattern and expression shorthands
2022-11-25 10:27:54 +01:00
Lukas Wirth
3c794a34da
Go to declaration goes to assoc items of trait declarations
2022-11-25 10:27:49 +01:00
Kartavya Vashishtha
a26aef9055
fix formatting
2022-11-25 12:22:06 +05:30
Kartavya Vashishtha
91e7624de0
add hover tests
2022-11-25 12:20:38 +05:30
Kartavya Vashishtha
e86d451484
fix token method call
2022-11-25 12:20:34 +05:30
Kartavya Vashishtha
132d5ffc7d
add back [] in hover documentation
2022-11-25 12:04:14 +05:30
Kartavya Vashishtha
f64feeb11a
Correct node traversal to look at parent instead
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-11-24 22:32:15 -08:00
Laurențiu Nicola
a2a1d99545
⬆️ rust-analyzer
2022-11-23 17:24:03 +02:00
Kartavya Vashishtha
29951f9766
fix formatting
2022-11-19 21:23:33 +05:30
Kartavya Vashishtha
87658c8173
refactor hover
...
change struct_rest_pat to guarentee a HoverResult
Move token and node matching out of struct_rest_pat into hover
2022-11-19 21:22:10 +05:30
Kartavya Vashishtha
8b17681058
fix formatting
...
and remove unnecessary check
2022-11-19 11:34:49 +05:30
Kartavya Vashishtha
a778203db9
simplify ancestor climbing to not consider macros
2022-11-19 11:17:43 +05:30
Kartavya Vashishtha
0ffb361eb9
feat: adds hover hint to ".." in record pattern
...
currently only works with struct pattern
2022-11-19 11:10:47 +05:30
bors
add85397ae
Auto merge of #13604 - Veykril:hover-attr, r=Veykril
...
fix: Fix hover in attributed items not preferring similar kinded tokens
2022-11-11 12:48:48 +00:00
Lukas Wirth
e50712cf2c
fix: Fix hover in attributed items not preferring similar kinded tokens
2022-11-11 13:38:07 +01:00
Ryo Yoshida
19306c070d
Fix tests that depended on loose visibility restriction
2022-11-11 20:31:46 +09:00
Laurențiu Nicola
79923c382a
⬆️ rust-analyzer
2022-11-09 21:49:10 +02:00
Jonas Schievink
9be0615bde
Don't canonicalize self type when querying FnOnce signature
2022-11-08 18:05:07 +01:00
bors
0aa0da9dda
Auto merge of #13572 - Veykril:cancellable, r=Veykril
...
internal: Use Cancellable in favor of Result for clarity
2022-11-07 16:22:33 +00:00
Lukas Wirth
fa70b0a86e
internal: Use Cancellable in favor of Result for clarity
2022-11-07 17:21:37 +01:00
bors
a27e4dad37
Auto merge of #13571 - Veykril:unique-references, r=Veykril
...
minor: Deduplicate reference search results
Fixes https://github.com/rust-lang/rust-analyzer/issues/13407
2022-11-07 15:49:54 +00:00
Lukas Wirth
6a06f6f724
Deduplicate reference search results
2022-11-07 16:48:50 +01:00
bors
8a633fe986
Auto merge of #13570 - Veykril:dedup-crates-for, r=Veykril
...
minor: Remove code duplication
2022-11-07 14:52:05 +00:00
Lukas Wirth
b169e1e5de
Remove code duplication
2022-11-07 15:49:26 +01:00
bors
b0e56ef5e8
Auto merge of #13545 - Veykril:adjustment-hints, r=Veykril
...
Generalize reborrow hints as adjustment hints
Like reborrow hints, these are still mainly useful for teaching/learning
![image](https://user-images.githubusercontent.com/3757771/200073606-b5cd3b95-a9ad-454d-a3c4-d4d89bf45928.png )
2022-11-07 14:38:59 +00:00
Lukas Wirth
ffd7bf8bf9
Bump Cargo rust-version fields to latest stable
2022-11-07 12:59:51 +01:00
Lukas Wirth
ee2dd934ca
Don't trigger adjustment hints in all inlay hint tests
2022-11-07 12:49:52 +01:00
Lukas Wirth
17619de711
fix: Fix reference searching only accounting substrings instead of whole identifiers
2022-11-05 13:00:02 +01:00
Lukas Wirth
d841ad116a
Fix up adjustment hints configurations
2022-11-04 22:59:07 +01:00
Lukas Wirth
95d20fccd7
Add adjustment hint tests
2022-11-04 22:40:06 +01:00
Lukas Wirth
c98fc537e6
Generalize reborrow hints as adjustment hints
2022-11-04 21:53:23 +01:00
bors
bbcb77ea6f
Auto merge of #13456 - emilio:scip-local-symbol, r=Veykril
...
scip: Generate symbols for local crates.
Consider something like:
```
// a.rs
pub struct Foo { .. } // Foo is "local 1"
fn something() {
crate:🅱️ :Bar::new() // Bar is "local 1", but of "b.rs"
}
// b.rs
pub struct Bar { .. } // "local 1"
```
Without this there's no way to disambiguate whether "local 1" references "Bar" or "Foo".
2022-11-03 13:58:36 +00:00
Jonas Schievink
ecad1a9a6e
Create Callable
s for generic types implementing FnOnce
2022-11-01 16:38:19 +01:00
Laurențiu Nicola
c60b1f6414
⬆️ rust-analyzer
2022-11-01 11:31:31 +02:00
Laurențiu Nicola
8807fc4cc3
⬆️ rust-analyzer
2022-10-26 17:40:41 +03:00
Ryo Yoshida
67f1d8fe2c
Test all generic args for trait when finding matching impl
2022-10-25 23:28:40 +09:00
Emilio Cobos Álvarez
8039a07a5e
ide: Generate monikers for local crates.
2022-10-22 19:33:47 +02:00
Emilio Cobos Álvarez
bd49d01906
ide: Remove unnecessary continue.
2022-10-22 15:15:10 +02:00
Lukas Wirth
de195ff97c
fix: Fix DidSaveDocument requests blocking the server on startup
2022-10-20 19:55:04 +02:00
Lukas Wirth
8047512dca
Revert "feat: Diagnose some incorrect usages of the question mark operator"
2022-10-18 14:18:59 +02:00
Laurențiu Nicola
a99a48e786
⬆️ rust-analyzer
2022-10-18 09:12:49 +03:00
Lukas Wirth
a762baca02
fix: Fix formatting requests hanging when r-a is still starting
...
The reason for that was that we were calculating the crate defmaps
of the file we are saving by accident causing us to get stuck waiting
on their expensive computation, while we only need the relevant crate
id.
2022-10-17 18:21:18 +02:00
Lukas Wirth
381366f1dd
Diagnose incorrect usages of the question mark operator
2022-10-16 12:58:24 +02:00
bors
855cd5c280
Auto merge of #13418 - lnicola:bump-deps, r=lnicola
...
Bump deps
2022-10-15 11:27:12 +00:00
Laurențiu Nicola
792920f441
Bump pulldown-cmark-to-cmark
2022-10-15 13:00:41 +03:00
Laurențiu Nicola
97eebbfab6
Bump url
2022-10-15 12:57:30 +03:00
Laurențiu Nicola
cbce0cda08
Bump anyhow, arbitrary, itertools, semver, serde
2022-10-15 12:52:34 +03:00
Laurențiu Nicola
4f55ebbd4f
⬆️ rust-analyzer
2022-10-11 10:37:35 +03:00
DropDemBits
a69cccfc0e
Underline only the intra-doc link instead of the whole doc comment
2022-10-09 21:29:31 -04:00