Lukas Wirth
8e998c4aa7
Fail spawning proc-macro servers when their api version is newer than r-a's
2023-02-03 10:38:38 +01:00
Ryo Yoshida
98c8077495
fix: support non-ascii characters in case conversion
2023-02-03 18:11:11 +09:00
bors
eeceba7480
Auto merge of #14065 - lowr:patch/generate-generic-function, r=Veykril
...
Support generic function in `generate_function` assist
Part of #3639
This PR adds support for generic function generation in `generate_function` assist. Now the assist looks for generic parameters and trait bounds in scope, filters out irrelevant ones, and generates new function with them.
See `fn_generic_params()` for the outline of the procedure, and see comments on `filter_unnecessary_bounds()` for criteria for filtering. I think it's good criteria for most cases, but I'm open to opinions and suggestions.
The diff is pretty big, but it should run in linear time w.r.t. the number of nodes we operate on and should be fast enough.
Some notes:
- When we generate function in an existing impl, generic parameters may cause name conflict. While we can detect the conflict and rename conflicting params, I didn't find it worthwhile mainly because it's really easy to resolve on IDE: use Rename functionality.
- I've implemented graph structure myself, because we don't have graph library as a dependency and we only need the simplest one.
- Although `petgraph` is in our dependency graph and I was initially looking to use it, we don't actually depend on it AFAICT since it's only used in chalk's specialization graph handling, which we don't use. I'd be happy to replace my implementation with `petgraph` if it's okay to use it though.
- There are some caveats that I consider out of scope of this PR. See FIXME notes on added tests.
2023-02-02 09:06:22 +00:00
Ryo Yoshida
493cabbde7
Treat scope info retrieval failure as assist failure
2023-02-02 17:47:11 +09:00
bors
ccd142c616
Auto merge of #14058 - gftea:master, r=Veykril
...
fix negative trait bound in outline view (#14044 )
try to fix and close #14044
2023-02-01 20:00:19 +00:00
Laurențiu Nicola
ff340f9c21
Bump zip
2023-02-01 19:24:32 +02:00
bors
7acc434f46
Auto merge of #14071 - Veykril:inlay-hints, r=Veykril
...
fix: Don't render fieldless discriminant inlay hints for datacarrying enums
2023-02-01 10:39:15 +00:00
Lukas Wirth
14f19c73e9
fix: Don't render fieldless discriminant inlay hints for datacarrying enums
2023-02-01 11:38:39 +01:00
bors
bfe82cda48
Auto merge of #14036 - Veykril:write-method-resolution, r=Veykril
...
Record method resolution for remaining operator expressions
This allows goto def and future substituted hover to work for the concrete impls.
2023-02-01 10:23:33 +00:00
Lukas Wirth
c40b0895f0
Implement proc-macro-api versioning
2023-02-01 11:04:20 +01:00
hkalbasi
0bf0d937b8
unsize cast array only on pointer type
2023-01-31 20:23:38 +03:30
Lukas Wirth
41a46a78f2
Make tt generic over the span data
2023-01-31 14:58:16 +01:00
Ryo Yoshida
3edde6fcc1
Support generic function in generate_function
assist
2023-01-31 21:05:25 +09:00
Ryo Yoshida
32955c30cd
Add method to get generic parameters in a type
2023-01-31 21:05:23 +09:00
Ryo Yoshida
0df70d37fc
Minor refactoring
2023-01-31 21:05:04 +09:00
bors
577e839c0d
Auto merge of #14063 - Veykril:proc-macro-abi-1-58, r=Veykril
...
feat: Remove support for 1.58 proc-macro abi
This seems old enough that we can drop the support for it now, the less ABIs we have the less work it is adjusting our span implementation.
Extracted from https://github.com/rust-lang/rust-analyzer/pull/14061 , will rebase that over this once merged.
2023-01-31 11:17:29 +00:00
bors
06981d4b10
Auto merge of #14062 - WaffleLapkin:сurrent_edition, r=Veykril
...
internal: Set "current" edition to 2021
:p
2023-01-31 11:03:49 +00:00
Lukas Wirth
183f171263
Remove support for 1.58 proc-macro abi
2023-01-31 11:56:12 +01:00
Maybe Waffle
249ea9502d
Set "current" edition to 2021
2023-01-31 10:51:43 +00:00
bors
b4832b3d00
Auto merge of #14056 - Veykril:allow_internal_unsafe, r=Veykril
...
Parse macros `allow_internal_unsafe` attribute
We don't use it for anything yet but it might become part of hygiene
2023-01-31 10:50:47 +00:00
bors
be76f357af
Auto merge of #14034 - lnicola:tweak-change-collapsing, r=Veykril
...
internal: Tweak change collapsing
CC https://github.com/rust-lang/rust-analyzer/pull/14025#discussion_r1087946555 .
2023-01-31 10:37:50 +00:00
gftea
fd1a9a93fe
tidy by rustfmt
2023-01-30 20:34:07 +01:00
gftea
04a4ac1cff
trim trailing whitespaces
2023-01-30 20:17:12 +01:00
gftea
5356a8b157
trim trailing whitespaces ( #14044 )
2023-01-30 20:03:50 +01:00
gftea
75676ebe86
Update crates/ide/src/file_structure.rs
...
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2023-01-30 19:17:48 +01:00
gftea
28b7460db1
fix negative trait bound in outline view ( #14044 )
2023-01-30 17:57:27 +01:00
Jonas Schievink
6321b25a21
Apply the assist to itself
2023-01-30 17:52:15 +01:00
Jonas Schievink
1f20804b6e
Improve "match to let-else" assist
2023-01-30 17:50:02 +01:00
Lukas Wirth
c65782e64a
Parse macros allow_internal_unsafe attribute
2023-01-30 15:41:08 +01:00
Laurențiu Nicola
deff5f22f6
Tweak change collapsing
2023-01-29 17:20:22 +02:00
Jonas Schievink
cad4cb38cd
Make it work with Self { .. }
2023-01-27 19:25:31 +01:00
Jonas Schievink
e993072661
Provide signature help when typing record literal
2023-01-27 19:17:23 +01:00
Jonas Schievink
e7a2d13ff6
Fix "add missing impl members" assist for impls inside blocks
2023-01-27 16:51:55 +01:00
bors
0063e89469
Auto merge of #14038 - Veykril:no-sysroot-hard-err, r=Veykril
...
Don't fail workspace loading if sysroot can't be found
2023-01-27 13:03:45 +00:00
Lukas Wirth
b2598f4801
Don't fail workspace loading if sysroot can't be found
2023-01-27 13:49:28 +01:00
Lukas Wirth
6829190611
Handle boolean scrutinees in match <-> if let replacement assists better
2023-01-27 12:33:40 +01:00
Lukas Wirth
4ff6f3845f
Update ide test outputs
2023-01-27 11:40:44 +01:00
Lukas Wirth
4b4eabad3c
Record method resolution for try expressions
2023-01-27 11:25:34 +01:00
Lukas Wirth
a7f81e3cdc
Record method resolution for index expressions
2023-01-27 11:15:05 +01:00
Lukas Wirth
54da0bfbf0
Record method resolution for call expressions
2023-01-27 11:06:41 +01:00
bors
9814d79841
Auto merge of #14035 - Veykril:ast-id-arg, r=Veykril
...
minor: Remove unnecessary arg in `LowerCtx::ast_id`
2023-01-26 15:37:10 +00:00
Lukas Wirth
4a677e91aa
minor: Remove unnecessary arg in LowerCtx::ast_id
2023-01-25 21:52:28 +01:00
bors
dd673eea33
Auto merge of #14025 - Veykril:changekind-fix, r=jonas-schievink
...
fix: Fix process-changes not deduplicating changes correctly
probably fixes https://github.com/rust-lang/rust-analyzer/issues/12873 (will close it with this nevertheless as its not really reproducible)
2023-01-25 15:43:01 +00:00
bors
6fd5769996
Auto merge of #14011 - bvanjoi:fix-unwrap-block, r=jonas-schievink
...
fix(ide-assists): unwrap block when it parent is let stmt
fix #13990
2023-01-25 15:04:03 +00:00
Lukas Wirth
d712e52940
fix: Fix process-changes not deduplicating changes correctly
2023-01-25 15:01:15 +01:00
bors
46084a1e71
Auto merge of #14015 - vasilev-alex:lifetime-rename, r=Veykril
...
Don't include lifetime or label apostrophe when renaming
Closes #13907
2023-01-25 13:57:29 +00:00
bvanjoi
90b1222b0b
fix(ide-assists): unwrap block when it parent is let stmt
2023-01-25 10:25:59 +08:00
Nathaniel Brough
6c4749e8f5
fix(fuzz): Fixes broken Cargo.toml for fuzz tests
...
Fixes broken Cargo.toml for fuzz tests and adds building of
fuzz tests to the CI.
2023-01-24 10:54:10 -08:00
Alex Vasilev
3c898dd9a1
fix
2023-01-24 23:22:30 +05:30
bors
cd4ac0d87b
Auto merge of #14020 - Veykril:search-fix, r=Veykril
...
fix: Fix assoc item search finding unrelated definitions
Fixes https://github.com/rust-lang/rust-analyzer/issues/14014
2023-01-24 13:11:30 +00:00
Lukas Wirth
951ee3d0b5
fix: Fix assoc item search finding unrelated definitions
2023-01-24 14:11:02 +01:00
Ryo Yoshida
e9f14c505f
Remove TypeWalk
and use TypeFlags
instead
2023-01-24 19:44:58 +09:00
Alex Vasilev
5d013a79d6
exclude '
2023-01-24 13:19:20 +05:30
Alex Vasilev
5f1796f837
uncomment check
2023-01-24 12:45:51 +05:30
Alex Vasilev
8678b92218
Allow renaming lifetiems and labels without leading apostrophe
2023-01-24 12:43:13 +05:30
bors
c552e5a55f
Auto merge of #14004 - lowr:patch/no-need-to-escape-non-snippet, r=Veykril
...
Don't escape non-snippets in assist
I was misunderstanding that we're always sending snippets as response to assist request. For assists that never return snippets like `move_const_to_impl` we don't need to escape, and I don't think `utils::escape_non_snippet()` is useful at the moment since we guarantee that only a single edit will have `InsertTextFormat.Snippet` and we have `utils::render_snippet()` for that.
2023-01-23 16:32:53 +00:00
Lukas Wirth
b9fe5afb30
Add a 'open server logs' button to the error notification
2023-01-23 13:24:42 +01:00
Lukas Wirth
84239a1454
REplace soft breaks in markdown with spaces
2023-01-23 12:21:23 +01:00
Ryo Yoshida
01d8b8947c
Don't escape non-snippets in assist
2023-01-23 00:22:46 +09:00
Alex Vasilev
2a4837089e
fixes
2023-01-21 23:42:11 +05:30
Lukas Wirth
f8ed4d7ae4
Use lang item resolution instead of known paths
2023-01-21 19:03:36 +01:00
Lukas Wirth
1535881836
Replace SmolStr usage with lang item enum for lang items
2023-01-21 17:55:45 +01:00
bors
1afa032f34
Auto merge of #13996 - lnicola:bump-deps, r=lnicola
...
minor: Bump deps
2023-01-21 12:27:40 +00:00
Laurențiu Nicola
8f678a0169
Bump snap
2023-01-21 14:05:22 +02:00
Laurențiu Nicola
1431264646
Bump rayon
2023-01-21 14:05:22 +02:00
Laurențiu Nicola
25a5bd9b13
Bump object
2023-01-21 14:05:22 +02:00
Laurențiu Nicola
f2397638f5
Bump arbitrary and derive-arbitrary
2023-01-21 14:05:22 +02:00
Laurențiu Nicola
d26c8ccc89
Bump num_cpus
2023-01-21 08:49:50 +02:00
Laurențiu Nicola
392a6ee422
Bump once_cell
2023-01-21 08:48:46 +02:00
bors
303737dad7
Auto merge of #13989 - Veykril:hover, r=Veykril
...
internal: Remove hover fallback in favor of ranged hover
The fallback is usually more annoying than useful at this point (it messes with the range of diagnostic popups a lot), we now have a ranged hover to check the type of something which works a lot better.
Closes https://github.com/rust-lang/rust-analyzer/issues/11602
2023-01-20 22:00:22 +00:00
Lukas Wirth
4685b97f74
Remove hover fallback in favor of ranged hover
2023-01-20 21:52:05 +01:00
Alex Vasilev
dd9dcca7a2
assist id fix
2023-01-21 00:47:02 +05:30
Alex Vasilev
1ab58b190e
cargo test
2023-01-21 00:42:29 +05:30
Alex Vasilev
ddb2f8760b
typo fix
2023-01-21 00:30:38 +05:30
Alex Vasilev
69ffbe25a1
feat: add braces assist
2023-01-21 00:17:23 +05:30
Lukas Wirth
a542bd46bf
Split out some hover functions
2023-01-20 16:30:08 +01:00
bors
ce67dea2ac
Auto merge of #13988 - Veykril:hover-no-markdown, r=Veykril
...
Fix markdown removal in hover handling whitespace weirdly
Fixes https://github.com/rust-lang/rust-analyzer/issues/10028
2023-01-20 15:23:54 +00:00
Lukas Wirth
c5b1e3f2ae
Fix markdown removal in hover handling whitespace weirdly
2023-01-20 14:29:12 +01:00
bors
d46d012c38
Auto merge of #13978 - bvanjoi:array-match, r=Veykril
...
feat: array match
fixed https://github.com/rust-lang/rust-analyzer/issues/13970
2023-01-20 10:30:18 +00:00
bvanjoi
8fa69f9f7d
feat: array match
2023-01-20 10:59:30 +08:00
Maria José Solano
f7fcdb6218
Order alphabetically
2023-01-19 18:34:01 -08:00
Maria José Solano
d044bc3504
Format code
2023-01-19 18:33:47 -08:00
Maria José Solano
d5fb7a4ba4
Limit number of completions
2023-01-19 18:23:21 -08:00
Maria José Solano
ec89fc85a8
Add limit setting
2023-01-19 18:21:43 -08:00
bors
6e52c64031
Auto merge of #13985 - Veykril:content-modified, r=Veykril
...
Don't respond with a ContentModified while loading the workspace
Initially this was done to prevent frequent inlay hint flickering, but this causes a lot of problems for a bunch of clients. We can (and already kind of have) move this into the semantic token request handlers instead.
Fixes https://github.com/rust-lang/rust-analyzer/issues/10910
2023-01-19 21:00:26 +00:00
Lukas Wirth
7385467f2e
Don't respond with a ContentModified while loading the workspace
2023-01-19 21:52:27 +01:00
bors
56fb0cad6d
Auto merge of #13984 - Veykril:target-data-layout, r=Veykril
...
fix: Fix target-data-layout fetching incorrectly passing 'rustc' to rustc
2023-01-19 20:45:29 +00:00
Lukas Wirth
384fa4b84a
fix: Fix target-data-layout fetching incorrectly passing 'rustc' to rustc
2023-01-19 21:31:08 +01:00
onestacked
872408500b
Parse const_closures syntax.
...
Enables parsing of the syntax for `#![features(const_closures)]` introduced in https://github.com/rust-lang/rust/pull/106004
2023-01-19 15:40:07 +01:00
Lukas Wirth
c9d33cddc9
Don't run flycheck on startup unless checkOnSave is enabled
2023-01-18 21:38:30 +01:00
Lukas Wirth
1e4a182954
Fix checkOnSave to check config patching not always working
2023-01-18 20:29:55 +01:00
Laurențiu Nicola
210757769d
Fix replace_arith label
2023-01-17 16:31:34 +02:00
Ryo Yoshida
c53064fb58
Enforce builtin binop expectations even without lang items
2023-01-17 20:17:15 +09:00
Ryo Yoshida
461435adab
Enforce builtin binop expectations on single references
...
Also don't enforce them on non-builtin types
2023-01-17 20:17:09 +09:00
bors
fa874627f0
Auto merge of #13969 - Veykril:workspace.dependencies, r=Veykril
...
Use workspace.dependencies to declare local dependencies
2023-01-17 10:29:27 +00:00
bors
62907858d5
Auto merge of #13964 - Veykril:workspace.package, r=Veykril
...
Specify authors, edition, license and rust-versian via workspace.package
2023-01-17 10:13:24 +00:00
Lukas Wirth
bed4db3c62
Use workspace.dependencies to declare local dependencies
2023-01-17 10:52:26 +01:00
bors
e11c0e3e85
Auto merge of #13966 - HKalbasi:layout, r=Veykril
...
Don't compute layout if `TargetDataLayout` is not available
2023-01-17 09:39:32 +00:00
hkalbasi
ec65b3b3aa
fix tests
2023-01-16 23:45:12 +03:30
hkalbasi
77efa0267d
Don't compute layout if TargetDataLayout
is not available
2023-01-16 22:43:27 +03:30