Commit graph

847 commits

Author SHA1 Message Date
Aleksey Kladov
0a2b6087ec Simplify 2020-06-24 12:30:54 +02:00
Aleksey Kladov
5e7a1a1203 Simplify 2020-06-24 12:01:17 +02:00
Aleksey Kladov
04fe512f0d Simplify 2020-06-24 11:51:45 +02:00
Aleksey Kladov
9d64525daa Simplify 2020-06-24 11:50:53 +02:00
Aleksey Kladov
d4a493078a Simplify 2020-06-24 11:48:44 +02:00
Aleksey Kladov
c749fe223b Remove duplication 2020-06-24 11:31:30 +02:00
Aleksey Kladov
c6795fb83a More consistent usage of fixtures 2020-06-24 11:29:43 +02:00
Aleksey Kladov
e9cb818c26 Use fixtures more 2020-06-24 11:05:47 +02:00
bors[bot]
c544f9a137
Merge #4940
4940: Add support for marking doctest items as distinct from normal code r=ltentrup a=Nashenas88

This adds `HighlightTag::Generic | HighlightModifier::Injected` as the default highlight for all elements within a doctest. Please feel free to suggest that a new tag be created or a different one used.

![Screenshot from 2020-06-23 09-18-13](https://user-images.githubusercontent.com/1673130/85408493-9752ce00-b532-11ea-94fe-197353ccc778.png)

Fixes #4929 
Fixes #4939

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
2020-06-24 05:22:23 +00:00
Paul Daniel Faria
0d87eee3a9 Improve readability be replacing hard-to-read if-else branches with a match 2020-06-23 19:35:09 -04:00
Aleksey Kladov
aa69757a01 More principled indentation trimming in fixtures 2020-06-23 23:33:41 +02:00
Aleksey Kladov
ff687453a8 Slightly better name 2020-06-23 21:29:50 +02:00
Aleksey Kladov
84cd28fddc Cut problematic dependency 2020-06-23 18:56:26 +02:00
Aleksey Kladov
fdf86aee18 Nicer API 2020-06-23 18:46:56 +02:00
Paul Daniel Faria
a8a606cdc4 Remove unrelated change 2020-06-23 12:40:55 -04:00
Aleksey Kladov
21f751a0e5 Simplify 2020-06-23 18:37:26 +02:00
Aleksey Kladov
30748161f0 Simplify 2020-06-23 18:37:26 +02:00
Paul Daniel Faria
1e9095ae8c
Update comment for pop_and_inject
Co-authored-by: Leander Tentrup <ltentrup@users.noreply.github.com>
2020-06-23 12:15:45 -04:00
Paul Daniel Faria
2a56323537 Update injection mechanism and stop injecting through highlight element, switch to more general new highlight tag, generic 2020-06-23 12:13:50 -04:00
Paul Daniel Faria
d8230acd84 Add punctuation highlighting for highlighting punctuation in doctests, fix highlighting in doctests 2020-06-23 12:11:33 -04:00
Paul Daniel Faria
e137d9accb Add default color and opacity for documentation and injected, respectively, in the html generator 2020-06-23 12:08:04 -04:00
Paul Daniel Faria
351bba9bee Add support for marking doctest items as distinct from normal code, add default tag to all doctest elements 2020-06-23 12:08:04 -04:00
Aleksey Kladov
dad1333b48 New VFS 2020-06-23 17:51:06 +02:00
bors[bot]
3e09dbba94
Merge #5002
5002: Fix underflow panic when doctests are at top of file r=Nashenas88 a=Nashenas88

While debugging a comment at the top of a test string, I discovered that the offset calculations could underflow and panic. This only seemed to occur in tests, I assume because it's running a debug mode. The wrapping is quickly fixed later on in release mode, which is why this seems to have gone unnoticed. The new checks ensure the value is always positive or zero.

Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
2020-06-23 13:25:43 +00:00
bors[bot]
338b229b79
Merge #4999
4999: SSR: Allow matching of whole macro calls r=matklad a=davidlattimore

Matching within macro calls is to come later and matching of macro calls within macro calls later still.

Co-authored-by: David Lattimore <dml@google.com>
2020-06-23 10:02:59 +00:00
Paul Daniel Faria
0b971625c3 Fix underflow panic when doctests are at top of file 2020-06-22 22:29:08 -04:00
bors[bot]
98c3e4e887
Merge #5000
5000: Remove RelativePathBuf from fixture r=matklad a=matklad

The paths in fixture are not really relative (the default one is
`/main.rs`), so it doesn't make sense to use `RelativePathBuf` here.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-22 22:15:22 +00:00
Aleksey Kladov
6a6098d4c3 Remove RelativePathBuf from fixture
The paths in fixture are not really relative (the default one is
`/main.rs`), so it doesn't make sense to use `RelativePathBuf` here.
2020-06-23 00:14:44 +02:00
David Lattimore
467af611fb SSR: Allow matching of whole macro calls
Matching within macro calls is to come later and matching of macro calls within macro calls later still.
2020-06-23 07:42:34 +10:00
bors[bot]
eabbeec14c
Merge #4988
4988: Don't offer to add missing fields of unknown types r=flodiebold a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-22 15:47:22 +00:00
Laurențiu Nicola
acc2819c10 Don't offer to add missing fields of unknown types 2020-06-22 18:16:00 +03:00
bors[bot]
87615166af
Merge #4900
4900: Self variant enum res fix r=BGluth a=BGluth

Fixes #4789.

This is my first PR for this project, so it's probably worth giving it an extra close look.

A few things that I wasn't sure about:
- Is `resolve_path` really the best place to perform this check? It seemed like a natural place, but perhaps there's a better place?
- When handling the new variant `PathResolution::VariantDef`, I couldn't see an obvious variant of `TypeNs` to return in `in_type_ns` for Unions and Structs.

Co-authored-by: BGluth <gluthb@gmail.com>
2020-06-22 14:37:45 +00:00
bors[bot]
d8842e89e9
Merge #4899
4899: don't complete top level attrs inside nested attrs and add better labels r=matklad a=bnjjj

close #4890

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-22 12:13:18 +00:00
bors[bot]
d144d69d2e
Merge #4921
4921: Allow SSR to match type references, items, paths and patterns r=davidlattimore a=davidlattimore

Part of #3186

Co-authored-by: David Lattimore <dml@google.com>
2020-06-22 11:50:34 +00:00
David Lattimore
662ab2ecc8 Allow SSR to match type references, items, paths and patterns
Part of #3186
2020-06-22 21:42:55 +10:00
Benjamin Coenen
5aad6c9fa6 don't complete top level attrs inside nested attrs and add better labels #4899
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-22 13:39:05 +02:00
bors[bot]
19701b39ac
Merge #4928
4928: Fix renaming mod in use tree r=matklad a=unexge

Fixes #4825

Co-authored-by: unexge <unexge@gmail.com>
2020-06-22 11:19:09 +00:00
BGluth
3a3b40a554 Created goto Self enum variant test 2020-06-21 13:27:16 -06:00
Benjamin Coenen
3df879f139 don't complete top level attrs inside nested attrs and add better labels #4899
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-21 19:14:08 +02:00
Leander Tentrup
df5b37cb61 Syntax highlighting for documentation comments on macro definitions 2020-06-20 00:02:42 +02:00
bors[bot]
90a5c4626a
Merge #4851
4851: Add quickfix to add a struct field r=TimoFreiberg a=TimoFreiberg

Related to #4563 
I created a quickfix for record literals first because the NoSuchField diagnostic was already there.
To offer that quickfix for FieldExprs with unknown fields I'd need to add a new diagnostic (or create a `NoSuchField` diagnostic for those cases)

I think it'd make sense to make this a snippet completion (to select the generated type), but this would require changing the `Analysis` API and I'd like some feedback before I touch that.

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-06-19 15:08:52 +00:00
bors[bot]
4575c38810
Merge #4839
4839: `Go to Type Definition` hover action. r=matklad a=vsrs

![hover_actions_goto](https://user-images.githubusercontent.com/62505555/83335671-0122e380-a2b7-11ea-9922-fbdcfb11a7f3.gif)

This implementation supports things like `dyn Trait<SomeType>`, `-> impl Trait`, etc.

Co-authored-by: vsrs <vit@conrlab.com>
2020-06-19 13:34:24 +00:00
Benjamin Coenen
3f26c5758d don't complete top level attrs inside nested attrs and add better labels #4890
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-18 21:31:49 +02:00
bors[bot]
f7f627d342
Merge #4903
4903: Add highlighting support for doc comments r=matklad a=Nashenas88

The language server protocol includes a semantic modifier for documentation. This change exports that modifier for doc comments so users can choose to highlight them differently compared to regular comments.

Example:
<img width="375" alt="Screen Shot 2020-06-16 at 10 34 14 AM" src="https://user-images.githubusercontent.com/1673130/84788271-f6599580-afbc-11ea-96e5-7a0215da620b.png">

CC @woody77 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-06-18 13:23:14 +00:00
Paul Daniel Faria
66fc084a86 Remove logic to mark all doctest code as 2020-06-18 09:14:02 -04:00
bors[bot]
13adfedf82
Merge #4821
4821: display Doctest code lens before comment r=matklad a=bnjjj

close #4785

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-18 10:34:21 +00:00
Benjamin Coenen
2732fdb595 display Doctest code lens before comment #4785
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-18 11:31:15 +02:00
vsrs
022fbefffa Apply suggestions from code review 2020-06-18 10:15:43 +03:00
vsrs
4b07c1e775 Add Type::walk method 2020-06-18 10:15:43 +03:00
vsrs
7ec0064409 Remove AdtOrTrait 2020-06-18 10:15:43 +03:00