Commit Graph

14306 Commits

Author SHA1 Message Date
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
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
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