Commit Graph

12784 Commits

Author SHA1 Message Date
Aleksey Kladov
78365c64c8 internal: slightly improve compile times
As per style guide, avoid monomorphisations
2021-08-29 12:53:56 +03:00
Aleksey Kladov
bef5e3096e minor: remove debug print 2021-08-29 12:33:07 +03:00
Lukas Wirth
6993a607cb Simplify 2021-08-29 01:38:10 +02:00
Lukas Wirth
99f1e66997 Only report unique text ranges in highlight_related 2021-08-29 01:11:29 +02:00
Lukas Wirth
72bfbb0691 Return all usages inside macros in usage searches 2021-08-29 00:49:57 +02:00
Lukas Wirth
512135920d Highlight all related tokens in macro inputs 2021-08-29 00:49:57 +02:00
Lukas Wirth
c5059e0623 Return all ranges corresponding to a token id in TokenMap 2021-08-29 00:49:57 +02:00
Jonas Schievink
002ef7d50a Use ManuallyDrop in RootDatabase 2021-08-28 23:05:40 +02:00
bors[bot]
10e9408d38
Merge #10066
10066: internal: improve compile times a bit r=matklad a=matklad

I wanted to *quickly* remove `smol_str = {features = "serde"}`, and figured out that the simplest way to do that is to replace our straightforward proc macro serialization with something significantly more obscure. 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-28 20:38:58 +00:00
Aleksey Kladov
0d5c671d76 minor: reformat 2021-08-28 23:38:39 +03:00
Aleksey Kladov
c639fe333f internal: improve compilation critical path a bit 2021-08-28 22:43:37 +03:00
Aleksey Kladov
0dabcf0044 remove unused serde feature from smol_str 2021-08-28 22:43:37 +03:00
Aleksey Kladov
55e9476e4b internal: more production-ready proc-macro RPC deserialization
* avoid arbitrary nested JSON tree (danger of stack overflow)
* use more compact representation.
2021-08-28 22:43:37 +03:00
bors[bot]
fae440c32a
Merge #10025
10025: Don't mutate syntax trees when preparing proc-macro input r=Veykril a=Veykril

Fixes #10013

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-28 14:14:54 +00:00
Jonas Schievink
3047ae8d0f Enable diagnostics in const and static items 2021-08-27 23:21:21 +02:00
bors[bot]
99e67f8998
Merge #10044
10044: minor: Ignore text and bench attributes again r=Veykril a=Veykril

Reverts part of #9943

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 20:19:56 +00:00
Lukas Wirth
798c53925a Ignore text and bench attributes again 2021-08-27 22:19:04 +02:00
bors[bot]
97409e5fc8
Merge #9970
9970: feat: Implement attribute input token mapping, fix attribute item token mapping r=Veykril a=Veykril

