Commit Graph

626 Commits

Author SHA1 Message Date
Kirill Bulatov
5cea8a37b7 Install rust-src when it is not found 2020-02-17 23:40:34 +02:00
Aleksey Kladov
353f7ce2ec Mention rust-src 2020-02-17 10:55:08 +01: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
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
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
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
Paulo Lieuthier
5b2d52c8df docs: describe new feature 'add custom impl for derived trait' 2019-11-28 17:36:40 -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
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
Jacob
813b725957 sublime: hint where feature flags would go 2019-10-25 11:32:31 -07:00
Aleksey Kladov
0dd35ff2b2 auto-generate assists docs and tests 2019-10-25 14:47:48 +03:00
Aleksey Kladov
dc65219ae1 document feature flags 2019-10-25 09:00:30 +03:00
Marco Groppo
46656222ed Instructions for VSCode Remote 2019-10-21 21:19:26 +02:00
Aleksey Kladov
7b15c4f7ae WIP: move to xtasks 2019-10-17 22:54:38 +03:00
Roberto Vidal
f4d50de275 Adds config option for cargo-watch --ignore flag 2019-10-17 20:21:07 +02:00
bors[bot]
93199002af
Merge #1922
1922: feat(assists): Make raw string unescaped r=matklad a=Geobert

Last piece of https://github.com/rust-analyzer/rust-analyzer/issues/1730

Co-authored-by: Geobert Quach <geobert@protonmail.com>
2019-10-08 09:52:22 +00:00
Aleksey Kladov
7665e444c0 use lockfile in cargo install 2019-10-08 09:35:27 +03:00
Ekaterina Babshukova
311dbb8545 remove visitor module 2019-10-05 17:48:31 +03:00
bors[bot]
dbf869b4d2
Merge #1952
1952: Create an assist for applying De Morgan's Law r=matklad a=cronokirby

Fixes #1807

This assist can transform expressions of the form `!x || !y` into
`!(x && y)`. This also works with `&&`.

This assist will only trigger if the cursor is on the central logical
operator.

The main limitation of this current implementation is that both operands
need to be an explicit negation, either of the form `!x`, or `x != y`.
More operands could be accepted, but this would complicate the implementation
quite a bit.

