Commit graph

440 commits

Author SHA1 Message Date
Aleksey Kladov
9b2bd022dc Snippetify add_new 2020-05-20 10:17:46 +02:00
Aleksey Kladov
767d169a2a Better cursor placement when adding impl members 2020-05-20 02:07:21 +02:00
Aleksey Kladov
a04cababaa Use snippets in add_missing_members 2020-05-20 01:53:21 +02:00
Aleksey Kladov
8eb3272ad6 Use snippets in add function 2020-05-20 01:23:05 +02:00
Aleksey Kladov
80545e5d3a New assist: add turbo fish 2020-05-20 00:27:10 +02:00
Aleksey Kladov
a752853350 Add snippetTextEdit protocol extension 2020-05-19 20:28:27 +02:00
Aleksey Kladov
fa2e5299c3 Add snippet support for some assists 2020-05-19 20:28:27 +02:00
Aleksey Kladov
19a8c1450c Relax VS Code version requirement 2020-05-18 00:16:35 +02:00
Coenen Benjamin
76af4a18db
Update features.md 2020-05-12 09:46:28 +02:00
Aleksey Kladov
72e229fcb3 Use RA_LOG instead of RUST_LOG for logging
RUST_LOG might be set up for debugging the user's problem, slowing
down rust-analyzer considerably. That's the same reason why rustc uses
RUSTC_LOG.
2020-05-11 19:16:00 +02:00
bors[bot]
9cb55966fe
Merge #4333
4333: Update Arch Linux and ALE install instructions r=matklad a=polyzen

Package has been added to the Arch repos:
https://www.archlinux.org/packages/community/x86_64/rust-analyzer/

ALE merged rust-analyzer support:
70005134e5

Co-authored-by: Daniel M. Capella <polyzen@archlinux.org>
2020-05-06 17:13:02 +00:00
Laurențiu Nicola
e0b63855b1
Fix Windows server path
CC @Coder-256.
2020-05-06 19:53:14 +03:00
Benjamin Coenen
51c02ab84f add Ok wrapping
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-06 17:45:55 +02:00
Daniel M. Capella
2b06041692
Update Arch Linux and ALE install instructions
Package has been added to the Arch repos:
https://www.archlinux.org/packages/community/x86_64/rust-analyzer/

ALE merged rust-analyzer support:
70005134e5
2020-05-05 18:23:32 -04:00
bors[bot]
d1c1c01309
Merge #4306 #4308
4306: Make incremental sync opt-out and fix line index rebuild r=matklad a=lnicola



4308: Update server binary paths in docs r=matklad a=Coder-256