![image](https://user-images.githubusercontent.com/3757771/130328577-4c1ad72c-51b1-47c3-8d3d-3242ec44a355.png)

The token mapping for items with attributes got overwritten partially by the attributes non-item input, since attributes have two different inputs, the item and the direct input both.
This PR gives attributes a second TokenMap for its direct input. We now shift all normal input IDs by the item input maximum(we maybe wanna swap this see below) similar to what we do for macro-rules/def. For mapping down we then have to figure out whether we are inside the direct attribute input or its item input to pick the appropriate mapping which can be done with some token range comparisons.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9867

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 19:30:36 +00:00
bors[bot]
3acbf94d29
Merge #10057
10057: fix: Remove incorrect assertion in extract_function r=Veykril a=Veykril

This assertion is actually just wrong
Fixes #10056
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 18:00:37 +00:00
Lukas Wirth
5c3a93ca9e Remove incorrect assertion in extract_function 2021-08-27 19:58:57 +02:00
bors[bot]
12a36db71c
Merge #10055
10055: fix: Don't use fake text range in original node search as is in completions r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10042
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 13:11:34 +00:00
Lukas Wirth
ebb87fe157 Don't use fake text range in original node search as is in completions 2021-08-27 15:10:42 +02:00
bors[bot]
ef54dace6a
Merge #10054
10054: minor: Ignore text and bench attributes again r=Veykril a=Veykril

cc https://github.com/rust-analyzer/rust-analyzer/issues/8518#issuecomment-907039593
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 12:21:46 +00:00
Lukas Wirth
5012fa2dd4 Add completion tests for cursor after items 2021-08-27 14:21:17 +02:00
Aleksey Kladov
cb3d04c818 minor: nicer way to defeat disjoint closure captures
Thanks https://internals.rust-lang.org/t/feature-idea-edition-dependent-names-replacing-standard-library-items/15198/27?u=matklad!
2021-08-26 22:13:50 +03:00
oxalica
15eccf29e8
Fix missing unsafe block for the nightly change
Fix #10022
2021-08-26 17:21:23 +08:00
bors[bot]
793389b61a
Merge #10030
10030: fix: Fix multiple derives in one attribute not expanding all in expand_macro r=Veykril a=Veykril

It's probably better to only expand the exact derive the cursor is on(if possible) instead of all derives in the attribute the cursor is one.
follow up to #10029
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-26 01:34:30 +00:00
Lukas Wirth
0f3617f76f fix: Fix multiple derives in one attribute not expanding all in expand_macro 2021-08-26 03:32:45 +02:00
bors[bot]
49763c3cdb
Merge #10029
10029: internal: Improve expand_macro r=Veykril a=Veykril

- Adds a few more newlines to the output making it more readable
- Fixes a bug with multiple derives not being expandable

There seems to be an issue with multiple derives in one attribute only showing the expansion of the last derive which I'll have to investigate.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-26 00:39:00 +00:00
Lukas Wirth
3f9f63c1bd Improve expand_macro 2021-08-26 02:36:33 +02:00
Lukas Wirth
1195cb50c2 Add simple test for syntax_node_to_token_tree_censored 2021-08-25 19:57:18 +02:00
Lukas Wirth
d6134b6802 Don't mutate syntax trees when preparing proc-macro input 2021-08-25 18:57:24 +02:00
Jonas Schievink
276f6c6ba4 Reduce visibility of WorkspaceBuildScripts::run 2021-08-25 18:02:27 +02:00
Jonas Schievink
0ff2c81bb9 Fix reporting of build script errors 2021-08-25 17:56:39 +02:00
Jonas Schievink
095df7bc39 Don't fetch build script output twice 2021-08-25 17:56:24 +02:00
Lukas Wirth
d99b81f839 Expand derive macros under cursor in Expand Macro Recursively 2021-08-24 16:33:52 +02:00
bors[bot]
6287d388c0
Merge #9944
9944: internal: introduce in-place indenting API r=matklad a=iDawer

Introduce `edit_in_place::Indent` that uses mutable tree API and intended to replace `edit::AstNodeEdit`.

Closes #9903 

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-08-24 13:11:50 +00:00
bors[bot]
49c02b93b3
Merge #9993
9993: feat: join lines merges assignments r=matklad a=unexge

Closes https://github.com/rust-analyzer/rust-analyzer/issues/9967.
![Peek 2021-08-22 21-46](https://user-images.githubusercontent.com/16212576/130366571-3ebb1753-f8d5-4884-be8f-222cda71a2a7.gif)


Co-authored-by: unexge <unexge@gmail.com>
2021-08-24 12:14:25 +00:00
Aleksey Kladov
4f8c6193d5 minor: remove dead code 2021-08-24 14:39:31 +03:00
bors[bot]
ea5314d59c
Merge #10010
10010: internal: use idiomatic form of assertions r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-24 11:10:09 +00:00
Aleksey Kladov
1660820e51 internal: use idiomatic form of assertions
Ideally, we should just return an InvalidParameter dialog here, but that
shows error message to the end user, and we generally avoid that
2021-08-24 14:09:34 +03:00
bors[bot]
43021525e5
Merge #9994
9994: add static method generation assist r=matklad a=mahdi-frms

Adds feature: #9948

Will soon send a GIF for the changelog.

Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-08-24 09:26:52 +00:00
Lukas Wirth
631bca786f Highlight declarations and references for both defs in field shorthands 2021-08-24 03:15:41 +02:00
bors[bot]
ced65f77c4
Merge #10001
10001: Sort enum variant r=Veykril a=vsrs

A small fix to the problem noted by `@lnicola` :

> ![sort-fields](https://user-images.githubusercontent.com/308347/129513196-4ffc7937-be58-44d4-9ec7-ba8745dcb460.gif)
> 
> (note the slight inconsistency here: to sort the variants of `Animal` I have to select the enum name, but to sort the fields of `Cat` I have to select the fields themselves)



Co-authored-by: vsrs <vit@conrlab.com>
2021-08-23 22:19:50 +00:00
vsrs
7a8f881a09 Sort enum variant 2021-08-23 20:31:54 +03:00
Aleksey Kladov
0a7e57177e internal: use single env var to controll all benchmarks 2021-08-23 16:40:42 +03:00
Aleksey Kladov
c044493434 ⬆️ rowan
Just so we don't live on a per-release
2021-08-23 12:10:49 +03:00
mahdi-frms
cf5f1c102c add static method generation assist 2021-08-23 12:14:23 +04:30
unexge
3a9ba0e506 feat: join lines merges assignments 2021-08-22 21:28:39 +03:00
Lukas Wirth
4933beca87 Respect attributes in Hygiene token up-mapping 2021-08-22 19:12:45 +02:00