Florian Diebold
c3601e9860
Reverse fixups
2022-02-07 19:53:39 +01:00
Florian Diebold
79ebf618ec
Simplify
2022-02-07 18:21:31 +01:00
Florian Diebold
86b968ba94
Add a check
2022-02-07 18:19:00 +01:00
Florian Diebold
b9c5d23f69
Simplify a bit
2022-02-07 18:17:28 +01:00
Florian Diebold
cff209f152
WIP: Actually fix up syntax errors in attribute macro input
2022-02-07 18:12:51 +01:00
Florian Diebold
212e82fd41
Add test for giving attribute proc macros valid syntax
2022-02-07 12:54:08 +01:00
Moritz Vetter
482533ea9a
add missing snake case attribute, update hash
2022-02-07 04:57:20 +01:00
Maybe Waffle
662dd7c27d
Pass required features to cargo when using run action
...
When using `F1`->`Rust Analyzer: Run` action on an `example`, pass its
`required-features` to `cargo run`. This allows to run examples that
were otherwise impossible to run with RA.
2022-02-06 19:02:25 +03:00
Moritz Vetter
ba2ef69c79
Bump pulldown-cmark-to-cmark, adjust usages and fix test
2022-02-06 09:04:06 +01:00
Laurențiu Nicola
39674cd350
Revert "Bump dashmap"
...
This reverts commit 485f318b70
.
2022-02-05 16:15:56 +02:00
The0x539
1536fc040a
Fix trait impl completion ranges
2022-02-04 19:55:55 -06:00
Lukas Wirth
ec677e35d0
Simplify
2022-02-04 02:50:33 +01:00
Lukas Wirth
2ad71f1350
Shrink mbe::ExpandError
and mbe::ParseError
2022-02-03 17:25:24 +01:00
Lukas Wirth
2310908df7
fix: Fix vis restriction path completions always using the parent module
2022-02-03 17:02:12 +01:00
Lukas Wirth
c83081879f
Add abi string completions
2022-02-03 16:33:42 +01:00
Lukas Wirth
d3f3b6a87f
Sort completion calls lexicographically
2022-02-03 16:05:21 +01:00
Lukas Wirth
7619c2afea
Simplify
2022-02-03 16:00:49 +01:00
Lukas Wirth
9f5ee155c1
Move path completions for patterns into pattern module
2022-02-03 15:52:03 +01:00
Lukas Wirth
33fd2d7aef
Cleanup PathCompletionContext qualifier handling
2022-02-03 15:52:03 +01:00
Lukas Wirth
a3ad99649f
Add missing test for use completions
2022-02-03 15:52:03 +01:00
Lukas Wirth
136dadac9a
Add completion module tailored towards visibility modifiers
2022-02-03 15:52:03 +01:00
Lukas Wirth
661d721e20
Add completion module tailored towards use trees
2022-02-03 15:51:57 +01:00
Lukas Wirth
6940cca760
Move attribute path completions into attribute completion module
2022-02-03 15:50:14 +01:00
Florian Diebold
4ed5fe1554
Fix assoc type shorthand from method bounds
...
In code like this:
```rust
impl<T> Option<T> {
fn as_deref(&self) -> T::Target where T: Deref {}
}
```
when trying to resolve the associated type `T::Target`, we were only
looking at the bounds on the impl (where the type parameter is defined),
but the method can add additional bounds that can also be used to refer
to associated types. Hence, when resolving such an associated type, it's
not enough to just know the type parameter T, we also need to know
exactly where we are currently.
This fixes #11364 (beta apparently switched some bounds around).
2022-02-03 13:15:02 +01:00
bors[bot]
9cb6e3a190
Merge #11394
...
11394: feat: Deprioritize completions of private but editable definitions r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-02 11:42:40 +00:00
Lukas Wirth
2d77eb1e12
Fix test fixture
2022-02-02 12:42:13 +01:00
bors[bot]
d20ff92747
Merge #11395
...
11395: fix: Fix and re-enable format string completions r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-02 11:20:38 +00:00
Lukas Wirth
6f974cf477
fix: Fix and re-enable format string completions
2022-02-02 12:20:10 +01:00
Lukas Wirth
7267749f6b
Cleanup Completions
api a bit
2022-02-02 12:19:43 +01:00
Lukas Wirth
70650897d8
Fix generate_function assist trying to use name-ref like keywords for names
2022-02-02 11:37:24 +01:00
Lukas Wirth
5c41f5d165
feat: Deprioritize completions of private but editable definitions
2022-02-02 02:05:49 +01:00
bors[bot]
34138379b5
Merge #11322
...
11322: Extract function also extracts comments r=Vannevelj a=Vannevelj
Fixes #9011
The difficulty I came across is that the original assist works from the concept of a `ast::StmtList`, a node, but that does not allow me to (easily) represent comments, which are tokens. To combat this, I do a whole bunch of roundtrips: from the `ast::StmtList` I retrieve the `NodeOrToken`s it encompasses.
I then cast all `Node` ones back to a `Stmt` so I can apply indentation to it, after which it is again parsed as a `NodeOrToken`.
Lastly, I add a new `make::` api that accepts `NodeOrToken` rather than `StmtList` so we can write the comment tokens.
Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-02-01 23:05:28 +00:00
Jeroen Vannevel
493642ab3a
rollup match
2022-02-01 22:38:37 +00:00
Lukas Wirth
d7a544e69a
fix: Complete functions and methods from block level impls
2022-02-01 23:29:40 +01:00
Lukas Wirth
dbd5a70ea3
minor: Add some debug traces for cfg fetching
2022-02-01 13:35:34 +01:00
Lukas Wirth
fcdced115e
Deprioritize ops function completions for non-method calls
2022-02-01 12:33:55 +01:00
Jeroen Vannevel
1811f6330b
better comparison
2022-02-01 09:00:30 +00:00
Jeroen Vannevel
b290285dd8
removed redundant test
2022-02-01 00:38:33 +00:00
Jeroen Vannevel
269153388a
added FIXME
2022-02-01 00:37:48 +00:00
Jeroen Vannevel
51c50dd5ac
don't tear body
2022-02-01 00:36:50 +00:00
Jeroen Vannevel
e72ed9230a
no longer support comments on their own
2022-02-01 00:21:35 +00:00
Lukas Wirth
f6def3ccdf
fix: Fix proc-macro server not using the supplied span in Ident::new
2022-01-31 17:02:57 +01:00
Lukas Wirth
45ff51ba22
Make more precise range macro upmapping
2022-01-31 15:53:44 +01:00
Lukas Wirth
5fd3688018
Fix token ascension single token check being inverted
2022-01-31 13:26:09 +01:00
bors[bot]
0808ade4e4
Merge #11182
...
11182: fix: don't panic on seeing an unexpected offset r=Veykril a=dimbleby
Intended as a fix, or at least a sticking plaster, for #11081 .
I have arranged that [offset()](1ba9a924d7/crates/ide_db/src/line_index.rs (L105-L107)
) returns `Option<TextSize>` instead of going out of bounds; other changes are the result of following the compiler after doing this.
Perhaps there's still an issue here - I suppose the server and client have gotten out of sync and that probably shouldn't happen in the first place? I see that https://github.com/rust-analyzer/rust-analyzer/issues/10138#issuecomment-913727554 suggests what sounds like a more substantial fix which I think might be aimed in this direction. So perhaps that one should be left open to cover such things?
Meanwhile, I hope that not-crashing is a good improvement: and I can confirm that it works out just fine in the repro I have at #11081 .
Co-authored-by: David Hotham <david.hotham@metaswitch.com>
2022-01-31 11:16:22 +00:00
Lukas Wirth
6194092086
Complete local fn and closure params from surrounding locals scope
2022-01-31 11:56:42 +01:00
Lukas Wirth
ddf7b70a0f
Fix cfg_attr invalidating derive identifier IDE functionality
2022-01-30 22:47:16 +01:00
Lukas Wirth
cc04cfc982
Reduce allocations in attribute collection
2022-01-30 22:18:32 +01:00
bors[bot]
6010431a0b
Merge #11356
...
11356: Rollback env vars changed by a proc macro r=vlad20012 a=vlad20012
Fixes #11355
Co-authored-by: vlad20012 <beskvlad@gmail.com>
2022-01-30 08:05:55 +00:00
Daniel Conley
261abbf45e
Add Keyword Return Type Highlighting
2022-01-28 14:44:17 -05:00
Maybe Waffle
78a3cefc45
Use compare_exchange_weak
in limit::Limit::check
2022-01-28 18:19:35 +03:00
vlad20012
e277d5d64e
Add a way to disable dll copying for users of proc_macro_srv library
2022-01-28 16:18:25 +03:00
vlad20012
e93386f6ce
Rollback env vars changed by a proc macro
2022-01-28 13:43:29 +03:00
Maybe Waffle
6d18c5b69d
feat: Honor recursion limit configuration
...
This patch makes RA understand `#![recursion_limit = "N"]` annotations.
- `crate_limits` query is moved to `DefDatabase`
- `DefMap` now has `recursion_limit: Option<u32>` field
2022-01-28 11:31:59 +03:00
Maybe Waffle
81211f538c
Use crate_limits
query in macro expansion
2022-01-28 11:31:59 +03:00
Maybe Waffle
c932ca5f1c
Add crate_limits
query to SourceDatabase
...
This allows fetching crate limits like `recursion_limit`. The
implementation is currently dummy and just returns the defaults.
Future work: Use this query instead of the hardcoded constant.
Future work: Actually implement this query by parsing
`#![recursion_limit = N]` attribute.
2022-01-28 11:31:59 +03:00
bors[bot]
b55a1c561a
Merge #11353
...
11353: Set current working directory for procedural macros r=vlad20012 a=vlad20012
Fixes #11079
Co-authored-by: vlad20012 <beskvlad@gmail.com>
2022-01-27 18:09:08 +00:00
Jonas Schievink
6c0fcb5b5d
More correct $crate
handling in eager macros
2022-01-27 16:57:53 +01:00
vlad20012
6051318744
Set current working directory for procedural macros
2022-01-27 16:18:12 +03:00
Jonas Schievink
3c51aaf065
Fix merge commit check for git 2.35
2022-01-26 19:10:39 +01:00
Jonas Schievink
35e5c3b3f9
Fix resolution of eager macro contents
2022-01-26 18:31:07 +01:00
bors[bot]
2cb85c14b6
Merge #11281
...
11281: ide: parallel prime caches r=jonas-schievink a=jhgg
cache priming goes brrrr... the successor to #10149
---
this PR implements a parallel cache priming strategy that uses a topological work queue to feed a pool of worker threads the crates to index in parallel.
## todo
- [x] should we keep the old prime caches?
- [x] we should use num_cpus to detect how many cpus to use to prime caches. should we also expose a config for # of worker CPU threads to use?
- [x] something is wonky with cancellation, need to figure it out before this can merge.
Co-authored-by: Jake Heinz <jh@discordapp.com>
2022-01-25 16:03:35 +00:00
Jonas Schievink
5088926ec3
Make syntax bridge fully infallible
2022-01-24 17:27:39 +01:00
Lukas Wirth
ebd723995a
fix: don't panic in semantics due to cfg_attr
disrupting offsets
2022-01-23 17:42:38 +01:00
Jeroen Vannevel
8f09e13c06
fixed whitespace
2022-01-22 13:28:23 +00:00
Jeroen Vannevel
8e8e1951e2
whitespace
2022-01-22 12:25:33 +00:00
Jeroen Vannevel
9725eaa21c
generated docs
2022-01-22 12:17:24 +00:00
Jeroen Vannevel
61ab31f709
clarify doc
2022-01-22 12:10:48 +00:00
Jeroen Vannevel
4972cb759e
Support standalone comments
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
8d61216957
redundant type specified
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
a1c246b1c4
shorter arms
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
4ab7c4d99b
removed prints
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
96ab4c6e6c
hacky_block_expr_with_comments
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
5d35e5882c
removed unwrapping from indent
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
ee862cec10
simplified tail_expr
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
4896ffb65c
removing unwraps
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
50c913c733
don't remove the comment token if it's last
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
4f3dd5bc08
very rough but comments get extracted
2022-01-22 12:08:32 +00:00
Jeroen Vannevel
f662d8bf38
repro
2022-01-22 12:08:32 +00:00
Laurențiu Nicola
bdfdb525bb
Bump chalk
2022-01-21 19:51:21 +02:00
Laurențiu Nicola
e3e6133ff4
Bump pulldown-cmark and pulldown-cmark-to-cmark
2022-01-21 19:49:57 +02:00
Laurențiu Nicola
09fb755432
Bump hashbrown
2022-01-21 19:44:03 +02:00
Laurențiu Nicola
485f318b70
Bump dashmap
2022-01-21 19:42:04 +02:00
Jonas Schievink
e5ed43b1dc
Remove redundant Option
from eager macro fns
2022-01-21 12:58:06 +01:00
Schuyler Cohen
11cb203daf
Remove spurious format
2022-01-19 13:37:25 -06:00
Jonas Schievink
c714c139a4
Update tests
...
We're now omitting the libc crate's build script and const_fn test
2022-01-18 18:27:29 +01:00
Jonas Schievink
22ea5595a8
Don't load auxiliary crates outside the workspace
2022-01-18 18:17:43 +01:00
Wesley Norris
ba82cc7722
Add test for comments not directly next to items
2022-01-17 18:44:43 -05:00
Wesley Norris
7d10752299
Add a test for multi-single-line comments as well
2022-01-17 17:12:32 -05:00
Wesley Norris
1c866573cb
fix: insert auto-imports after header comments
...
Fixes #8607 .
This commit changes the auto-import functionality and causes it to add
imports after any leading comments, which are commonly license headers.
This does not affect comments on items as they're considered part of the
item itself and not separate.
2022-01-17 17:06:10 -05:00
Jonas Schievink
a3d06f824b
status: output all crates a file belongs to
2022-01-17 18:10:01 +01:00
Jonas Schievink
8a7f0d920e
Allow macros to expand to or-patterns
2022-01-17 16:52:53 +01:00
Laurențiu Nicola
c504518775
Temporarily disable format string completions
2022-01-17 09:30:35 +02:00
bors[bot]
e6e72809e3
Merge #11287
...
11287: fix: rust-analyzer spamming overly error message when workspace not being loaded r=lnicola a=Milo123459
Fixes #10120
Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
2022-01-16 15:13:52 +00:00
bors[bot]
7a52f83700
Merge #11294
...
11294: internal: Move format specifier lexing from syntax to ide_db r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-15 12:18:46 +00:00
Lukas Wirth
91279db2b4
Move format specifier lexing from syntax to ide_db
2022-01-15 13:14:59 +01:00
bors[bot]
4c34909308
Merge #11293
...
11293: feat: Add very simplistic ident completion for format_args! macro input r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-15 11:24:21 +00:00
Lukas Wirth
82fccb971e
feat: Add very simplistic ident completion for format_args! macro input
2022-01-15 12:23:26 +01:00
bors[bot]
9ee5b89e52
Merge #11292
...
11292: internal: Decrease PartialOrd and PartialEq trait methods completion relevance r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10245
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-15 10:17:01 +00:00
Lukas Wirth
2c36102722
internal: Decrease PartialOrd and PartialEq trait methods completion relevance
2022-01-15 11:05:13 +01:00
Jake Heinz
25f67b6939
make it a config
2022-01-15 02:47:47 +00:00
Milo
3de6b4839f
format
2022-01-14 22:13:45 +00:00
Milo
e1fe930845
fix overly
2022-01-14 22:06:30 +00:00
bors[bot]
844c152fd1
Merge #11248
...
11248: Merge match assist: take arm types into consideration r=Vannevelj a=Vannevelj
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9337
Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-01-14 19:03:55 +00:00
Jeroen Vannevel
ffe4352d7c
styling fixes
2022-01-14 18:53:28 +00:00
Jonas Schievink
e52e1aaca1
Clean up assoc item collection a bit
2022-01-14 18:45:23 +01:00
Jonas Schievink
72fd08d8d2
Remove redundant recursion limit
2022-01-14 17:45:57 +01:00
bors[bot]
9ba6cfa9c7
Merge #11283
...
11283: fix: Adjust `.` typing auto indentation r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/629
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-14 11:16:18 +00:00
Lukas Wirth
ba3efafc0d
fix: Adjust .
typing auto indentation
2022-01-14 12:15:43 +01:00
Jake Heinz
bcc99091f3
hacky fix for cancelling
2022-01-14 10:30:51 +00:00
Jake Heinz
6c5504a617
one last bit of cleanup
2022-01-14 10:10:47 +00:00
bors[bot]
fc331fe831
Merge #11282
...
11282: fix: Properly cache files in Semantics when ascending macros r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11280
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-14 10:08:27 +00:00
Lukas Wirth
f1cb5ed9b0
fix: Properly cache files in Semantics when ascending macros
2022-01-14 11:07:53 +01:00
Jake Heinz
c3f30ae4f0
removed scoped threads, cleanup
2022-01-14 10:06:28 +00:00
Lukas Wirth
2f8dd64830
Replace HasSource usages with Semantics equivalent
2022-01-14 10:59:27 +01:00
Jake Heinz
f83c0166be
cleanup + detect num cpus
2022-01-14 09:48:59 +00:00
Jake Heinz
0b0bfc6fdd
cleanup
2022-01-14 09:36:03 +00:00
Jake Heinz
c8aa2f6a61
use index map
2022-01-14 09:35:41 +00:00
Jake Heinz
5f0c1aa2de
make progress callback dyn
2022-01-14 09:33:40 +00:00
Jake Heinz
2b0d8a86a2
fix warnings
2022-01-14 09:25:45 +00:00
Jake Heinz
343b0ccfb9
simplify
2022-01-14 09:21:25 +00:00
Jake Heinz
3168148cc6
ide: parallel prime caches
2022-01-14 09:16:35 +00:00
Jeroen Vannevel
683de877ce
simple return
2022-01-14 01:32:12 +00:00
Jeroen Vannevel
0700282b75
formatting
2022-01-14 01:32:12 +00:00
Jeroen Vannevel
e5cdde95ab
removed toy
2022-01-14 01:32:12 +00:00
Jeroen Vannevel
5e4370fe56
happy slice
2022-01-14 01:32:12 +00:00
Jeroen Vannevel
8deadb18ae
refpat & slicepat
2022-01-14 01:32:12 +00:00
Jeroen Vannevel
82d3238da8
ParenPat
2022-01-14 01:32:12 +00:00
Jeroen Vannevel
c955ea11b4
support TuplePat
2022-01-14 01:32:12 +00:00
Jeroen Vannevel
a347cb5f86
battle of the Some
2022-01-14 01:32:12 +00:00
Jeroen Vannevel
7daca6fe97
cleaning up Some
2022-01-14 01:32:11 +00:00
Jeroen Vannevel
08300284e7
removed unwrap
2022-01-14 01:32:11 +00:00
Jeroen Vannevel
7bc89f2542
formatting
2022-01-14 01:32:11 +00:00
Jeroen Vannevel
bd77d8c3d1
removed prints
2022-01-14 01:32:11 +00:00
Jeroen Vannevel
18fb5412b2
all tests work
2022-01-14 01:32:11 +00:00
Jeroen Vannevel
aaec467cfd
merge_match_arms_nested_with_conflicting_identifier
2022-01-14 01:32:11 +00:00
Jeroen Vannevel
169ec2fdc1
Added a few more test cases
2022-01-14 01:32:11 +00:00
Jeroen Vannevel
b27b882e72
fixed test case
2022-01-14 01:32:11 +00:00
Jeroen Vannevel
2329b42407
test for different number of fields
2022-01-14 01:32:10 +00:00
Jeroen Vannevel
5675e0cd40
test cases with more branches
2022-01-14 01:32:10 +00:00
Jeroen Vannevel
130f11f270
simplified chain
2022-01-14 01:32:10 +00:00
Jeroen Vannevel
5dfc8da77e
don't need the as_ref()
2022-01-14 01:32:10 +00:00
Jeroen Vannevel
c52605024c
extracted function
2022-01-14 01:32:10 +00:00
Jeroen Vannevel
d8a3e51a5f
added tests for multiple fields
2022-01-14 01:32:10 +00:00
Jeroen Vannevel
9252c76255
using classify()
2022-01-14 01:32:10 +00:00
Jeroen Vannevel
6a1b4912bf
removed some unused stuff
2022-01-14 01:32:09 +00:00
Jeroen Vannevel
c9fc91822f
minicore
2022-01-14 01:32:09 +00:00
Jeroen Vannevel
215f896665
compiles, but doesn't work yet
2022-01-14 01:32:09 +00:00
bors[bot]
b4c31481a5
Merge #11276
...
11276: internal: Slightly cleanup HasFormatSpecifier::lex_format_specifier r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-13 19:18:47 +00:00
Laurențiu Nicola
0721a55a48
Remove duplicate test attribute
2022-01-13 21:08:04 +02:00
Laurențiu Nicola
84c59a1f9f
Reformat code
2022-01-13 21:07:17 +02:00
Lukas Wirth
c3148cb396
Slightly cleanup HasFormatSpecifier::lex_format_specifier
2022-01-13 19:12:39 +01:00
Jonas Schievink
3fde9f820a
Unexport MacroDefId
from hir
2022-01-13 16:18:05 +01:00
Jonas Schievink
18e80e6892
Remove ModuleId
from hir
reexports
2022-01-12 20:21:13 +01:00
Jonas Schievink
09219e10f1
Mostly restore hir
API boundary
2022-01-12 19:56:47 +01:00
bors[bot]
4fe10b7bfe
Merge #11265
...
11265: fix: Fix postfix completion panic r=lnicola a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11233
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-12 12:30:41 +00:00
Lukas Wirth
09ce5d81d0
fix: Fix postfix completion panic
2022-01-12 13:07:16 +01:00
bors[bot]
de50ef4bea
Merge #11263
...
11263: fix: Fix don't drop param completions when fully typing out a pattern r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-12 11:37:18 +00:00
Lukas Wirth
314b199e3c
fix: Fix don't drop param completions when fully typing out a pattern
2022-01-12 12:36:46 +01:00
Lukas Wirth
51419c1931
Don't complete attributes with existing expressions
2022-01-11 19:03:21 +01:00
Jonas Schievink
7e8b96f07c
Fix concatenation of super
mod paths
2022-01-11 15:39:13 +01:00
Jonas Schievink
0706de94bb
Report DefDiagnostic
s from inside item bodies
2022-01-11 14:34:25 +01:00
bors[bot]
5a711d4f3a
Merge #11210
...
11210: feat: Deprioritize ops methods in completion r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10593
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-11 09:39:12 +00:00
Lukas Wirth
4901ea3eef
Lookup lang attribute on assoc item trait directly
2022-01-11 10:28:38 +01:00
Lukas Wirth
94b369faa3
Update tests
2022-01-11 09:26:53 +01:00
Lukas Wirth
ca0633c808
feat: Deprioritize ops methods in completion
2022-01-11 09:26:53 +01:00
bors[bot]
85bcca6b37
Merge #11252
...
11252: Fix documentation of snippet r=Veykril a=weirane
Closes #11234
Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2022-01-11 08:11:55 +00:00
Wang Ruochen
01b3ce3006
Fix documentation of snippet
2022-01-10 21:29:41 -08:00
Jonas Schievink
601dc50b5a
Print a single ellipsis for any number of omitted types
2022-01-10 16:55:53 +01:00
Jonas Schievink
3dd5e273b6
Shrink diagnostic spans for errors inside macros
2022-01-08 15:40:42 +01:00
Jonas Schievink
67f548d8e9
Allow doc comments on all Item
s
2022-01-08 15:27:48 +01:00
bors[bot]
ca8bd3ec42
Merge #11237
...
11237: fix: Fix outline modules spilling inner doc injections into their parent r=Veykril a=Veykril
Fixes another regression caused by https://github.com/rust-analyzer/rust-analyzer/pull/11225
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-08 13:55:18 +00:00
Lukas Wirth
b32f611b6e
fix: Fix outline modules spilling inner doc injections into their parent
2022-01-08 14:54:31 +01:00
bors[bot]
01c3303270
Merge #11236
...
11236: internal: Remove `InFile` wrapping from `DynMap` keys r=Veykril a=Veykril
We already store a `DynMap` per `(Container, HirFileId)` pair, so the `InFile` keys are already guruanteed to always be of the same file id
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-08 11:17:56 +00:00
Lukas Wirth
47591f0fb2
Remove InFile
wrapping from DynMap keys
2022-01-08 12:16:44 +01:00
Lukas Wirth
b6826e9246
Only add generics with the correct file id to DynMap
2022-01-08 11:34:58 +01:00
bors[bot]
926ba99f43
Merge #11235
...
11235: internal: Record attribute calls on assoc items in TraitData and ImplData r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11228
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-08 10:11:37 +00:00
Lukas Wirth
8d4f40e881
Do less allocs in trait_data
and impl_data
queries
2022-01-08 11:04:16 +01:00
Lukas Wirth
6746ba5839
Record attribute calls on assoc items in TraitData and ImplData
2022-01-08 10:45:12 +01:00
bors[bot]
c17db9fa53
Merge #11107
...
11107: Fix generic type substitution in impl trait with assoc type r=pnevyk a=pnevyk
Fixes #11045
The path transform now detects if a type parameter that is being substituted has an associated type. In that case it is necessary (or safe in general case) to fully qualify the substitution with a trait which the associated type belongs to.
This PR also fixes the previous wrong behavior of the substitution that could create an invalid tree `PATH_TYPE -> PATH_TYPE -> ...`.
Co-authored-by: Petr Nevyhoštěný <petr.nevyhosteny@gmail.com>
2022-01-08 09:05:09 +00:00
Lukas Wirth
6cf0cadfaa
Simplify
2022-01-07 21:52:37 +01:00
Lukas Wirth
0c9268c1ee
Filter out macro calls by file id in when building DynMap
2022-01-07 21:31:08 +01:00
bors[bot]
41a0e95d61
Merge #11230
...
11230: fix: Fix attribute stripping ignoring doc comments r=Veykril a=Veykril
Follow up to https://github.com/rust-analyzer/rust-analyzer/pull/11225#pullrequestreview-846779237
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-07 18:06:33 +00:00
Lukas Wirth
81163b8cd4
fix: Fix attribute stripping ignoring doc comments
2022-01-07 18:51:10 +01:00
Petr Nevyhoštěný
a710b87b1b
Fix generic type substitution in impl trait with assoc const
2022-01-07 16:41:39 +01:00
bors[bot]
40009e07d0
Merge #11145
...
11145: feat: add config to use reasonable default expression instead of todo! when filling missing fields r=Veykril a=bnjjj
Use `Default::default()` in struct fields when we ask to fill it instead of putting `todo!()` for every fields
before:
```rust
pub enum Other {
One,
Two,
}
pub struct Test {
text: String,
num: usize,
other: Other,
}
fn t_test() {
let test = Test {<|>};
}
```
after:
```rust
pub enum Other {
One,
Two,
}
pub struct Test {
text: String,
num: usize,
other: Other,
}
fn t_test() {
let test = Test {
text: String::new(),
num: 0,
other: todo!(),
};
}
```
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
2022-01-07 14:10:11 +00:00
bors[bot]
efb9b89163
Merge #11220
...
11220: Turbo fish assist: don't include lifetime parameters r=Veykril a=Vannevelj
Fixes #11219
The issue talks about three different types of params: type, const & lifetime. I wasn't entirely sure which ones are intended to be included here so I've gone for the type & const params (i.e. exclude lifetime).
I've added a test case for both a lifetime param and a const param. I'm still making my way through the rust book (chapter 7, yay) so I'm not too sure yet what these are but my testing shows that this approach generates code that compiles.
Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-01-07 14:02:01 +00:00
Benjamin Coenen
8e0a05eb70
feat(diagnostics): use default expression instead of todo! when missing fields
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-07 15:01:37 +01:00
Jeroen Vannevel
0a240e31c5
succinct code
2022-01-07 13:53:42 +00:00
bors[bot]
b70493d095
Merge #11225
...
11225: internal: Cleanup doc and attribute handling r=Veykril a=Veykril
(very vague PR title but as I tried to fix the mentioned issue I ran into more and more subtle things that were interwoven)
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11215
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-07 13:38:23 +00:00
Lukas Wirth
87735e5e9e
Update item tree test output
2022-01-07 14:29:58 +01:00
bors[bot]
c09504bd58
Merge #11194
...
11194: fix(gen-doc-assist): remove lifetimes in description of `new` r=Veykril a=numero-744
From wrong behavior:
```rust
/// Creates a new [`MyGenericStruct<'a, T>`].
```
to correct behavior:
```rust
/// Creates a new [`MyGenericStruct<T>`].
```
But I feel like there is a better way to implement it. Do you know if there is an existing function that could do the work of `lifetimes_removed()` below?
Co-authored-by: Côme ALLART <come.allart@etu.emse.fr>
2022-01-07 13:24:58 +00:00
Lukas Wirth
ca4baa6e55
Use FileAstId<ast::Adt>
in nameres where appropriate instead
2022-01-07 14:20:27 +01:00
Jeroen Vannevel
4bcdb05325
include tabstops
2022-01-07 13:17:21 +00:00
Lukas Wirth
08adce61a1
Better interface for doc comment and attribute processing
2022-01-07 14:14:33 +01:00
Benjamin Coenen
b60a29ca94
feat(diagnostics): use default expression instead of todo! when missing fields
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-07 14:13:34 +01:00
Côme ALLART
1b5c60f549
refactor: apply suggestions
...
See PR #11194
2022-01-07 14:07:35 +01:00
Coenen Benjamin
0a4239a815
Update crates/rust-analyzer/src/config.rs
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-07 14:07:02 +01:00
Jeroen Vannevel
778e71b15f
fmt
2022-01-07 12:40:41 +00:00
Jeroen Vannevel
76e0429048
concise filtering
2022-01-07 12:34:03 +00:00