Commit graph

1118 commits

Author SHA1 Message Date
Sahandevs
3a0234d60f format 2021-02-07 21:59:06 +03:30
Sahandevs
1bb4e973ff handle Thenable type rejects 2021-02-07 21:52:32 +03:30
Sahandevs
1d0e93b58e handle promise catches 2021-02-07 21:27:21 +03:30
Sahandevs
eb69f67ab7 add no-floating-promises rule 2021-02-07 21:18:15 +03:30
Sahandevs
06c02021a3 remove unnecessary 2021-02-07 21:15:13 +03:30
Lukas Wirth
fb2b1f5ea6 Fix resolveCodeAction trying to edit files before creating them 2021-02-05 21:33:37 +01:00
Edwin Cheng
35310f1032 Update vscode for new status 2021-01-29 01:04:14 +08:00
Aleksey Kladov
2870e70163 Add config option to ignore directories 2021-01-26 16:45:54 +03:00
Aleksey Kladov
c04b561e7e Remove the need to manually sync config in package.json 2021-01-26 16:22:24 +03:00
Laurențiu Nicola
03a1da9d46 Simplify file download code 2021-01-25 19:12:54 +02:00
bors[bot]
83231dd987
Merge #7409 #7421
7409: Add References CodeLens. r=matklad a=vsrs

Closes #5836

7421: Fix RA_LOG example in dev docs r=lnicola a=lnicola

bors r+

Co-authored-by: vsrs <vit@conrlab.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-25 11:18:58 +00:00
Laurențiu Nicola
5bd84716ed Code: reduce progress notification spam 2021-01-25 10:05:38 +02:00
vsrs
3618c4e0d3 Add References code lens.
For Struct, Enum, Union and Trait symbols.
2021-01-23 16:56:20 +03:00
Laurențiu Nicola
a19728604f Download aarch64-unknown-linux-gnu from GitHub 2021-01-17 16:35:57 +02:00
Laurențiu Nicola
1749a78ada Fix server path comparison 2021-01-14 15:38:57 +02:00
bors[bot]
aa9bef0797
Merge #7194
7194: Don't update the server if managed by the user r=matklad a=lnicola

Fixes #7187

CC @figsoda

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-07 14:39:50 +00:00
Laurențiu Nicola
c547ec1cd6 Don't update the server if managed by the user 2021-01-07 16:37:08 +02:00
Aleksey Kladov
037caec62c Use american spelling for config
As per

171c3c08fe/docs/dev/style.md (variable-naming)

Also implement config aliasing, for pain-free settings migrations in the future
2021-01-07 15:07:19 +03:00
Aleksey Kladov
f7a15b5cd1 More maintainable config
Rather than eagerly converting JSON, we losslessly keep it as is, and
change the shape of user-submitted data at the last moment.

This also allows us to remove a bunch of wrong Defaults
2021-01-06 15:39:28 +03:00
Aleksey Kladov
01a5b83562 Rename extension config 2021-01-04 18:41:24 +03:00
Laurențiu Nicola
9decc4c0a3 Allow download of aarch64-pc-windows-msvc binaries 2021-01-04 16:32:46 +02:00
bors[bot]
1cc73d60bb
Merge #7068
7068: Add VSCode command to view the hir of a function body r=theotherphil a=theotherphil

Will fix https://github.com/rust-analyzer/rust-analyzer/issues/7061. Very rough initial version just to work out where I needed to wire everything up.

@matklad would you be happy merging a hir visualiser of some kind? If so, do you have any thoughts on what you'd like it show, and how?

I've spent very little time on this thus far, so I'm fine with throwing away the contents of this PR, but I want to avoid taking the time to make this more polished/interactive/useful only to discover that no-one else has any interest in this functionality.

