Commit Graph

1745 Commits

Author SHA1 Message Date
Raymond Luo
5107123f9a clarify comment and add autolink test case 2022-06-23 19:02:30 -04:00
Florian Diebold
f410fdf6e3 Add two more tests 2022-06-23 14:49:05 +02:00
bitgaoshu
1ef5e14c2c goto where trait method impl 2022-06-23 14:01:22 +02:00
Raymond Luo
96ff235770 condense matches on autolink 2022-06-22 22:07:26 -04:00
Raymond Luo
b7e3f525bd handle autolink as edge case 2022-06-20 23:15:27 -04:00
Raymond Luo
c6f776c5f9 determine doc link type from start instead of text or code 2022-06-20 21:10:45 -04:00
harpsword
3a78cc5e67 feat: add fold range for multi line match arm list 2022-06-18 16:05:56 +08:00
Lukas Wirth
7d51fc4640 Show proc-macro loading errors in unresolved-proc-macro diagnostics 2022-06-15 17:34:01 +02:00
Lukas Wirth
325ceaef19 fix: Check for the correct proc-macro settings in missing proc-macro diagnostics 2022-06-14 11:00:06 +02:00
Lukas Wirth
9b9c13fc40 feat: On assoc item name hover, render trait decl docs 2022-06-13 11:57:33 +02:00
bors
e9d3fe0484 Auto merge of #12502 - Veykril:deps, r=Veykril
internal: Bump Dependencies
2022-06-10 19:51:04 +00:00
Lukas Wirth
76ae5434fa internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
Luke Chu
6079eeb1bf Hide param inlay hint when argument is fn-like macro with similar name 2022-06-08 14:37:57 +00:00
feniljain
25f3e7a33c fix: float display impl 2022-05-31 10:13:03 +05:30
bors
a5d7ab54f9 Auto merge of #12418 - Veykril:completions, r=Veykril
internal: More precise completion filtering with existing item qualifiers

Now we are approaching the more complex cases for filtering completions
2022-05-30 14:05:37 +00:00
Lukas Wirth
ea594c4c44 Use char for trigger character 2022-05-30 14:17:58 +02:00
Lukas Wirth
aced76d0ff Add implicit static lifetime hints 2022-05-30 13:59:58 +02:00
bors
9ceaff91d3 Auto merge of #12406 - harpsword:fix-add-inlayHints-closures-without-block, r=Veykril
fix: add an option to show inlay hint for return type of closures wit…

fix #12321
2022-05-30 11:36:55 +00:00
bors
bd0c2344f2 Auto merge of #12387 - 00nktk:fix-mod-rename, r=Veykril
fix(ide-db): correct single-file module rename

Fixes a bug where rust-analyzer would emit `WorkspaceEdit`s with paths to dirs instead of files for the following project layout.

lib.rs
```rust
mod foo;
```

foo.rs
```rust
mod bar {
    struct Bar;
}
```
Also fixes emitted paths for modules with mod.rs.
The bug resulted in panic in helix editor when attempting to rename a module.
2022-05-30 11:29:55 +00:00
yue4u
1b5f0462ed fix: visibility completion 2022-05-30 00:06:48 +09:00
harpsword
55509548e8 fix: add an option to show inlay hint for return type of closures without block 2022-05-28 22:12:30 +08:00
Nikita Podoliako
d98c04aac1 fix(ide-db): correct single-file module rename 2022-05-28 15:07:22 +03:00
bors
6c9fc4fec2 Auto merge of #12402 - Veykril:feat-docs, r=Veykril
minor: Freshen up goto feature docs

Fixes https://github.com/rust-lang/rust-analyzer/issues/2541
2022-05-27 13:47:56 +00:00
Lukas Wirth
86576072ab minor: Freshen up goto feature docs 2022-05-27 15:47:31 +02:00
bors
bd06902f90 Auto merge of #12395 - feniljain:fix_bugs, r=Veykril
fix: f32 and f64 representation during lowering

