Commit Graph

1463 Commits

Author SHA1 Message Date
bors[bot]
908c17bfa6
Merge #11595
11595: fix: lower string literals with actual value instead of default r=lnicola a=tysg

Fixes #11582. Some questions below in the code review section.

Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
2022-03-04 20:21:43 +00:00
Lukas Wirth
4a866fc672 Simplify 2022-03-04 20:23:25 +01:00
Lukas Wirth
32bf7af83e Support locals with multiple declaration sites 2022-03-04 19:49:08 +01:00
hkalbasi
4fa8749c44 Preserve order of generic args 2022-03-04 11:46:14 +03:30
Tianyi Song
89a19f57f8 Lower string literals with real val, not default 2022-03-04 10:16:35 +08:00
Lukas Wirth
464dd814ca slightly improve highlighting performance for derive annotated items 2022-03-03 22:59:34 +01:00
Lukas Wirth
8ded3ec9cf fix: Fix semantic highlighting breaking for lifetimes in macros 2022-03-03 22:53:03 +01:00
bors[bot]
342c3c42bb
Merge #11433
11433: minor: Add scary warning to `onEnter` r=lnicola a=lnicola

Closes #11432

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-28 10:15:44 +00:00
Laurențiu Nicola
6bf97692ae Add scary warning to onEnter 2022-02-28 12:15:15 +02:00
Lukas Wirth
47ce4436e4 Make hir::Local::name infallible 2022-02-26 16:36:44 +01:00
Lukas Wirth
36603e0478 Rename test highlighting output files 2022-02-26 14:52:42 +01:00
Lukas Wirth
c99fb4b1ac Split up highlighting tests a bit more 2022-02-26 14:45:09 +01:00
Lukas Wirth
48189bc1b4 Re-order and cleanup highlighting tests 2022-02-26 14:29:03 +01:00
Lukas Wirth
03d33556c9 fix: Don't emit unresolvedReference highlight tags in unlinked files 2022-02-26 13:53:54 +01:00
Jonas Schievink
a247fffdf6 Resolve $crate in HirDisplay of Path 2022-02-25 18:38:51 +01:00
Moritz Vetter
3da08071ce add logic to highlight continue and break keywords according to expectations 2022-02-24 18:58:14 +01:00
Moritz Vetter
cad0cf6950 refactor helper function to work with function taking expression enum instead of break expression 2022-02-24 18:58:14 +01:00
Moritz Vetter
1c074499f3 add some breaking tests (TDD - style) 2022-02-24 18:58:14 +01:00
Lukas Wirth
e759db361e Resolve functions as proc-macros via FileAstId 2022-02-23 11:21:46 +01:00
Lukas Wirth
2e124d15fb fix: Fix expand_macro always expanding the first listed derive 2022-02-22 12:32:27 +01:00
Lukas Wirth
b494795a42 update references::derive test output 2022-02-22 10:52:35 +01:00
Lukas Wirth
1bbef5af85 Fix syntax highlighting not highlighting derives anymore 2022-02-22 10:20:44 +01:00
Lukas Wirth
f13c98034b Make replace_derive_with_manual_impl work again 2022-02-22 10:20:44 +01:00
Lukas Wirth
be3168dabe Fix expand_macro not working for derive attributes 2022-02-22 10:20:44 +01:00
Lukas Wirth
7b89d5ede2 internal: Expand the derive attribute into a pseudo expansion 2022-02-22 10:20:40 +01:00
bors[bot]
c0ee2f23ff
Merge #11490
11490: Correctly fix formatting doc tests with generics r=Veykril a=KarlWithK

Before the doc_test would be outputted like this:
```zsh
"Foo<T, U>::t"
```
However, this would cause problems with shell redirection. I've changed it
so when generics are involved we simply wrap the expression under quotes as so:
```zsh
"\"Foo<T, U>::t\""
```

Note:
At the cost of adding this, I had to allocate a new string via
`format!{}`. However, I argue this is alright as this for just for
outputting the name of the doc test.

The following tests have been changed:
```
runnables::tests::doc_test_type_params
runnables::tests::test_doc_runnables_impl_mod
runnables::tests::test_runnables_doc_test_in_impl
```

Closes  https://github.com/rust-analyzer/rust-analyzer/issues/11489

