Commit graph

235 commits

Author SHA1 Message Date
Timo Freiberg
1231418f31 Change add_function assist to use todo!() 2020-04-13 22:17:06 +02:00
bors[bot]
fd06fe7b13
Merge #3925
3925: Implement assist "Reorder field names" r=matklad a=geoffreycopin

This PR implements the "Reorder record fields" assist as discussed in issue #3821 .

Adding a `RecordFieldPat` variant to the `Pat` enum seemed like the easiest way to handle the `RecordPat` children as a single sequence of elements, maybe there is a better way ?

Co-authored-by: Geoffrey Copin <copin.geoffrey@gmail.com>
2020-04-11 18:40:46 +00:00
Geoffrey Copin
d9089245fe Generate doc 2020-04-11 20:32:58 +02:00
Chris Hopman
af04d45d32 Change missing impl assist to use todo!() instead of unimplemented()
todo!() "Indicates unfinished code" (https://doc.rust-lang.org/std/macro.todo.html)

Rust documentation provides further clarification:

> The difference between unimplemented! and todo! is that while todo!
> conveys an intent of implementing the functionality later and the
> message is "not yet implemented", unimplemented! makes no such claims.

todo!() seems more appropriate for assists that insert missing impls.
2020-04-10 13:56:12 -07:00
Elinvynia
eb1ca5f448 Better Sublime documentation 2020-04-09 00:32:56 +02:00
bors[bot]
77462bba62
Merge #3746
3746: Add create_function assist r=flodiebold a=TimoFreiberg

The function part of #3639, creating methods will come later

- [X] Function arguments
     - [X] Function call arguments
     - [x] Method call arguments
     - [x] Literal arguments
     - [x] Variable reference arguments
- [X] Migrate to `ast::make` API
    Done, but there are some ugly spots.

Issues to handle in another PR:
- function reference arguments: Their type isn't printed properly right now.
    The "insert explicit type" assist has the same issue and this is probably a relatively rare usecase.

- generating proper names for all kinds of argument expressions (if, loop, ...?)
    Without this, it's totally possible for the assist to generate invalid argument names.
    I think the assist it's already helpful enough to be shipped as it is, at least for me the main usecase involves passing in named references.
    Besides, the Rust tooling ecosystem is immature enough that some janky behaviour in a new assist probably won't scare anyone off.

- select the generated placeholder body so it's a bit easier to overwrite it

- create method (`self.foo<|>(..)` or `some_foo.foo<|>(..)`) instead of create_function.
    The main difference would be finding (or creating) the impl block and inserting the `self` argument correctly

- more specific default arg names for literals.
    So far, every generated argument whose name can't be taken from the call site is called `arg` (with a number suffix if necessary).

- creating functions in another module of the same crate.
    E.g. when typing `some_mod::foo<|>(...)` when in `lib.rs`, I'd want to have `foo` generated in `some_mod.rs` and jump there.
    Issues: the mod could exist in `some_mod.rs`, in `lib.rs` as `mod some_mod`, or inside another mod but be imported via `use other_mod::some_mod`.

- refer to arguments of the generated function with a qualified path if the types aren't imported yet
    (alternative: run autoimport. i think starting with a qualified path is cleaner and there's already an assist to replace a qualified path with an import and an unqualified path)

- add type arguments of the arguments to the generated function

- Autocomplete functions with information from unresolved calls (see https://github.com/rust-analyzer/rust-analyzer/pull/3746#issuecomment-605281323)
    Issues: see https://github.com/rust-analyzer/rust-analyzer/pull/3746#issuecomment-605282542. The unresolved call could be anywhere. But just offering this autocompletion for unresolved calls in the same module would already be cool.

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-04-03 08:23:44 +00:00
veetaha
dd5e4d4870 vscode: move docks about syntax tree to dev/README.md 2020-04-02 11:23:56 +03:00
veetaha
e4c69443e7 vscode: add docs about goto-definition for rust syntax tree 2020-04-02 11:13:38 +03:00
Timo Freiberg
e5fc42cbc1 Add create_function assist 2020-04-01 23:06:14 +02:00
veetaha
e86bfc0995 vscode: add docs about syntax tree 2020-03-31 18:26:53 +03:00
Edwin Cheng
df68373c8e Update docs to mention on Windows 2020-03-28 21:04:02 +08:00
Aleksey Kladov
1cf27b2e78
Update docs/user/readme.adoc
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-03-28 12:55:56 +01:00
Mariusz Klochowicz
92412bc3be Update docs to mention vscode installation path on macOS 2020-03-28 22:16:19 +10:30
Aleksey Kladov
dc311b10f3 Fix assist description 2020-03-27 13:23:19 +01:00
bors[bot]
a4901fdcfd
Merge #3742
3742: Replace if with if-let r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-27 11:21:57 +00:00
Aleksey Kladov
91e482b46d Replace if with if-let 2020-03-27 12:15:46 +01:00
Unreal Hoang
d9df0f43ac
Assist: replace unwrap with match 2020-03-27 00:08:12 +09:00
Matt Hooper
c1f9a1a1c5 Updated docs 2020-03-24 23:22:41 +01:00
bors[bot]
6ef64622af
Merge #3700
3700: fill match arms with empty block rather than unit tuple r=matklad a=JoshMcguigan

As requested by @Veetaha in #3689 and #3687, this modifies the fill match arms assist to create match arms as an empty block `{}` rather than a unit tuple `()`.

In one test I left one of the pre-existing match arms as a unit tuple, and added a body to another match arm, to demonstrate that the contents of existing match arms persist. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-24 11:48:32 +00:00
Josh Mcguigan
ff62ef19f7 update assists docs 2020-03-24 04:45:07 -07:00
Aleksey Kladov
681c6eeeeb Add troubleshooting secion 2020-03-24 10:40:16 +01:00
Aleksey Kladov
4b5435b52b Make from-source install use cargo installed binary by default 2020-03-20 13:07:12 +01:00
Aleksey Kladov
3f6dc20d3c Merge imports assist
Work towards #2220
2020-03-18 19:34:47 +01:00
murlakatamenka
21eb29155c User Manual: fix AUR link 2020-03-16 19:01:02 +03:00
murlakatamenka
3410679041 Add installation notes for Arch Linux users 2020-03-16 18:54:03 +03:00
Veetaha
895327522b docs: add documentation for vscode nightlies 2020-03-14 03:16:50 +02:00
Aleksey Kladov
ddfac09363 Fix docs 2020-03-12 18:04:11 +01:00
Steffen Lyngbaek
e98aff109a Parameter inlay hint separate from variable type inlay? #2876
Add setting to allow enabling either type inlay hints or parameter
inlay hints or both. Group the the max inlay hint length option
into the object.

- Add a new type for the inlayHint options.
- Add tests to ensure the inlays don't happen on the server side
2020-03-10 14:33:45 -07:00
Aleksey Kladov
3e8599778f Fix quotes
closes #3501
2020-03-09 12:31:23 +01:00
Veetaha
ce65cc949f vscode: groupd updates-related config under updates section as per @matklad 2020-03-09 10:59:36 +02:00
Veetaha
2847636d30 docs: change formatting 2020-03-08 19:10:52 +02:00
Veetaha
6bd1ff16e5 vscode: rename alwaysDownloadServer -> askBeforeDownload
The new name seems much simpler and it doesn't limit
this config value only to downloading the server binary.
Thus we wouldn't need to create another config
properties to handle other downloads whatsoever.
Anyway, I believe (heuristically) that most of the users
would want to set "askBeforeDownload": false once
and never bother clicking on the notification again
(because otherwise there is no big point in installing rust-analyzer if it cannot install the server)
2020-03-08 18:58:02 +02:00
Veetaha
49b4e88458 vscode: add docs on alwaysDownloadServer 2020-03-08 18:51:21 +02:00
Kirill Bulatov
e3ef17447f Better describe current inlay hints' limitations 2020-03-05 10:29:46 +02:00
Adam Bratschi-Kaye
28367f7e4f
rewording and typo fix
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-22 18:07:43 +01:00
adamrk
8ebd50fb99 add ssr doc 2020-02-22 17:19:24 +01:00
Kirill Bulatov
818a4ea272
Fix a typo 2020-02-22 14:35:48 +03:00
Kirill Bulatov
6f8d70363d
One more tiny doc fix 2020-02-22 13:52:49 +03:00
Kirill Bulatov
68c34d1f63
Code review fixes
Co-Authored-By: Florian Diebold <flodiebold@googlemail.com>
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-22 12:51:08 +02:00
Kirill Bulatov
64051ac5c7 Add inlay hints documentation 2020-02-22 10:23:03 +03:00
Andrew Blakey
cda6d2b25c update image 2020-02-21 14:55:15 -05:00
Andrew Blakey
1be166f0fb update docs 2020-02-21 14:53:30 -05:00
Edwin Cheng
b21ead6ede Add document for Show RA Version 2020-02-21 18:33:45 +08:00
Aleksey Kladov
312a779610 Add remove_mut assist 2020-02-19 12:44:54 +01:00
Laurențiu Nicola
48737be857 Fix dev guide broken links 2020-02-18 16:24:04 +02:00
Aleksey Kladov
c855e36696 Rename config value for server Path 2020-02-18 12:35:44 +01:00
Aleksey Kladov
c0fa5e2246 Rename the binary to rust-analyzer 2020-02-18 12:33:16 +01:00
Akihiro Takai
3bdb47ce66 Fix typo 2020-02-18 10:37:26 +09:00
Kirill Bulatov
50cf1e3d67
Reword the docs
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-17 23:48:47 +02:00
Kirill Bulatov
5cea8a37b7 Install rust-src when it is not found 2020-02-17 23:40:34 +02:00