Fixed incorrect macOS path and converted to a list. Also, should the Windows path include `matklad.rust-analyzer`? (I can't check)

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Jacob Greenfield <jacob@jacobgreenfield.me>
2020-05-05 10:02:56 +00:00
Jacob Greenfield
bcc1717378
Update server binary paths
Fixed macOS path and converted to a list
2020-05-04 13:16:29 -04:00
Francisco Lopes
18ba86b1c5
[manual] Improve requirements and editor wording 2020-05-04 14:12:32 -03:00
bors[bot]
805c0b92ac
Merge #4287
4287: Update debugging.md r=matklad a=lonesometraveler



Co-authored-by: KENTARO OKUDA <lonesometraveler@mac.com>
2020-05-04 02:54:49 +00:00
KENTARO OKUDA
42e2eca921 Update debugging.md 2020-05-03 15:14:56 -04:00
bors[bot]
17bd79f497
Merge #4272
4272: Fix Typos r=jonas-schievink a=lonesometraveler



Co-authored-by: KENTARO OKUDA <lonesometraveler@mac.com>
2020-05-02 22:56:52 +00:00
KENTARO OKUDA
4f4d0fd9ac Update syntax.md 2020-05-02 18:55:04 -04:00
KENTARO OKUDA
9914f7fbb2 Fix Typos 2020-05-02 17:45:46 -04:00
Benjamin Coenen
0b40876b99 Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-05-02 12:25:04 +02:00
Aleksey Kladov
b73dbbfbf2 Add missing members generates indented blocks 2020-05-02 11:53:07 +02:00
bors[bot]
d79a699f8e
Merge #4236
4236: Document Gnome Builder support r=matklad a=lnicola

Closes #3758.

CC @gwutz

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-05-01 20:09:12 +00:00
KENTARO OKUDA
f5d20b6525 Fix Typos on guide.md 2020-05-01 14:00:06 -04:00
Benjamin Coenen
dc34162450 Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-05-01 16:26:30 +02:00
KENTARO OKUDA
eafb2107dd Fix Typos 2020-05-01 09:43:08 -04:00
Laurențiu Nicola
c185e482e9 Document Gnome Builder support 2020-05-01 11:20:58 +03:00
bors[bot]
c96b2180c1
Merge #4228
4228: Fix typo in language server binary docs r=matklad a=ayazhafiz



Co-authored-by: hafiz <20735482+ayazhafiz@users.noreply.github.com>
2020-04-30 20:45:19 +00:00
Ömer Sinan Ağacan
742055e29f
Update Roslyn link in syntax.md
Eric Lippert has a new blog that he keeps updating, update the link to that
2020-04-30 23:27:06 +03:00
hafiz
d185cbd99e
Update readme.adoc 2020-04-30 11:29:21 -07:00
hafiz
a00647cefe
Fix typo in language server binary docs 2020-04-30 11:21:16 -07:00
Heyward Fann
2e4ce5390c docs(user): method chaining hints support
https://github.com/fannheyward/coc-rust-analyzer/issues/177#issuecomment-621109410
2020-04-30 11:38:20 +08:00
KENTARO OKUDA
9ff566212e Fix Typos on features.md 2020-04-29 16:00:52 -04:00
Benjamin Coenen
bbe22640b8 Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-29 14:53:47 +02:00
Benjamin Coenen
76733f0cd4 Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-29 14:08:30 +02:00
Boris Staletic
6b0be2f67f Fix YouComplteMe instructions link 2020-04-29 12:50:54 +02:00
Simon Cruanes
7edd293e5c
add ale to the nvim setup section of the readme 2020-04-28 21:01:10 -04:00
Youngsuk Kim
b40a237baf
tiny fix in markdown ordered list
`.3` => `3.`
2020-04-28 10:18:12 -04:00
Günter Zöchbauer
999e3312e0
Add missing . 2020-04-26 19:40:13 +02:00
Günter Zöchbauer
5df4a79951
Change install directory suggestion to ~/.local/bin
instead of `~/.cargo/bin`
2020-04-26 17:11:44 +02:00
Günter Zöchbauer
482e912fa0
xtask does not need to be installed
because it's contained in the dart-analyzer repo.
2020-04-26 17:08:15 +02:00
Günter Zöchbauer
49d494c033
Clarify rust-analyzer binary install 2020-04-26 15:44:05 +02:00
Aleksey Kladov
8843588fca Convert tests to text-size 2020-04-25 11:59:18 +02:00
Aleksey Kladov
b1d5817dd1 Convert code to text-size 2020-04-25 11:59:18 +02:00
bors[bot]
51a0058d4c
Merge #3998 #4006
3998: Make add_function generate functions in other modules via qualified path r=matklad a=TimoFreiberg

Additional feature for #3639 

- [x] Add tests for paths with more segments
- [x] Make generating the function in another file work
- [x] Add `pub` or `pub(crate)` to the generated function if it's generated in a different module
- [x] Make the assist jump to the edited file
- [x] Enable file support in the `check_assist` helper

4006: Syntax highlighting for format strings r=matklad a=ltentrup

I have an implementation for syntax highlighting for format string modifiers `{}`.
The first commit refactors the changes in #3826 into a separate struct.
The second commit implements the highlighting: first we check in a macro call whether the macro is a format macro from `std`. In this case, we remember the format string node. If we encounter this node during syntax highlighting, we check for the format modifiers `{}` using regular expressions.

There are a few places which I am not quite sure:
- Is the way I extract the macro names correct?
- Is the `HighlightTag::Attribute` suitable for highlighting the `{}`?

Let me know what you think, any feedback is welcome!

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
Co-authored-by: Leander Tentrup <ltentrup@users.noreply.github.com>
2020-04-24 20:10:54 +00:00
Weihang Lo
313409af9e
Add YouCompleteMe as a LSP option for vim/neovim 2020-04-23 17:09:37 +08:00
Timo Freiberg
317fc650d5 Make add_function generate functions in other modules via qualified path 2020-04-21 23:04:44 +02:00
Heyward Fann
0f49fd818b docs(readme): improve user docs
cleanup unavailable configurations/commands
2020-04-21 17:54:13 +08:00
Nikolai Morin
427f634de3
Move the PATH issue up to the non-editor specific section 2020-04-21 11:17:12 +02:00
Nikolai Morin
c0e9a1a476
Delete comma 2020-04-21 10:16:30 +02:00
Nikolai Morin
d22349de0a
Update docs/user/readme.adoc
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-04-21 10:15:49 +02:00
Nikolai Morin
22fd891d45
Update docs/user/readme.adoc
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-04-21 10:13:33 +02:00
Nikolai Morin
f964bbd735
More detailed Sublime Text install instructions
* People might typically jump directly to their editor and wonder where the part about installing rust-analyzer is – at least I did. I added a link to the relevant section for ST.
* Make ST instructions more detailed and user friendly (especially beginners), include troubleshooting tips.
* Minor grammar improvements throughout.
2020-04-21 09:20:14 +02:00
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
Laurențiu Nicola
b6b8fd9525 Replace ra_cli mentions 2020-02-17 22:07:24 +02:00
Laurențiu Nicola
aadab96c9d Fix RA_PROFILE typo in docs 2020-02-17 22:05:48 +02:00
Aleksey Kladov
353f7ce2ec Mention rust-src 2020-02-17 10:55:08 +01:00
Veetaha
2d7fe230f5 docs: Fix grammar mistakes 2020-02-16 23:52:41 +02:00
Veetaha
884e382fb8
Fix typo
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:47:12 +02:00
Veetaha
5bf7e9a455
Remove ptrace note
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:43:13 +02:00
Veetaha
bb9844e195
Add more verbose description
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:42:48 +02:00
Veetaha
7050697871
Add the article
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:42:10 +02:00
Veetaha
3db91db421
Reworded abit
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:40:31 +02:00
Veetaha
329a1b665d
Add an article
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:38:25 +02:00
Veetaha
dc90507dbe
Migrate from 'npm i' to 'npm install'
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:36:16 +02:00
Veetaha
1a96d4c15c
Make Rust Great Again
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:35:41 +02:00
Veetaha
79625e2dc2
Apply better wording as per lnicola
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:35:10 +02:00
Veetaha
351cc9021e
Add the article
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-16 23:33:23 +02:00
Veetaha
200a2475a2 docs: fix typo 2020-02-16 23:21:11 +02:00
Veetaha
64112b0b61 docs: update debugging.md with the freshest VSCode debugging information 2020-02-16 23:00:10 +02:00
Veetaha
43a41819cb docs: remove obsolescence notice in debugging.md 2020-02-16 21:03:24 +02:00
Veetaha
325eba58a2 vscode: updated user docs vscode updates section 2020-02-16 03:56:54 +02:00
Veetaha
4aa538f9a8
Typo
typo
2020-02-14 22:02:08 +02:00
Aleksey Kladov
81904421ac Ensure that the manual is self-improving 2020-02-14 19:15:32 +01:00
Aleksey Kladov
082dd87b32 Start manual 2020-02-14 18:31:56 +01:00
dvermd
7fb0311ac8 Move build prerequisites into build section 2020-02-10 06:55:10 +01:00
Veetaha
843d00ec9d docs: quick fix inner link in docs 2020-02-09 21:40:39 +02:00
Veetaha
3ebbeb46d4 docs: more documentation on prebuilt binaries all-editors-wise 2020-02-09 21:25:24 +02:00
Veetaha
e18661f62b docs: Freshen docs for prebuilt binaries and raLspServer setting 2020-02-09 20:19:23 +02:00
bors[bot]
360890fcec
Merge #3053
3053: Feature: downloading lsp server from GitHub r=matklad a=Veetaha

This is currently very WIP, I may need to change this and that, add "download language server command", logging stuff (for future bug reports), etc., but it already works.
Also didn't test this on windows yet and mac (don't have the latter)