Co-authored-by: Lúcás Meier <cronokirby@gmail.com>
2019-10-05 09:09:38 +00:00
Luke Jones
4bc4cd71b2
Add alternative setup instruction for vim/neovim
Provide another option hint for vim/neovim users who do not want to run nodejs
2019-10-05 10:41:04 +13:00
Lúcás Meier
e06ad80d49
Fix typo about De Morgan's law assist 2019-10-04 12:45:22 +02:00
Lúcás Meier
fe8ec1c045 [#1807] Add entry in docs/user/features 2019-10-04 11:03:46 +02:00
Geobert Quach
e293c34e85 feat(assists): Keep only one version of make_raw_string 2019-09-29 19:16:59 +01:00
Geobert Quach
281e107155 feat(assists): Make raw string unescaped 2019-09-26 20:31:45 +01:00
nicrd
b0f992a351
Missing word 2019-09-25 21:49:52 -04:00
Paul Lesur
f14e2ffbe0 update documentation according to new settings
1. `command` has been added to change the default cargo-watch command
2. `check-arguments` has been renamed to `arguments` as a consequence

Thoses changes were merged in #1434
2019-09-25 10:55:18 +02:00
Geobert Quach
b6d55290a1 feat(assists): raw string <-> usual string manipulation
Fixes #1730
2019-09-19 22:12:28 +01:00
zoewithabang
8c2f81fdd0 Fixed markdown in user README 2019-09-18 15:01:56 +01:00
Aleksey Kladov
54e92e699c clarify sublime instructions
closes #1811
2019-09-11 04:50:08 +03:00
Heyward Fann
e031821594
Update README.md 2019-09-09 12:58:44 +08:00
Heyward Fann
a6c3f779a6
Update README.md
fixes base on #1755 reviews
2019-09-09 10:32:15 +08:00
bors[bot]
e365236bfb
Merge #1755
1755: feat(docs): add coc-rust-analyzer r=JeanMertz a=fannheyward



Co-authored-by: Heyward Fann <fannheyward@gmail.com>
2019-09-06 16:34:38 +00:00
Aleksey Kladov
28df377759 add option to disable notify 2019-09-06 17:21:29 +03:00
Ekaterina Babshukova
acb89d2be1 add assist to move type bounds to where clause 2019-09-05 13:29:13 +03:00
Heyward Fann
31017d6dc4 feat(docs): add coc-rust-analyzer 2019-09-03 16:02:32 +08:00
Bastian Köcher
18c7a1ebe7 Make sysroot use RUST_SRC_PATH if set 2019-08-22 21:59:23 +02:00
Aleksey Kladov
deea8f52d9 allow to exclude certain files and directories 2019-08-06 14:28:31 +02:00
Aleksey Kladov
2c70bb4dd8 document upgrade process
closes #1615
2019-07-29 12:14:11 +03:00
Aleksey Kladov
ecb1327fed Overhaul installation process
The new commands are

$ cargo install-ra --client-code
$ cargo install-ra --server --jemalloc
2019-07-27 14:35:18 +03:00
Florian Diebold
00c74b5d18 Implement inlay hints for emacs 2019-07-27 11:02:34 +02:00
Who? Me?!
857f3e546c
More details on how to set up coc 2019-06-18 09:25:59 -05:00
Andrew Chin
7c0168ce24
Fix typo docs/user/README.md 2019-05-30 10:10:10 -04:00
Pascal Hertleif
1e6ba19015 Make rainbows optional 2019-05-27 11:44:46 +02:00
Francisco Lopes
da28dccf62 Add Vim and NeoVim setup section 2019-05-25 18:55:59 -03:00
Aleksey Kladov
a25e103e45
mention why enableEnhancedTyping is needed 2019-05-22 15:04:30 +03:00
Unreal Hoang
079ed6011a
add feature doc 2019-05-21 23:31:57 +09:00
Aleksey Kladov
2c0f4172e4 add manual installation instructions 2019-05-11 14:22:44 +03:00
Unreal Hoang
d1c21b85cf
add complex match case and documentation 2019-05-02 01:41:02 +09:00
kjeremy
9d25e5dea4 Add to features 2019-04-23 16:32:30 -04:00
Aleksey Kladov
493bf20b3d fix docs 2019-04-21 12:52:54 +03:00
Bernardo
4cd0a96c96 update user docs 2019-04-20 10:02:23 +02:00
Mathieu Amiot
3e980fcf6b Added instructions for Sublime Text 3 setup 2019-04-19 11:50:01 +02:00
Marco Groppo
c5f8f3b1f4 Stylistic changes. Updated features.md with the new assists. 2019-04-09 21:12:54 +02:00
Edwin Cheng
02e450f354 Add cargo-watch.check-arguments 2019-04-02 15:03:31 +08:00
Edwin Cheng
ee05eafe6c Add config for cargo-watch trace 2019-04-02 15:03:31 +08:00
Aleksey Kladov
c4dfced1f8
fix typo 2019-03-29 16:51:20 +03:00
gfreezy
8cb3041a0c markdown syntax 2019-03-25 23:15:52 +08:00
gfreezy
2ca1b2bc8f add desc and examples for inline variable action 2019-03-25 23:14:30 +08:00
Aleksey Kladov
ac6749d18c fixes 2019-03-20 15:25:05 +03:00
Aleksey Kladov
dbed0f0e99 document some nice things 2019-03-20 13:19:46 +03:00
Aleksey Kladov
07a9e5c0e1 document assists 2019-03-20 13:05:03 +03:00
Aleksey Kladov
56ad19ef02 fix links 2019-03-20 12:21:55 +03:00
Aleksey Kladov
192a5cd11d better user docs 2019-03-20 12:17:12 +03:00
Aleksey Kladov
91203699ec introduce docs dir 2019-03-20 09:37:51 +03:00