Co-authored-by: KarlWithK <jocelinc60@outlook.com>
Co-authored-by: SeniorMars <jocelinc60@outlook.com>
2022-02-21 21:57:44 +00:00
SeniorMars
bf47acf1d3
Update crates/ide/src/runnables.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-21 15:23:09 -06:00
bors[bot]
b663b733d9
Merge #11522
11522: fix: Make code lenses work on attributed items r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-21 17:08:19 +00:00
Lukas Wirth
c6645f2eb6 fix: Make code lenses work on attributed items 2022-02-21 18:07:47 +01:00
bors[bot]
979b5b32bc
Merge #11455
11455: Handle proc-macro functions as the proc-macro they resolve to r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-21 16:56:37 +00:00
Lukas Wirth
0d3cd90d08 Move fn to proc-macro conversion to name classification 2022-02-21 17:56:11 +01:00
bors[bot]
24255e5b3d
Merge #11481
11481: Display parameter names when hovering over a function pointer r=Veykril a=Vannevelj

Implements #11474

The idea is pretty straightforward: previously we constructed the hover based on just the parameter types, now we pass in the parameter names as well. I went for a quick-hit approach here but I expect someone will be able to point me to a better way of resolving the identifier.

I haven't figured out yet how to actually run my rust-analyzer locally so I can see it in action but the unit test indicates it should work.

Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-02-21 13:08:31 +00:00
Chayim Refael Friedman
13ac5c3491 Fix various IDE features
As a side benefit, we got `let` guard support for `move_guard` for free.
2022-02-21 08:34:35 +02:00
KarlWithK
5f3327a6b8
Correctly fix formatting doc tests with generics
Before the doc_test would be outputted like this:
"Foo<T, U>::t"
However, this would cause shells with shell redirection. I've changed it
so when generics are involved we simply wrap the expression under escape
chanters as so:
"\"Foo<T, U>::t\""

Note:
At the cost of adding this, I had to allocate a new string via
format!{}. However, I argue this is alright as this for just for
outputting the name of the doc test.

The following tests have been changed:
runnables::tests::doc_test_type_params
runnables::tests::test_doc_runnables_impl_mod
runnables::tests::test_runnables_doc_test_in_impl
2022-02-17 20:27:37 -06:00
Jeroen Vannevel
842ffde43d
test names 2022-02-15 19:22:36 +00:00
Jeroen Vannevel
d985394ce2
add test for function pointer without identifier 2022-02-15 19:20:50 +00:00
Jeroen Vannevel
c450d0ce41
cleanup 2022-02-15 14:47:23 +00:00
Jeroen Vannevel
73e49493bd
rough, but appears to work 2022-02-15 14:39:22 +00:00
Lukas Wirth
95db3c1476 fix: keyword hover works on non-keyword tokens if expanded to keyword 2022-02-15 10:09:19 +01:00
bors[bot]
aafa40cebd
Merge #11369
11369: feat: Add type hint for keyword expression hovers r=Veykril a=danii

Adds the return type of keywords to tool-tips where it makes sense. This applies to: `if`, `else`, `match`, `loop`, `unsafe` and `await`. Thanks to `@Veykril` for sharing the idea of putting return type highlighting on other keywords!
![image](https://user-images.githubusercontent.com/39541871/151611737-12325c23-a1f9-4fca-ae48-279b374bdcdf.png)

Closes #11359

Co-authored-by: Daniel Conley <himself@danii.dev>
2022-02-14 21:07:41 +00:00
Daniel Conley
768804f11d
Hide Keyword Expression Hover For Units ()
Cleaned up the code for keyword expression hovers.

Added a check to hide units `()` in keyword expression hovers.
2022-02-14 15:26:40 -05:00
Lukas Wirth
cef8a17ea5 Handle proc-macro functions as the proc-macro they resolve to 2022-02-11 22:06:03 +01:00
Tianyi Song
e62e926a8a Use text range of name after macro expansion 2022-02-11 14:17:12 +08:00
TheDoctor314
add80bccfc Add test
The rename function should not change any path segments that refer to a
module by super.
2022-02-08 21:19:14 +05:30
Moritz Vetter
ba2ef69c79 Bump pulldown-cmark-to-cmark, adjust usages and fix test 2022-02-06 09:04:06 +01: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
Lukas Wirth
ddf7b70a0f Fix cfg_attr invalidating derive identifier IDE functionality 2022-01-30 22:47:16 +01:00
Daniel Conley
261abbf45e
Add Keyword Return Type Highlighting 2022-01-28 14:44:17 -05:00