should fix #12380
2022-05-27 12:44:08 +00:00
feniljain
1f4870ff1c fix: f32 and f64 representation during lowering 2022-05-26 20:03:05 +05:30
Lukas Wirth
f02c915eb5 internal: Make autoclosing angle brackets configurable, disabled by default 2022-05-25 12:42:07 +02:00
Lukas Wirth
86d1d9067e fix: Insert whitespace into trait-impl completions when coming from macros 2022-05-24 22:56:33 +02:00
andylizi
e34ae760f0
add test for macro expand formatting 2022-05-24 12:45:58 +08:00
andylizi
ebf8b1a96e
ide: insert whitespaces surrounding _ in macro expansion 2022-05-24 07:54:43 +08:00
Lukas Wirth
9f6d99c6bd minor: Simplify syntax-highlighting macro checks 2022-05-23 17:03:19 +02:00
Lukas Wirth
377c9247e6 fix: When hovering macro inputs, don't show everything that was downmapped 2022-05-23 16:11:36 +02:00
Lukas Wirth
ad537be194 fix: When reference searching macro inputs, don't search everything that was downmapped 2022-05-23 16:09:56 +02:00
bors
038a71a201 Auto merge of #12345 - bvanjoi:escape_format_spcifier, r=Veykril
feat: escape format specifier(close: #12258)

solve https://github.com/rust-lang/rust-analyzer/issues/12258
2022-05-22 10:41:31 +00:00
bors
3535a052ce Auto merge of #12346 - rainy-me:fix/builtin-type-docs-links, r=Veykril
fix: special case base url of `BuiltinType` to core

fix #12250
2022-05-22 10:33:43 +00:00
rainy-me
3a380d4b3a fix: special case base url of BuiltinType to core 2022-05-22 18:50:40 +09:00
Felicián Németh
f7c963c0f2 onTypeFormatting: don't insert > if another > is there 2022-05-22 10:40:53 +02:00
Felicián Németh
3bb02f2329 feat: Add on-typing handler for left angle
Only advertise this feature in the server capabilities when the client
supports SnippetTextEdit.

Close #11398.

Co-authored-by: unexge <unexge@gmail.com>
2022-05-22 10:40:37 +02:00
Felicián Németh
636d4880c4 internal: Allow OnTypeFormatting to send SnippetTextEdit
But continue to send TextEdit only.
2022-05-22 10:39:18 +02:00
bvanjoi
f6b8525b1d feat: escape format specifier(close: #12258) 2022-05-22 15:32:24 +08:00
bors
2a978e1404 Auto merge of #12328 - Veykril:simplify, r=Veykril
minor: Simplify
2022-05-20 15:03:59 +00:00
Lukas Wirth
88e297e47d minor: Simplify 2022-05-20 16:52:10 +02:00
andylizi
2b1c1a934c
feat: hide type inlay hints for initializations of closures 2022-05-20 17:42:56 +08:00
NotWearingPants
641b78a162
hide closure ret hints if ret type is specified
fixes #12319
2022-05-20 02:35:37 +03:00
Jonas Schievink
52ff863abc Teach Callable about closures properly 2022-05-19 18:53:08 +02:00
Lukas Wirth
9ebb55d354 Hide more unnecessary parameter hints for constructors 2022-05-19 15:44:52 +02:00
Lukas Wirth
5fe28441b8 Update test fixtures 2022-05-19 15:20:45 +02:00
Lukas Wirth
b08bbd7be0 Enable hovering function parameter inlay hints 2022-05-19 14:32:40 +02:00
Lukas Wirth
74230e26ff internal: Improve inlay hint tooltips 2022-05-19 13:38:37 +02:00
Lukas Wirth
58a241134c Update test output 2022-05-17 14:58:26 +02:00
Lukas Wirth
21f37a6d9e Allow inlay hint tooltips to trigger hovers 2022-05-17 14:46:43 +02:00
Lukas Wirth
a2ec010185 Trigger hover requests on closing brace hints 2022-05-17 13:39:45 +02:00
Lukas Wirth
0756719a30 Replace some SmolStr usages with String as the conversion happens anyways 2022-05-17 12:56:14 +02:00
Lukas Wirth
12d5343993 internal: Cleanup lifetime elision hints 2022-05-17 12:18:07 +02:00
Jonas Schievink
fccc12982e Add closing brace hints for macros 2022-05-16 15:23:25 +02:00
Jonas Schievink
867a7dc7a0 Show inlay hints after a } to indicate the closed item 2022-05-16 14:55:47 +02:00
Lukas Wirth
7cbde1b3a5 Enable reborrow hints in attribute calls 2022-05-14 15:00:14 +02:00
Lukas Wirth
6b696fced8 feat: Add binding mode inlay hints 2022-05-14 14:58:35 +02:00
Lukas Wirth
3577c44dee fix: Fix fill-arguments completions not working 2022-05-13 19:52:44 +02:00
Jonas Schievink
9bd11459ba Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink"
This reverts commit cc9ae2b89e, reversing
changes made to 7dfd1cb572.
2022-05-13 15:08:14 +02:00
bors
135164f547 Auto merge of #12226 - Veykril:reborrow-inlay-hints, r=Veykril
feat: Allow reborrow inlay hints to be restricted to mutable reborrows only
2022-05-12 12:21:06 +00:00
Lukas Wirth
c2190ad87c feat: Allow reborrow inlay hints to be restricted to mutable reborrows only 2022-05-12 14:00:06 +02:00
Lukas Wirth
ca46c68b04 internal: Remove redundant offset data in annotations 2022-05-12 13:06:49 +02:00
Jonas Schievink
ac3c18bc17 Include assoc. types in trait signature help 2022-05-10 16:54:31 +02:00
bors
cc695363e4 Auto merge of #12202 - iDawer:ide.sig_help-fix, r=lnicola
fix: don't panic at fully qualified call syntax in signature help

Closes  #12200
Regressed from #12082
2022-05-10 12:28:34 +00:00
iDawer
956b8fb954 signature_help: detect fully qualified call syntax for parameter fallback 2022-05-10 17:18:42 +05:00
bors
cf152e8a94 Auto merge of #12201 - Veykril:inlay-hide, r=Veykril
fix: Add cast expressions to param name inlay hint heuristics
2022-05-10 11:44:06 +00:00
Lukas Wirth
822d9b55b7 fix: Add cast expressions to param name inlay hint heuristics 2022-05-10 13:43:43 +02:00
Jonas Schievink
7e45915aa4 Resolve assoc. types of supertraits in the IDE layer 2022-05-09 17:30:49 +02:00
Jonas Schievink
37443eb9a1 Maybe everything else *should* have to deal with it 2022-05-05 16:28:59 +02:00
Jonas Schievink
34dc8e9383 Wrap floats in token trees in FLOAT_LITERAL node 2022-05-05 16:28:59 +02:00
Jonas Schievink
1bc3305d95 Split float literal tokens at the . 2022-05-05 16:28:58 +02:00
Laurențiu Nicola
9856144b0b Lower values of char and byte literals 2022-05-05 08:12:08 +03:00
rainy-me
ddff1b22f9 fix: add docs and remove unnecessary check 2022-05-05 13:41:33 +09:00
rainy-me
5f4351fbb6 fix: doc url link type 2022-05-05 00:41:29 +09:00
bors
cc12d9df3f Auto merge of #12120 - iDawer:ide.sig_help, r=Veykril
fix: Don't show signature help after closing bracket

Stop showing signature help after closing angle/round brackets.

Fixes #11624
2022-05-02 12:13:16 +00:00
Lukas Wirth
b6e19add06 minor: Add a test for display rendering record variants 2022-05-02 12:51:00 +02:00
Peh
1f011fa4a3 style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
iDawer
dffbab45f4 Don't show signature help after closing bracket 2022-04-29 23:26:54 +05:00
Laurențiu Nicola
4a57307674 Revert "Correctly fix formatting doc tests with generics"
This reverts commit 5f3327a6b8.
2022-04-27 15:30:54 +03:00
Laurențiu Nicola
0d02be7330 Revert "Update crates/ide/src/runnables.rs"
This reverts commit bf47acf1d3.
2022-04-27 15:30:54 +03:00
bors
198c075580 Auto merge of #12083 - Veykril:inlays, r=Veykril
minor: Add test for parameter and reborrow hint order
2022-04-26 09:53:26 +00:00
Lukas Wirth
5e413997a1 minor: Add test for parameter and reborrow hint order 2022-04-26 11:46:03 +02:00
iDawer
729cd8530b signature_help: use corresponding param list for methods 2022-04-26 11:50:28 +05:00
Lukas Wirth
4255996965 Re-export FxHashMap and FxHashSet from ide_db 2022-04-25 18:51:59 +02:00
bors
c1de78f54c Auto merge of #12072 - bitgaoshu:master, r=jonas-schievink
fix #11973 associated type is unresolved
2022-04-25 11:07:09 +00:00
bitgaoshu
5d1aff3357 #11973 associated type is unresolved 2022-04-24 20:51:48 +08:00
iDawer
baa4fa09ef Add fallback for return type 2022-04-23 17:21:21 +05:00
iDawer
fae9049ccd Fall back to parameter definitions on error types in signature help 2022-04-23 17:21:21 +05:00
Jonas Schievink
c6ffffccbd Allows triggering commands after an assist edit 2022-04-19 18:45:48 +02:00
Lukas Wirth
3de9a42810 Disable rustfmt for expand_macro on wasm platforms 2022-04-17 14:00:19 +02:00
Lukas Wirth
895a16265c Fix macro patterns not getting formatted properly 2022-04-17 13:46:00 +02:00
Lukas Wirth
e2f1a9a558 feat: Attempt to format expand_macro output with rustfmt if possible 2022-04-17 13:33:39 +02:00
bors
a912f2a9f6 Auto merge of #12001 - Veykril:refs, r=Veykril
fix: Do reference search on all downmapped tokens with the same kind only

cc https://github.com/rust-lang/rust-analyzer/issues/11668
2022-04-15 17:43:24 +00:00
Lukas Wirth
58660dee2a fix: Do reference search on all downmapped tokens with the same kind only 2022-04-15 19:42:48 +02:00
bors
5e41205e9c Auto merge of #12000 - Veykril:hlmac, r=Veykril
fix: Tag `macro_rules` macro bang with `MacroBang` tag

cc https://github.com/rust-lang/rust-analyzer/issues/11996
2022-04-15 17:19:33 +00:00
Lukas Wirth
be27efabfa fix: Tag macro_rules macro bang with MacroBang tag 2022-04-15 19:16:18 +02:00
Jonas Schievink
f96fd40104 add docs 2022-04-14 13:23:19 +02:00
Jonas Schievink
99e9e52fbc Remove trailing ; when turning assignment into == comparison 2022-04-13 16:01:09 +02:00
Jonas Schievink
b9dd7db817 Add more no-op tests 2022-04-13 15:47:33 +02:00
Jonas Schievink
cde2a1de36 Add trailing ; when typing = in assignment 2022-04-12 19:39:19 +02:00
bors[bot]
49847a25ae
Merge #11883
11883: fix(ide): move moudle directory when rename r=rainy-me a=rainy-me

fix: #10992

Added `FileSystemEdit::MoveDir` variant for move dirs. Original implemented as recursively move child mod files but had many issues like

1. left empty dir after rename file
2. only affect rust file
3. not performant

so changed to current version

Co-authored-by: rainy-me <github@yue.coffee>
2022-04-12 15:17:00 +00:00
rainy-me
3dd581b97d fix: move dir on rename mod 2022-04-12 23:01:53 +09:00
Lukas Wirth
7f3572fa0d Simplify 2022-04-10 20:02:06 +02:00
Lukas Wirth
15e7112da3 fix: Check whether a parameter can be converted to a local 2022-04-09 00:55:45 +02:00
Jonas Schievink
5d8b4c40eb Determine function unsafety semantically 2022-04-07 18:33:03 +02:00
Lukas Wirth
3632d5946f minor: Remove pointless rebindings 2022-04-07 01:29:31 +02:00
Lukas Wirth
96b641e95e internal: Add more doc-link tests 2022-04-06 20:58:46 +02:00
Lukas Wirth
4a1423337f fix: Attempt to resolve paths in const arguments heuristically
While we don't support const args in type inference yet, we can at least
make use of the fallback path resolution to resolve paths in const args
in the IDE layer to enable some features for them.
2022-04-06 20:24:24 +02:00
Lukas Wirth
7959c24876 fix: Fix path qualifiers not resolving generic type params when shadowed by trait 2022-04-06 19:38:45 +02:00
Jonas Schievink
872b7b9660 Wrap macros in expr position in MacroExpr node 2022-04-05 17:43:34 +02:00
Lukas Wirth
f610e2c2ed Simplify completion import insertion 2022-04-02 01:42:21 +02:00
bors[bot]
ce8e028e9b
Merge #11872
11872: internal: Remove `PathResolution::AssocItem` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-01 17:12:44 +00:00
Lukas Wirth
c290e68ff9 internal: Remove PathResolution::AssocItem 2022-04-01 18:32:05 +02:00
bors[bot]
50225fe630
Merge #11869
11869: fix: code blocks with tilde also works like code block r=Veykril a=moreal

The `rustdoc` uses the `pulldown_cmark` package to parse *doc_comment* and the package also treat triple `~` characters also as code block fences. So when we run `cargo doc`, they will be placed also.

<img width="965" alt="image" src="https://user-images.githubusercontent.com/26626194/161208072-5a09a209-57fc-4a52-b190-b0a9be9ffcd6.png">

But `rust-analyzer` doesn't support it so it doesn't have any injected code highlights and any `Run doctest` hint. This pull request tries to allow also them. 🙇🏻‍♂️ 

Before:

<img width="224" alt="image" src="https://user-images.githubusercontent.com/26626194/161207405-b1d6cfda-82b1-4f60-8e42-c51d0ed98f38.png">

After:

<img width="161" alt="image" src="https://user-images.githubusercontent.com/26626194/161207693-8e39997c-9ca6-4e69-8c65-e9b70899f7db.png">


Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2022-04-01 12:40:51 +00:00
Lee Dogeon
e3f32d13e1 Code blocks with tilde also works like code block 2022-04-01 20:29:32 +09:00
Lukas Wirth
75689f2ad8 internal: Enforce Resolver to always have a module scope 2022-03-31 11:12:08 +02:00
Lukas Wirth
ef92453dfe internal: Refactor FamousDefs builtin crate search 2022-03-30 22:23:54 +02:00
Lukas Wirth
0ae795136d Sort runnable test results to make them deterministic 2022-03-26 19:38:20 +01:00
hkalbasi
22eaee25b8 organize const eval tests 2022-03-24 13:20:35 +04:30
hkalbasi
0e2989e421 Support constants in const eval 2022-03-24 13:09:22 +04:30
bors[bot]
75fada4aab
Merge #11805
11805: fix: Don't try to resolve methods on unknown types r=Veykril a=flodiebold

Fixes #10454, and some type mismatches.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-03-23 20:20:09 +00:00
Florian Diebold
fa923f9b19 Adjust value in syntax highlighting benchmark 2022-03-23 19:28:01 +01:00
bors[bot]
652233283b
Merge #11791
11791: fix: some fixes and improvements to signature help r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-23 00:36:11 +00:00
Lukas Wirth
8e91bb7660 minor: Bump dependencies 2022-03-22 17:42:24 +01:00
Jonas Schievink
4e07864f59 signature help: skip lifetimes when non-lifetime arguments are present 2022-03-22 16:44:27 +01:00
Jonas Schievink
4bb5df0ce5 Avoid signature help inside multiline expressions
Fixes #11768
2022-03-22 16:08:46 +01:00
Jonas Schievink
c9cefb9916 Improve readability of signature help tests 2022-03-22 15:03:19 +01:00
Laurențiu Nicola
1a37b17162 Replace write! with direct calls 2022-03-21 10:43:36 +02:00
bors[bot]
6f2b118605
Merge #11775
11775: internal: Treat `global_asm` and `asm` macros as unsafe r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:31:27 +00:00
Lukas Wirth
ddf144051a internal: Treat {global_}asm macros as unsafe 2022-03-20 19:31:00 +01:00
bors[bot]
fedf724d82
Merge #11774
11774: feat: Tag macro calls as unsafe if they expand to unsafe expressions r=Veykril a=Veykril

as long as they aren't inside an unsafe block inside the macro that is.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:15:29 +00:00
Lukas Wirth
68de7b30e0 feat: Tag macro calls as unsafe if they expand to unsafe expressions 2022-03-20 19:07:44 +01:00
bors[bot]
966b692422
Merge #11771
11771: feat: Visualize compiler inserted reborrows via inlay hints r=Veykril a=Veykril

Disabled by default.

![image](https://user-images.githubusercontent.com/3757771/159165178-baaf968a-4381-468e-933f-5326ca1b203d.png)

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


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 13:47:16 +00:00
Lukas Wirth
5a87f09a71 Update inlay hint feature docs 2022-03-20 14:41:27 +01:00
Lukas Wirth
37b48ceb8f feat: Visualize compiler inserted reborrows via inlay hints 2022-03-20 14:38:16 +01:00
bors[bot]
a82caff588
Merge #11765
11765: fix: Fix closure hints using macro ranges r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:26:34 +00:00
Lukas Wirth
2598575a35 fix: Fix closure hints using macro ranges 2022-03-19 20:24:09 +01:00
bors[bot]
7315d97347
Merge #11755
11755: feat: Implement lifetime elision hints r=Veykril a=Veykril

With names on:
![Code_erl26zKvuf](https://user-images.githubusercontent.com/3757771/159134856-e2c75d2d-f17c-45c7-9a78-3da5ee8b1acd.png)
With names off:
![Code_MRP1Pbfe9d](https://user-images.githubusercontent.com/3757771/159134857-30fac3a1-825e-4f49-ba9b-9fa0bb215694.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:15:06 +00:00
Lukas Wirth
7da5b80f25 Change skip trivial behaviour 2022-03-19 20:12:14 +01:00
Lukas Wirth
7ab0aaa82a Add option to skip trivial cases 2022-03-19 19:01:19 +01:00
Lukas Wirth
45756c823f Use numbers for lifetimes by default, add setting to prefer using parameter names 2022-03-19 18:11:56 +01:00
Jonas Schievink
55d2a25123 Rename call info to "signature help"
It is no longer limited to just calls
2022-03-18 20:19:35 +01:00
Jonas Schievink
0642724e94 Provide signature help when editing generic args 2022-03-18 19:59:41 +01:00
Lukas Wirth
c22fed895e Fix test fixtures 2022-03-18 18:57:15 +01:00
Lukas Wirth
b634d99361 Give the lifetimes better names 2022-03-18 18:55:03 +01:00
Lukas Wirth
673e2b1d8f feat: Implement lifetime elision hints 2022-03-18 18:11:16 +01:00
Lukas Wirth
828196be3b fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros 2022-03-18 12:01:59 +01:00
Lukas Wirth
bd17933c31 feat: Add return type hints for closures with block bodies 2022-03-16 21:25:03 +01:00
Lukas Wirth
4fe5f03c7f Rename compound things to variant things 2022-03-16 13:41:47 +01:00