The quirks:
* Downloaded binary doesn't have executable permissions by default, that's why we ~~`chmod 111`~~ (**[UPD]** `chmod 755` as per @lnicola [suggestion](https://github.com/rust-analyzer/rust-analyzer/pull/3053#discussion_r376694456)) for it.
* To remove installed binary run `rm /${HOME}/.config/Code/User/globalStorage/matklad.rust-analyzer/ra_lsp_server-linux`, ~~note that `-f` flag is necessary, because of `111` permissions (I think this should be changed)~~ (**[UPD]** --force is no longer needed due to 755 permissions).

I also tried to keep things simple and not to use too many dependencies, all the ones added have 0 dependencies, (`ts-not-nil` is my personal npm package, that imitates `unwrap()` in TypeScript)

**[UPD]** I reduced throttle latency of progress indicator to 200ms for smoother UX


// TODO:
- [x] ~~Add `Rust Analyzer: Download latest language server` vscode command.~~ **[UPD]**: having reviewed the code and estimated available options I concluded that this feature requires too many code changes, I'd like to extract this into a separate PR after we merge this one.
- [x] Add some logging for future debugging
- [x] ~~Gracefully handle the case when language server is not available (e.g. no internet connection, user explicitly rejected the download, etc.)~~ **[UPD]** Decided to postpone better implementation of graceful degradation logic as per [conversation](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Deployment.20and.20installation/near/187758550).

Demo (**[UPD]** this is a bit outdated, but still mainly reflects the feature):
![ra-github-release-download-mvp](https://user-images.githubusercontent.com/36276403/74077961-4f248a80-4a2d-11ea-962f-27c650fd6c4c.gif)

Related issue: #2988 #3007 

Co-authored-by: Veetaha <gerzoh1@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-02-09 15:21:12 +00:00
Veetaha
dfb81a8cd4 docs: fix spelling untill -> until
Co-Authored-By: Jonas Platte <jplatte@users.noreply.github.com>
2020-02-09 17:04:33 +02:00
Veetaha
be244ab2fb docs: minor fixes in wordings and punctuation 2020-02-09 15:54:54 +02:00
Veetaha
6a367886ec vscode: updated docs on prebuilt binaries 2020-02-09 15:51:28 +02:00
bors[bot]
27964cc9e7
Merge #3052
3052: Rename add import assist r=matklad a=SomeoneToIgnore

Based on the https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/2.20assists.20with.20the.20same.20action.20name/near/187655643 and the related discussion.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-09 08:51:56 +00:00
Florian Diebold
134cc70097 Docs cleanups 2020-02-08 16:15:58 +01:00
Kirill Bulatov
740a26b7d2 Rename add import assist 2020-02-07 23:53:08 +02:00
Aleksey Kladov
755077e372 Doctest autoimport 2020-02-06 18:14:44 +01:00
Gian D
0ef96f982c
Further fix docs/user/README.md
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-05 11:09:08 +01:00
Gian D
13211ed701
Fix unneeded . in docs/user/README.md 2020-02-05 10:38:53 +01:00
Jan
53fd24a6d3 updating nvim_lsp usage for rust_analyzer 2020-01-29 20:11:32 +01:00
Aleksey Kladov
84dfbfbd1d Freshen Architecture.md document 2020-01-29 15:08:31 +01:00
Aleksey Kladov
1065c2bf1d Freshen dev docs a tiny bits 2020-01-29 14:45:32 +01:00
bors[bot]
87e1baf242
Merge #2910
2910: Use package script r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-27 13:50:04 +00:00
Jeremy Kolb
1b5b30f2ac
Update docs/user/README.md
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-01-27 08:49:34 -05:00
Kirill Bulatov
316795e074 Initial auto import action implementation 2020-01-27 00:16:29 +02:00
Jeremy Kolb
141dc7b81a
Use package script 2020-01-26 12:57:54 -05:00
Aleksey Kladov
fd69f62976 Add syntax guide 2020-01-22 11:13:11 +01:00
Aleksey Kladov
875352b2b6 Rename Emacs "extension" 2020-01-13 12:56:33 +01:00
Aleksey Kladov
bd7aa5db14 Rename VS Code extension to rust-analyzer 2020-01-13 11:13:18 +01:00
Aleksey Kladov
cf5bdf464c
Merge pull request #2732 from detrumi/cargo-toml-not-found-message-toggle
Flag to hide cargo.toml not found error
2020-01-09 15:16:39 +01:00
Jeremy Kolb
895155de6d
Update lsp-features.md 2020-01-08 11:45:14 -05:00
Gus Wynn
218d211f48 add note in vscode instructions for vim plugin users 2020-01-05 07:37:58 -08:00
Wilco Kusee
e7bb82c3a4
Allow disabling Cargo.toml not found error 2020-01-03 15:04:54 +01:00
Aleksey Kladov
ffa928c3d5 Add example of color customization 2019-12-31 14:51:23 +01:00
bors[bot]
232785251b
Merge #2061
2061: Theme loading and "editor.tokenColorCustomizations" support. r=matklad a=seivan

Fixes: [Issue#1294](https://github.com/rust-analyzer/rust-analyzer/issues/1294#issuecomment-497450325)

TODO: 
- [x] Load themes
- [x] Load existing `ralsp`-prefixed overrides from `"workbench.colorCustomizations"`.
- [x] Load overrides from `"editor.tokenColorCustomizations.textMateRules"`.
- [x] Use RA tags to load `vscode.DecorationRenderOptions` (colors) from theme & overrides.
- [x] Map RA tags to common TextMate scopes before loading colors.
- [x] Add default scope mappings in extension.
- [x] Cache mappings between settings updates. 
- [x] Add scope mapping configuration manifest in `package.json`
- [x] Load configurable scope mappings from settings.
- [x] Load JSON Scheme for text mate scope rules in settings.
- [x] Update [Readme](https://github.com/seivan/rust-analyzer/blob/feature/themes/docs/user/README.md#settings).

Borrowed the theme loading (`scopes.ts`) from `Tree Sitter` with some modifications to reading `"editor.tokenColorCustomizations"` for merging with loaded themes and had to remove the async portions to be able to load it from settings updates. 

~Just a PoC and an idea I toyed around with a lot of room for improvement.~
For starters, certain keywords aren't part of the standard TextMate grammar, so it still reads colors from the `ralsp` prefixed values in `"workbench.colorCustomizations"`. 

But I think there's more value making the extension work with existing themes by maping some of the decoration tags to existing key or keys. 

<img width="453" alt="Screenshot 2019-11-09 at 17 43 18" src="https://user-images.githubusercontent.com/55424/68531968-71b4e380-0318-11ea-924e-cdbb8d5eae06.png">
<img width="780" alt="Screenshot 2019-11-09 at 17 41 45" src="https://user-images.githubusercontent.com/55424/68531950-4b8f4380-0318-11ea-8f85-24a84efaf23b.png">
<img width="468" alt="Screenshot 2019-11-09 at 17 40 29" src="https://user-images.githubusercontent.com/55424/68531952-51852480-0318-11ea-800a-6ae9215f5368.png">


These will merge with the default ones coming with the extension, so you don't have to implement all of them and works well with overrides defined in settings. 

```jsonc
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "keyword",
                "settings": {
                    "fontStyle": "bold",
                }
            },
        ]
    },
```


Edit: The idea is to work with 90% of the themes out there by working within existing scopes available that are generally styled. It's not to say I want to erase the custom Rust scopes - those should still remain and eventually worked into a custom grammar bundle for Rust specific themes that target those, I just want to make it work with generic themes offered on the market place for now. 

A custom grammar bundle and themes for Rust specific scopes is out of... scope for this PR. 
We'll make another round to tackle those issues. 


Current fallbacks implemented

```typescript
    [
        'comment',
        [
            'comment',
            'comment.block',
            'comment.line',
            'comment.block.documentation'
        ]
    ],
    ['string', ['string']],
    ['keyword', ['keyword']],
    ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']],
    [
        'keyword.unsafe',
        ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword']
    ],
    ['function', ['entity.name.function']],
    ['parameter', ['variable.parameter']],
    ['constant', ['constant', 'variable']],
    ['type', ['entity.name.type']],
    ['builtin', ['variable.language', 'support.type', 'support.type']],
    ['text', ['string', 'string.quoted', 'string.regexp']],
    ['attribute', ['keyword']],
    ['literal', ['string', 'string.quoted', 'string.regexp']],
    ['macro', ['support.other']],
    ['variable', ['variable']],
    ['variable.mut', ['variable', 'storage.modifier']],
    [
        'field',
        [
            'variable.object.property',
            'meta.field.declaration',
            'meta.definition.property',
            'variable.other'
        ]
    ],
    ['module', ['entity.name.section', 'entity.other']]
```


Co-authored-by: Seivan Heidari <seivan.heidari@icloud.com>
2019-12-29 16:49:40 +00:00
Florian Diebold
c39352fa43 Fill in type params in 'add missing impl members' assist 2019-12-24 17:29:27 +01:00
Seivan Heidari
b21d9337d9 Merge branch 'master' into feature/themes 2019-12-23 15:35:31 +01:00
Francisco Lopes
f909d2b56c Cleanup Vim and NeoVim instructions. Fix #2579 2019-12-17 20:57:32 -03:00
Laurențiu Nicola
78e8934976 Code: check whether the LSP binary is in PATH 2019-12-08 15:04:37 +02:00
Andrew Banchich
956ce1d10a
fix file name 2019-12-04 11:07:37 -05:00
Andrew Banchich
62cadecc89
fix link 2019-12-04 11:02:03 -05:00
Andrew Banchich
00d5fb44ab
use relative link 2019-12-04 11:00:51 -05:00
Andrew Banchich
a863298314
fix outdated link to ra-emacs-lsp.el 2019-12-04 10:48:03 -05:00
bors[bot]
3376c08052
Merge #2018
2018: assists: add assist for custom implementation for derived trait r=matklad a=paulolieuthier

Please, tell me if something could be more idiomatic or efficient.

Fixes #1256.

Co-authored-by: Paulo Lieuthier <paulolieuthier@gmail.com>
2019-12-02 15:52:11 +00:00
Jonathan Behrens
75be6553fe Add back corrected cargo install command 2019-12-01 13:29:49 -05:00
Jonathan Behrens
c69ed9bd1f
Clarify installation instructions
In particular it is necessary to clone the repository before running the other commands. I also removed the `cargo install` side note because it didn't actually work (running the command just produces an error that --package isn't a recognized flag) and added a tldr code block with the list of commands to run.
2019-11-30 21:20:54 -05:00
Alexander Ekdahl
1793abf4fd Update README 2019-11-29 19:36:48 -05:00
Paulo Lieuthier
5b2d52c8df docs: describe new feature 'add custom impl for derived trait' 2019-11-28 17:36:40 -03:00
Seivan Heidari
18a0937585 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-28 08:19:14 +01:00
Aleksey Kladov
757e593b25 rename ra_ide_api -> ra_ide 2019-11-27 21:35:06 +03:00
Seivan Heidari
15ea338ac9 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-25 01:54:54 +01:00
bors[bot]
7b6aa7c34e
Merge #2343
2343: implement assist invert_if r=matklad a=bravomikekilo

fix [issue 2219 invert if condition](https://github.com/rust-analyzer/rust-analyzer/issues/2219)
I put the assist cursor range to `if` of the if expression, because both condition and body will be replaced. Is there any way to replace them without cover the cursor position?
@matklad 

Co-authored-by: bravomikekilo <bmk1221@126.com>
2019-11-24 08:32:07 +00:00
bravomikekilo
adac4fc2f2 do refact and fix some issue 2019-11-24 13:14:57 +08:00
Ashkan Kiani
ebdde64287
Fix url to point to rust_analyzer specifically 2019-11-23 02:00:38 -08:00
Ashkan Kiani
8d02df93d7
Add note about neovim's built in language server 2019-11-23 01:58:13 -08:00
bravomikekilo
8a8be06219 initial invert_if 2019-11-22 02:51:40 +08:00
Seivan Heidari
358a1bcd70 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-21 01:11:41 +01:00
Florian Diebold
c079d9b63b Add rust-analyzer-expand-macro function for Emacs 2019-11-20 20:45:25 +01:00
Seivan Heidari
1e2d090ab8 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-20 03:56:43 +01:00
Edwin Cheng
47a4c3e77d Add document in features.md 2019-11-20 01:09:15 +08:00
Seivan Heidari
4bdb6351ac Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-18 20:53:40 +01:00
Aleksey Kladov
76da22e66a Don't create a separate bin for format hook 2019-11-18 15:27:04 +03:00
Seivan Heidari
cb26df9506 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-15 16:30:21 +01:00
bors[bot]
3ad11973ac
Merge #2165
2165: ra_assists: Add add_new assist r=matklad a=rep-nop

Adds a new assist to autogenerate a new fn based on the selected struct, excluding tuple structs and unions. The fn will inherit the same visibility as the struct and the assist will attempt to reuse any existing impl blocks that exist at the same level of struct.

Not marking this as closing #1644 since there's a part 2 of adding autocompletion for when someone starts typing `[pub ]fn new(...`

Co-authored-by: Wesley Norris <repnop@outlook.com>
2019-11-15 07:01:19 +00:00
Seivan Heidari
11755f3eff Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-12 09:46:35 +01:00
Greg
eb72156094
Implement postfix completions feature flag 2019-11-11 22:55:10 -05:00
Wesley Norris
cbc6f94573 Add add_new assist
Adds a new assist to autogenerate a new fn based on the selected struct,
excluding tuple structs and unions. The fn will inherit the same
visibility as the struct and the assist will attempt to reuse any
existing impl blocks that exist at the same level of struct.
2019-11-09 10:56:36 -05:00
Seivan Heidari
ec82ca8391 Clearer docs usage under rust-analyzer.scopeMappings. 2019-11-05 00:18:16 +01:00
Seivan Heidari
c60f9bf4c6 * Adding scope mapping configuration manifest in package.json
* Loading configurable scope mappings from settings.
* Updating Readme with `rust-analyzer.scopeMappings`.
`rust-analyzer.scopeMappings` -- a scheme backed JSON object to tweak Rust Analyzer scopes to TextMate scopes.
   ```jsonc
    {
        //Will autocomplete keys to available RA scopes.
        "keyword.unsafe": ["keyword", "keyword.control"],
        //Values are string | TextMateScope | [string | TextMateScope]
        "comments": "comment.block"
    }
   ```
2019-11-04 23:59:11 +01:00
Aleksey Kladov
b6fcacd96d move all assists to use generated docs 2019-10-27 17:49:39 +03:00
Aleksey Kladov
85c64ec7be use new api for flip_trait_bound assist 2019-10-27 17:02:43 +03:00
Aleksey Kladov
da5528824a document almost all assists 2019-10-27 12:23:22 +03:00
Aleksey Kladov
a490ba06fa document some more assists 2019-10-27 11:26:46 +03:00
Aleksey Kladov
cf4720ffd5 use unicode bar for drawing the cursor 2019-10-26 21:22:40 +03:00
Aleksey Kladov
4a83aae098 support range selection in assist docs 2019-10-26 20:57:23 +03:00
Aleksey Kladov
a5cbd8d5e8 check style for assist docs 2019-10-26 19:08:13 +03:00
Aleksey Kladov
4ef9b8d17a use correct spacing for enum pattern 2019-10-26 18:03:55 +03:00
Aleksey Kladov
3126152a84 document a couple of assists 2019-10-26 17:37:55 +03:00
Aleksey Kladov
d385438bcc generate more assists docs 2019-10-25 23:38:15 +03:00