Commit Graph

24505 Commits

Author SHA1 Message Date
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
bors
b75803ad31 Auto merge of #14057 - jonas-schievink:improve-match-to-let-else, r=jonas-schievink
feat: Improve "match to let else" assist

Closes https://github.com/rust-lang/rust-analyzer/issues/13540

Handles complex `let` patterns (rather than just idents), and diverging block expressions have their `{`/`}` stripped to create nicer code.
2023-01-30 16:57:48 +00: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
bors
f1b257f4eb Auto merge of #14041 - jonas-schievink:record-lit-signature-help, r=Veykril
feat: show signature help when typing record literal

Closes https://github.com/rust-lang/rust-analyzer/issues/13910

![Screenshot_20230127_191848](https://user-images.githubusercontent.com/1786438/215165358-8e51cd1a-d7c3-4c9d-a2d8-c22638bcf500.png)
2023-01-27 20:12:21 +00: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
bors
261afbdd88 Auto merge of #14039 - jonas-schievink:add-missing-impl-members-in-blocks, r=jonas-schievink
fix: Fix "add missing impl members" assist for impls inside blocks
2023-01-27 15:52:59 +00: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
bors
2935a89f3f Auto merge of #14037 - Veykril:if-let-match, r=Veykril
Handle boolean scrutinees in match <-> if let replacement assists better
2023-01-27 11:35:33 +00: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
bors
3e57a77cd1 Auto merge of #14026 - jonas-schievink:fix-libs-publish, r=jonas-schievink
internal: Try to fix auto-publishing of lib crates

https://github.com/rust-lang/rust-analyzer/issues/13912
2023-01-25 14:46:07 +00:00
Jonas Schievink
7cb0cfa3aa Try to fix auto-publishing of lib crates 2023-01-25 15:02:52 +01: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
bors
85736de3bc Auto merge of #14024 - meliache:update-split-emacs-documentation, r=lnicola
Update documentation for emacs and split it for LSP-mode and Eglot

Emacs has now two LSP clients, the more minimalistic and lightweight [Eglot](https://joaotavora.github.io/eglot) and the extensive though a bit bloated [LSP Mode](https://github.com/emacs-lsp/lsp-mode). Eglot will soon be shipped with Emacs29. Both have rust-analyzer enabled by default and require no further setup other then being installed and enabled. `lsp-rust.el` is not required anymore.

The base-installation for each of those modes is so easy now that I don't think an enumerated list is necessary, both packages can be installed via the standard `M-x package-install` and the installation is a one-liner that I provide.

Configuration is only necessary for supporting the rust-analyzer extensions to the LSP protocol, which are built into LSP mode and require an [extension-package](https://github.com/nemethf/eglot-x) for Eglot.

But for further documentation, including the LSP extensions, I link against official documentation where possible to avoid duplicating efforts having to continually update this to stay up-to-date.

I rewrote most of the original emacs documentation, but the [linked blog](https://robert.kra.hn/posts/2021-02-07_rust-with-emacs/) post by `@rksm` seems still being actively updated with updates to LSP mode, so I kept the link. That blog post is opinionated, I personally use different packages which achieve similar end results (Eglot instead of LSP-mode, corfu instead of capf, vertico instead of helm etc.). But if someone doesn't already have an extensive Emacs configuration, I think this is not a bad starting point.

Disclaimer: I'm a Rust beginner, which is why I read the rust-analyzer setup docs. So I necessarily know how most Rust experts use Emacs. But I'm an experienced Emacs user who uses several other programming languages via LSP-mode support in Emacs. I used both, initially LSP-mode and recently migrated to Eglot.

Also I'm not an experienced in writing asciidoc and I didn't do a local test-built, hopefully the html builds in the way I imagine it. So I recommend to check that aspect of the PR. Maybe the documentation is in the CI build-artifacts?

This is a duplicate of a PR to the old rust-analyzer project https://github.com/rust-analyzer/rust-analyzer.github.io/pull/197, which I made because I didn't know that the documentation now lives here.
2023-01-25 13:05:51 +00:00
Michael Eliachevitch
18366145b0
Update documentation for emacs and split for LSP and Eglot modes
Emacs has now two LSP clients, the more minimalistic and lightweight Eglot and
the extensive though a bit bloated LSP-Mode. Eglot will soon be
shipped with Emacs29. Both have rust-analyzer enabled by default and require
no further setup then just being installed and enabled. `lsp-rust.el` is not
required anymore.

The base-installation for each of those modes is so easy now that I don't think
an enumerated list is necessary, both package can be installed via the standard
`M-x package-install` and the installation is a one-liner that I provide.

Configuration mostly comes into play for support the rust-analyzer extensions to
the LSP protocol, which are built into LSP mode and require an extension-package
for Eglot.

But for the configuration beyond the base configuration I link against official
documentation, quickstart guides and documentation for the lsp extensions, to
avoid showing outdated information here.

This commit is mostly a duplicate of a PR [1] that I made against the
rust-analyzer github project.

[1]: https://github.com/rust-analyzer/rust-analyzer.github.io/pull/197,
     7ff0113006

Spelling: Space before version number in Emacs 29 in manual

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2023-01-25 13:36:27 +01:00
bors
8bf338f2c8 Auto merge of #14023 - Veykril:config-sub-fix, r=Veykril
fix: config substitution failing extension activation

Closes https://github.com/rust-lang/rust-analyzer/issues/14022

Not sure how a function can appear there, but there is also no reason for us to care about it anyways.
2023-01-25 09:22:01 +00:00
Lukas Wirth
e6ad8a2edc fix: config substitution failing extension activation 2023-01-25 09:17:49 +01: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
e86bac92f4 Auto merge of #14019 - Veykril:ts-bin-og, r=Veykril
Substitute VSCode variables more generally
2023-01-24 13:27:19 +00:00
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
Lukas Wirth
ec9476015c Substitute VSCode variables more generally 2023-01-24 13:46:56 +01:00
bors
86f73a0081 Auto merge of #14017 - lowr:patch/remove-type-walk, r=Veykril
internal: remove `TypeWalk`

Because less code is better!

`hir_ty::TypeWalk` is only used in analysis-stats and its usage can be replaced by checking `TypeFlags` (which is precomputed upon `TyKind` interning so it should make analysis-stats a bit faster, though it was really negligible in my local environment).

We should just use chalk's `TypeVisitor` or `TypeFolder` instead even if we come to need it again.
2023-01-24 12:08:51 +00:00
bors
e46c242a38 Auto merge of #14012 - parthopdas:master, r=Veykril
Adding section for Visual Studio IDE Rust development support

This PR adds a section for Rust support in Visual Studio IDE.
2023-01-24 11:19:17 +00: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
Partha P. Das
f9bb947fa4
Adding VS IDE 2023-01-23 16:31:03 -05:00
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
bors
1575d55fc8 Auto merge of #14009 - Veykril:ts-client, r=Veykril
🧹 lsp_ext.ts
2023-01-23 16:19:42 +00:00