![image](https://user-images.githubusercontent.com/1974256/103236081-bb58f700-493b-11eb-9d12-55ae1b870f8f.png)


Co-authored-by: Phil Ellison <phil.j.ellison@gmail.com>
2021-01-03 09:03:15 +00:00
Phil Ellison
609a069757 Remove some unnecessary code copied from the Syntax Tree command 2021-01-01 19:35:10 +00:00
lf-
f7f6ac3554 Add an option for extra env vars in the Code extension 2020-12-30 04:51:07 -08:00
Lukas Wirth
689898e4f6 Apply text edits manually in vscode client 2020-12-29 15:43:17 +01:00
Phil Ellison
077592a12f Initial implementation of view-hir command 2020-12-28 18:29:58 +00:00
bors[bot]
94f661c62a
Merge #7001
7001: Add support for downloading aarch64-apple-darwin binaries r=matklad a=lnicola

There's also a slight behavior change here: we no longer download our 64-binaries on 32-bit Darwin and Linux. We still do that on Windows, as I don't know how to detect 32-bit Node on 64 Windows.

But some people install the 32-bit Code by mistake, I doubt 32-bit Windows is that popular in the Rust crowd.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-22 16:38:12 +00:00
bors[bot]
5506933a93
Merge #7002
7002: Extension conflict check detects more combinations r=extremegf a=extremegf

This will also detect conflicts with kalitaalexey.vscode-rust and work correctly after RA is integrated with rust-lang.rust extension.

Co-authored-by: Przemyslaw Horban <p.horban@invinets.com>
Co-authored-by: P. Horban <extremegf@gmail.com>
2020-12-22 15:23:36 +00:00
P. Horban
92b13d2fab
Fix grammar nit
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-12-22 16:22:33 +01:00
bors[bot]
013739c73d
Merge #6993
6993: Clean up descriptions for settings r=matklad a=rherrmann

Use two consecutive newlines (`\n\n`) to actually continue text on a
new line.

Use proper markup to reference related settings.

Consistently format references to files, command line arguments, etc.
as `code`. Format mentions of UI elements in _italic_.

Fix typos, add missing full-stops, add missing default values.

Co-authored-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
2020-12-22 15:07:36 +00:00
Przemyslaw Horban
a8b60afc2a Extension conflict check detests more combinations 2020-12-22 15:53:00 +01:00
Laurențiu Nicola
5ff576f503 Add support for downloading aarch64-apple-darwin binaries, change naming convention 2020-12-22 16:48:49 +02:00
Rüdiger Herrmann
9f070531a6 Clean up descriptions for settings
Use two consecutive newlines (`\n\n`) to actually continue text on a
new line.

Use proper markup to reference related settings.

Consistently format references to files, editor commands, command line
arguments, files, etc. as `code`.

Fix typos, add missing full-stops, add missing default values.
2020-12-22 14:51:17 +01:00
bors[bot]
b98ee075ee
Merge #6746
6746: Feature/add assist extract module to file r=matklad a=sasurau4

Fix #6522 

## Screenshot

<img src="https://user-images.githubusercontent.com/13580199/102748269-33a44300-43a5-11eb-9e37-f5fcb8e62f73.gif" width=600 />


## TODO

- [x] Remove all TODO comment
- [x] Pass the doc test



Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2020-12-22 10:04:24 +00:00
bors[bot]
61711d9757
Merge #6984
6984: Remove TextMate grammar r=dustypomerleau a=lnicola

Closes #6267

This is now included upstream in VS Code.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-22 04:02:28 +00:00
Laurențiu Nicola
211551646f Don't download x64 binaries on non-Mac arm64 2020-12-21 21:40:01 +02:00
Son
6089c6b1ea Allow code extension to download binary in apple arm 2020-12-22 06:23:50 +11:00
Laurențiu Nicola
1da99a79d9 Remove outdated FIXME 2020-12-21 20:36:58 +02:00
Laurențiu Nicola
ee73466830 Use /etc/os-release to check for NixOS
The motivation in #5641 isn't too strong, but /etc/os-release exists on
pretty much every Linux distro, while /etc/nixos sounds like an
implementation detail.
2020-12-21 19:21:43 +02:00
Laurențiu Nicola
133a32d446 Remove TextMate grammar
It's now included upstream in VS Code
2020-12-21 18:58:46 +02:00
Daiki Ihara
23ed33a3a6 Use workspace applyEdit instead of snippetWorkspaceEdit 2020-12-21 15:55:40 +09:00
Przemyslaw Horban
689ebb98be Fixed formatting 2020-12-18 18:47:03 +01:00
Przemyslaw Horban
1152e27520 Added a warning if conflicting rust-lang.rust is enabled. 2020-12-18 18:39:51 +01:00
kjeremy
d828bd794b LSP 3.16 - Released 2020-12-17 11:33:35 -05:00
Bryan Gin-ge Chen
c256eba21b
add language-configuration.json to .vscodeignore 2020-12-14 22:05:22 -05:00
Dusty Pomerleau
612be09282 add a language configuration for VS Code 2020-12-13 19:31:11 +11:00
Aleksey Kladov
2544abbf86 Make config.rs a single source of truth for configuration.
Configuration is editor-independent. For this reason, we pick
JSON-schema as the repr of the source of truth. We do specify it using
rust-macros and some quick&dirty hackery though.

The idea for syncing truth with package.json is to just do that
manually, but there's a test to check that they are actually synced.

There's CLI to print config's json schema:

    $ rust-analyzer --print-config-schema

We go with a CLI rather than LSP request/response to make it easier to
incorporate the thing into extension's static config. This is roughtly
how we put the thing in package.json.
2020-12-08 19:25:41 +03:00
bors[bot]
4d4f11925f
Merge #6706
6706: Move import text edit calculation into a completion resolve request r=matklad a=SomeoneToIgnore

Part of https://github.com/rust-analyzer/rust-analyzer/issues/6612 (presumably fixing it)
Part of https://github.com/rust-analyzer/rust-analyzer/issues/6366 (does not cover all possible resolve capabilities we can do)
Closes https://github.com/rust-analyzer/rust-analyzer/issues/6594

Further improves imports on completion performance by deferring the computations for import inserts.

To use the new mode, you have to have the experimental completions enabled and use the LSP 3.16-compliant client that reports `additionalTextEdits` in its `CompletionItemCapabilityResolveSupport` field in the client capabilities.
rust-analyzer VSCode extension does this already hence picks up the changes completely.

Performance implications are descrbed in: https://github.com/rust-analyzer/rust-analyzer/issues/6633#issuecomment-737295182

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-12-08 13:10:28 +00:00
Kirill Bulatov
cbd3717f2c Better config name 2020-12-08 14:27:18 +02:00
Kafji
e65cd07e48 Remove workaround & fix fetch$1 is not a function
Remove workaround for https://github.com/rollup/plugins/issues/491
because it's fixed in 15.0
https://github.com/rollup/plugins/blob/master/packages/commonjs/CHANGELOG.md#v1500.

Also fix fetch$1 is not a function error
https://github.com/rust-analyzer/rust-analyzer/issues/6757.
2020-12-08 13:06:36 +07:00
Kirill Bulatov
3183ff3a7b Disable the completion for no corresponding client resolve capabilities 2020-12-08 01:07:20 +02:00
kjeremy
31f50446ac Update npm packages 2020-12-07 12:29:48 -05:00
bors[bot]
ed5c1753b3
Merge #6496
6496: Use builtin scopes more r=matklad a=georgewfraser

VSCode has added more builtin fallback scopes, so we can remove some of our fallback scopes by aligning with their conventions. 

Note that the macro scope doesn't seem to actually *work* at the moment. I have filed a bug with VSCode: https://github.com/microsoft/vscode/issues/110150

Co-authored-by: George Fraser <george@fivetran.com>
2020-11-26 10:36:26 +00:00
George Fraser
ac314f88c6 Just remove the macro fallback 2020-11-25 08:41:40 -08:00
Kirill Bulatov
4c95c6e25d Gate autoimports begind experimental completions flag 2020-11-25 00:30:28 +02:00
Dusty Pomerleau
4410af455e ensure word boundary after true 2020-11-21 18:44:38 +11:00
kjeremy
1d333a8387 Use vscode-languageclient 7.0.0-next.14 2020-11-17 10:10:34 -05:00
Aleksey Kladov
4dfda64b39 Cleanup workspace loading a tiny bit 2020-11-13 17:38:26 +01:00
bors[bot]
b0ad492e3d
Merge #6519
6519: Add "Open Cargo.toml" action r=matklad a=p3achyjr

## What is it?

This adds an "open cargo.toml" action from the vscode shell, resolves #6462 

## Test

Ran ```cargo xtask install --server``` and ```cargo xtask install --client```, then ```Developer: Reload Window```.

![image](https://user-images.githubusercontent.com/8763808/98614382-2a578f00-22ad-11eb-9811-4a72a54ff6fb.png)

When clicked:

![image](https://user-images.githubusercontent.com/8763808/98618176-77d7fa00-22b5-11eb-8788-35256542f3a6.png)


Co-authored-by: Anatol Liu <axlui@anatols-mbp.lan>
2020-11-13 15:25:26 +00:00
Aleksey Kladov
75d2075665 Revert "Upgrade version of npms lockfile"
This reverts commit 3d559afc11.

VS Code uses nodejs 12 still, so its better to stick to the format it
understands.
2020-11-13 16:17:52 +01:00
Anatol Liu
b1b7727e04 add open Cargo.toml action 2020-11-12 17:48:07 -08:00
Aleksey Kladov
3d559afc11 Upgrade version of npms lockfile 2020-11-12 20:39:16 +01:00
Xavier Denis
89ce6b6664 Address review comments 2020-11-12 18:49:22 +01:00
Xavier Denis
8716087919 Add support for loading rustc private crates 2020-11-11 12:45:40 +01:00
Aleksey Kladov
7d2eb000b0 Switch to upstream protocol for resolving code action
Note that we have to maintain custom implementation on the client
side: I don't see how to marry bulitin resolve support with groups and
snippets.
2020-11-10 18:48:46 +01:00
Dusty Pomerleau
22dbbd16d8 fix: prevent /**/ from matching block doc comments 2020-11-10 09:54:00 +11:00
bors[bot]
2d3b0571bb
Merge #6465
6465: Support multiple file edits in AssistBuilder r=matklad a=Veykril

Fixes #6459

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-09 11:54:42 +00:00
cynecx
fbd3d73bbc vscode: fix tmGrammar issues around non-controlflow keywords 2020-11-07 20:12:56 +01:00
George Fraser
fe435ffb27 Use builtin scopes more 2020-11-07 10:50:57 -08:00
Dusty Pomerleau
6959cb045c allow variables to terminate ranges 2020-11-07 22:08:29 +11:00
Dusty Pomerleau
ffc5f4cf2b precedence fixes:
- prevent `pat` from matching before `path` in metavariable types
- reduce the precedence of math operators so that assignment operators match correctly
2020-11-07 14:56:06 +11:00
bors[bot]
ed9f8d53bc
Merge #6488
6488: Textmate grammar: add `+=` to assignment operators r=dustypomerleau a=dustypomerleau

Fixes https://github.com/dustypomerleau/rust-syntax/issues/3.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-11-06 22:52:13 +00:00
Dusty Pomerleau
397b76f28b add += to assignment operators 2020-11-07 09:49:08 +11:00
Charles Pierce
d2bf2ebe15 Restore semantic token flickering workaround removed in #5697 2020-11-04 10:26:58 -08:00
Lukas Wirth
be00b6b8fa Support multiple workspace edits 2020-11-04 15:04:28 +01:00
Dusty Pomerleau
4e66fc57bd fix: distinguish turbofish function calls from namespaces 2020-11-03 23:47:15 +11:00
Dusty Pomerleau
01a228f689 fix: allow functions without curly brackets 2020-11-03 18:37:43 +11:00
Dusty Pomerleau
79598f55b0 fix: allow comments in attributes 2020-11-02 15:33:11 +11:00
kjeremy
77ffe137f2 Smaller inlay hints
This makes things a lot more readable but isn't officially supported by vscode: https://github.com/Microsoft/vscode/issues/9078

Inspired by Visual Studio, IntelliJ and Resharper.
2020-10-28 09:52:23 -04:00
Laurențiu Nicola
91b4dd63b0 Also set textDecoration: none on inlay hints 2020-10-28 13:49:38 +02:00
Laurențiu Nicola
8a5a5b2477 Set font-wieght: normal on inlay hints 2020-10-27 09:18:25 +02:00
kjeremy
5444978f68 Update package 2020-10-26 09:23:34 -04:00
kjeremy
5cb6fafd36 Latest proposed LSP 3.16.0
Needs: https://github.com/gluon-lang/lsp-types/pull/183
2020-10-26 09:23:34 -04:00
Dusty Pomerleau
efdcfcfb61 fix: narrow the case where angle brackets are seen as comparison operators 2020-10-26 20:16:26 +11:00
Dusty Pomerleau
f352b98f7e fix: underscores, raw IDs
- remove comment scope from ignored params
- underscores will automatically receive variable/param scope
- add raw ID syntax to modules, functions, and variables
2020-10-24 13:00:26 +11:00
bors[bot]
2fa942ad30
Merge #6251 #6310
6251: Semantic Highlight: Add Callable modifier for variables r=matklad a=GrayJack

This PR added the `HighlightModifier::Callable` variant and assigned it to variables and parameters that are fn pointers, closures and implements FnOnce trait.

This allows to colorize these variables/parameters when used in call expression.



6310: Rewrite algo::diff to support insertion and deletion r=matklad a=Veykril

This in turn also makes `algo::diff` generate finer diffs(maybe even minimal diffs?) as insertions and deletions aren't always represented as as replacements of parent nodes now.

Required for #6287 to go on.

Co-authored-by: GrayJack <gr41.j4ck@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-23 22:12:15 +00:00
Dusty Pomerleau
26b4b1e2fb fix: prevent line comments inside block comments
- prevent line comments inside block comments
- prevent underscore-prefixed functions and macros from receiving comment scope
2020-10-22 13:33:06 +11:00
Dusty Pomerleau
93eeafc79f fix: require matching hash quantities for raw strings 2020-10-21 10:38:31 +11:00
bors[bot]
2c5bd9517e
Merge #6274
6274: Check cargoExtraArgs for undefined before using r=matklad a=feileacan

Fixes #6273 

Co-authored-by: feileacan <54381366+feileacan@users.noreply.github.com>
2020-10-19 15:35:32 +00:00
Dusty Pomerleau
06208e622f fix: prevent unwanted interpolation scopes 2020-10-18 13:27:03 +11:00
feileacan
d019cdbbb2
Check cargoExtraArgs for undefined before using 2020-10-18 11:40:48 +11:00
GrayJack
2e66fae1db
Editor: Code: Add callable to package.json 2020-10-16 09:06:52 -03:00
Dusty Pomerleau
c2335d0cb2 fix: prevent early termination of raw strings with hash 2020-10-16 11:08:59 +11:00
Laurențiu Nicola
010d123f23 Insert a ZWNJ before type hints 2020-10-15 10:56:28 +03:00
Laurențiu Nicola
513d25cf03 Fix resolveCodeAction request 2020-10-13 12:47:01 +03:00
bors[bot]
3f96c9b3cc
Merge #6137
6137: add a new TextMate grammar r=matklad a=dustypomerleau

Thanks to everyone working hard on Rust Analyzer - my impression is that it's quickly becoming the community default.

I think it would be helpful to have a more robust TextMate grammar to fall back on, for those who wish to disable semantic highlighting for any reason. It should allow theming of punctuation, and provide scopes for all tokens on the page. This can be done at zero cost to those who enable semantic highlighting, as the TextMate scopes will be invisible to those users.

I can see a couple ways of accomplishing this:

1. Ship a new grammar by merging this PR.
1. Ship no TextMate grammar at all (like the [Rust](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust) extension), and allow users to install a separate extension that provides the grammar of their choice (I have released this one as [Rust Syntax](https://marketplace.visualstudio.com/items?itemName=dustypomerleau.rust-syntax)). If no grammar were installed, they would simply fall back to the default grammar provided by their editor. In the case of VS Code, the default grammar already matches what is currently being shipped, so users who choose not to override it would see no difference.

I have tried to choose sensible default scopes, in the hopes that a wider variety of themes would work out of the box with Rust, even if those themes do not yet supply scopes for semantic highlighting. There is definitely some interest in using this grammar with Rust Analyzer, as this was the very first issue after the syntax extension was shipped: https://github.com/dustypomerleau/rust-syntax/issues/1.

I considered simply using an alternative grammar alongside Rust Analyzer, but this doesn't seem possible. When RA starts, any existing grammar/extension is overridden, and I haven't been able to find a workaround.


Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-10-12 15:45:21 +00:00
Dusty Pomerleau
49d824a99d add new TextMate grammar 2020-10-11 17:55:50 +11:00
Zac Pullar-Strecker
c648884397 Differentiate method/tymethod by determining 'defaultness'
Currently a method only has defaultness if it is a provided trait
method, but this will change when specialisation is available and may
need to become a concept known to hir.

I opted to go for a 'fewest changes' approach given specialisation is
still under development.
2020-10-08 15:04:21 +13:00
Zac Pullar-Strecker
974518fde7 Code reorganisation and field support 2020-10-08 15:04:20 +13:00
Zac Pullar-Strecker
a14194b428 Changes from review 2020-10-08 15:01:30 +13:00