Commit Graph

1439 Commits

Author SHA1 Message Date
Aleksey Kladov
b8a6ea5ab5 feat: make join lines behavior configurable
closes #9492
2021-07-05 23:47:20 +03:00
Jonas Schievink
5f13fb9db9 Add "View Crate Graph (Full)" 2021-07-02 00:10:33 +02:00
kjeremy
b88019c610 Update vscode-languageclient 2021-06-21 11:39:13 -04:00
bors[bot]
25bf451c84
Merge #9264
9264: feat: Make documentation on hover configurable r=Veykril a=Veykril

This also implements deprecation support for config options as this renames `hoverActions_linksInHover` to `hover_linksInHover`.

Fixes #9232

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-21 14:15:49 +00:00
Lukas Wirth
43098d99ae Remove deprecation support in config 2021-06-21 16:15:25 +02:00
Jade
8b77e2692c Implement a config override for the default #[cfg(test)] in cargo crates
Fixes crates which vanish when the 'test' cfg atom is set.

Fix #7243.
Fix #9203.
Fix #7225.
2021-06-19 01:09:19 -07:00
bors[bot]
d9666ce509
Merge #9334
9334: feat: Allow to disable import insertion on single path glob imports r=Veykril a=Veykril

On by default as I feel like this is something the majority would prefer.

Closes #8490

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-18 21:23:22 +00:00
Lukas Wirth
2ee090faaf Allow to disable import insertion on single path glob imports 2021-06-18 23:11:56 +02:00
kjeremy
e66dd9c85f Update css-what
npm audit flagged out version of css-what
2021-06-18 13:57:48 -04:00
bors[bot]
f6e73d510d
Merge #9258
9258: minor: Give `ImportPrefix` variants better config names r=matklad a=Veykril

I feel like `crate` and `self` work better than `by_crate` and `by_self`. The only reason for the current names were that `Self` doesn't work for the variant name on the rust side so I forgot about setting proper config names on serde layer.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-16 14:53:06 +00:00
bors[bot]
2980fd430d
Merge #9267 #9279
9267: fix: Code: update the LSP server without asking r=matklad a=lnicola

Most LSP extensions seem to do the same thing, and this is causing some
confusion for users who don't notice the update prompt before Code hides
it.

9279: minor: Document installation via Homebrew r=matklad a=Svetlitski

`rust-analyzer` can be installed via [Homebrew](https://brew.sh) (AKA`brew`) on macOS. I've added instructions on how to do so to the documentation. Additionally, I added a `.gitignore` rule to ignore the HTML documentation produced by  `asciidoctor manual.adoc` so that it is not accidentally checked into `git`.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Kevin Svetlitski <kevin_svetlitski@berkeley.edu>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-15 20:45:54 +00:00
bors[bot]
d0f2bc3b87
Merge #9292
9292: fix: Code: clean-up #8951 r=wxb1ank a=wxb1ank

#8951 was a major change in the VS Code extension and caused quite a few problems. This PR is a catch-all for bugs and improvements in the new code.

This should fix:
- #9284
- [this unreported bug](https://github.com/rust-analyzer/rust-analyzer/pull/8951/files#r651570446)
- ...and one or two uncaught exceptions I just found

The original lack of testing was my own fault, but this area of the VS Code API is also tricky for a couple reasons:
- The [FileSystem](https://github.com/rust-analyzer/rust-analyzer/pull/8951/files#r651570446) API does not list or warn about any exceptions, but [FileSystemProvider](https://github.com/rust-analyzer/rust-analyzer/pull/8951/files#r651570446) (which `FileSystem` is a wrapper of, AFAICT) does.
- At first glance, [Uri.path](https://github.com/rust-analyzer/rust-analyzer/pull/8951/files#r651570446) *looks* like it works for FS operations. It does not, at least, on Windows. You need to use `Uri.fsPath`.

I only use Windows, so I need people on macOS, Linux, and (possibly) NixOS to test this.

Co-authored-by: wxb1ank <wxblank@gmail.com>
2021-06-15 20:05:07 +00:00
wxb1ank
a6b0c056de Use .then() for Thenable 2021-06-15 14:03:34 -04:00
wxb1ank
56e128a979 fix: clean-up #8951 2021-06-15 13:29:02 -04:00
bors[bot]
7d363755a2
Merge #9282
9282: fix: Use objects instead of bools for markers in package.json r=lnicola a=lnicola

Addresses https://github.com/rust-analyzer/rust-analyzer/issues/9174#issue-913980665.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-06-15 06:47:33 +00:00
Laurențiu Nicola
41949748a6 Use objects instead of bools for markers in package.json 2021-06-15 09:40:43 +03:00
wxb1ank
7a8a72c38f Use Uri.toString() for URLs 2021-06-14 23:29:38 -04:00
Laurențiu Nicola
6cbb18e570 Code: automatically update the LSP server
Most LSP extensions seem to do the same thing, and this is causing some
confusion for users who don't notice the update prompt before Code hides
it.
2021-06-14 17:44:29 +03:00
Lukas Wirth
178b5ffba3 Add configuration deprecation 2021-06-14 15:49:57 +02:00
Lukas Wirth
a93d166f0f Make documentation on hover configurable 2021-06-14 15:25:10 +02:00
bors[bot]
388a91c8a8
Merge #8951
8951: internal: migrate to vscode.FileSystem API r=matklad a=wxb1ank

I encountered an error where `bootstrap()` attempts to create a directory with the path `C:\C:\...`. I couldn't find this reported anywhere else. Using the `vscode.FileSystem` API instead of the `fs` one works here. I assume the latter automatically prepends `C:\` to paths whereas the former does not. I don't know if this suggests `vscode.FileSystem` should be used in more places for consistency.

Co-authored-by: wxb1ank <wxblank@gmail.com>
2021-06-14 10:30:10 +00:00
Lukas Wirth
b58c1c9eb2 Give ImportPrefix variants better config names 2021-06-13 22:00:39 +02:00
Aleksey Kladov
16e142cd39 Revert "Merge #9177"
This reverts commit f1818cb7ba, reversing
changes made to 6c9362d61b.

This broke things
2021-06-08 15:31:36 +03:00
bors[bot]
f1818cb7ba
Merge #9177
9177: ⬆️ npm packages r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-08 11:00:19 +00:00
Aleksey Kladov
6d2cfb1bdc ⬆️ npm packages 2021-06-08 13:55:20 +03:00
Milo
b8eeef4dfa fix 2021-06-07 17:56:40 +01:00
Milo
42e5e5b458 fix 2021-06-06 00:21:50 +01:00
Milo
ab57c25d1e when you click status bar icon it now restarts server 2021-06-06 00:17:16 +01:00
Lukas Wirth
07394316ff Add function references hover action 2021-06-04 15:54:55 +02:00
Jonas Schievink
9fdb8f9037 Make it opt-in 2021-06-03 18:09:21 +02:00
Lukas Wirth
d304352407 Document that addCallArgumentSnippets requires `addCallParenthesis 2021-06-02 22:10:09 +02:00
wxb1ank
388a1945ac Lint toolchain.ts 2021-06-02 13:58:14 -04:00
wxb1ank
0448b73646 migrate from fs to vscode.FileSystem API 2021-06-02 12:11:32 -04:00
wxb1ank
3ca7f61a8d internal: use vscode.FileSystem API in main.ts 2021-06-02 12:07:13 -04:00
Kirill Bulatov
60e7817e9c Fix opening single files 2021-05-31 21:37:08 +03:00
Aleksey Kladov
ee995dbfd4 fix: fix shell injection in task spawning
closes #9058
2021-05-31 20:11:36 +03:00
Lukas Wirth
fb7105a580 Add config setting for self-on-the-fly 2021-05-31 15:14:56 +02:00
Lucas Schwiderski
9a057c0ff4
Fix incorrect setting descriptions
Descriptions for diagnostic warning hint and info display were swapped.

Fixes #8485.

Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-05-29 18:08:14 +02:00
bors[bot]
b4015b6aaa
Merge #8995
8995: fix: Create tasks for all workspaces r=matklad a=SomeoneToIgnore

Follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/8955#discussion_r637897170

Before: 
<img width="593" alt="image" src="https://user-images.githubusercontent.com/2690773/119575267-712b5300-bdbf-11eb-833c-f688f7a7dd0f.png">

After: 
<img width="643" alt="image" src="https://user-images.githubusercontent.com/2690773/119575273-74264380-bdbf-11eb-8283-a78bbcb7346e.png">

This is the first time I've used multiple workspaces feature in VSCode, but so far looks like
* opening detached files works
* run and debug lens work
* Rust Analyzer: Run action works
* run task works and now shows tasks for all workspaces
* there are no platform-specific changes involved

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-05-26 20:58:07 +00:00
bors[bot]
8c80a21772
Merge #9001
9001: minor: explicitly set the focus to false r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-26 10:04:37 +00:00
Aleksey Kladov
249e22b325 minor: explicitly set the focus to false 2021-05-26 13:04:01 +03:00
Kirill Bulatov
a05163db14 Create tasks for all workspaces 2021-05-26 01:11:52 +03:00
bors[bot]
835cf55887
Merge #8767
8767: implement range formatting r=matklad a=euclio

Fixes #7580.

This PR implements the `textDocument/rangeFormatting` request using `rustfmt`'s `--file-lines` option.

Still needs some tests. What I want to know is how I should handle the instability of the `--file-lines` option. It's still unstable in rustfmt, so it's only available on nightly, and needs a special flag to enable. Is there a way for `rust-analyzer` to detect if it's using nightly rustfmt, or for users to opt-in?

Co-authored-by: Andy Russell <arussell123@gmail.com>
2021-05-25 12:15:48 +00:00
Eduardo Canellas
3dce8a3924 fix: cursor position after item move command
closes Item movers need some fixes #8492
2021-05-24 13:17:28 -03:00
bors[bot]
05fc97e31b
Merge #8955
8955: feature: Support standalone Rust files r=matklad a=SomeoneToIgnore

![standalone](https://user-images.githubusercontent.com/2690773/119277037-0b579380-bc26-11eb-8d77-20d46ab4916a.gif)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/6388

Caveats: 

* I've decided to support multiple detached files in the code (anticipating the scratch files), but I found no way to open multiple files in VSCode at once: running `code *.rs` makes the plugin to register in the `vscode.workspace.textDocuments` only the first file, while code actually displays all files later.
Apparently what happens is the same as when you have VSCode open at some workplace already and then run `code some_other_file.rs`: it gets opened in the same workspace of the same VSCode with no server to support it.
If there's a way to override it, I'd appreciate the pointer.

* No way to toggle inlay hints, since the setting is updated for the workspace (which does not exist for a single file opened)
> [2021-05-24 00:22:49.100] [exthost] [error] Error: Unable to write to Workspace Settings because no workspace is opened. Please open a workspace first and try again.

* No runners/lens to run or check the code are implemented for this mode. 
In theory, we can detect `rustc`, run it on a file and run the resulting binary, but not sure if worth doing it at this stage.

Otherwise imports, hints, completion and other features work.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-05-24 12:40:25 +00:00
Aleksey Kladov
df146341c5 fix: can download server binary on windows again
Closes #8956

See https://github.com/rust-analyzer/rust-analyzer/pull/8951#issuecomment-846716999
2021-05-24 11:52:25 +03:00
Kirill Bulatov
c1f6a5a0b0 Fix ts lint errors 2021-05-23 23:47:58 +03:00
Aleksey Kladov
a6633a88a8 fix: reveal snippets 2021-05-23 23:40:19 +03:00
Andy Russell
a90b9a5872
implement range formatting 2021-05-23 15:50:36 -04:00
Kirill Bulatov
b3383b0661 Send detached files info to server via init params 2021-05-23 22:46:20 +03:00
Kirill Bulatov
d9a5490646 Start rust-analyzer server for arbitrary rust files 2021-05-23 22:46:20 +03:00
Kirill Bulatov
daedcc2b77 More style fixes 2021-05-23 13:57:04 +03:00
Kirill Bulatov
223dbd2187 Style fix 2021-05-23 13:43:06 +03:00
Kirill Bulatov
95c51d8f1d Don't use a deprecated accessor 2021-05-23 11:54:03 +03:00
Kirill Bulatov
230ed3304a Better releaseId naming 2021-05-23 11:51:35 +03:00
Kirill Bulatov
be3e997ddf Remove nightly release id from local storage for stable extensions 2021-05-23 11:49:34 +03:00
Kirill Bulatov
b8635a8e60 Download nightly extension when configured and run from stable extension version 2021-05-23 11:28:06 +03:00
Jonas Schievink
463ecefc64 Use .rs file ending to get syntax highlighting 2021-05-22 00:11:54 +02:00
Jonas Schievink
271ec6b990 Add a "Debug ItemTree" LSP request 2021-05-21 23:59:52 +02:00
bors[bot]
8bb37737c9
Merge #8873
8873: Implement import-granularity guessing  r=matklad a=Veykril

This renames our `MergeBehavior` to `ImportGranularity` as rustfmt has it as the purpose of them are basically the same. `ImportGranularity::Preserve` currently has no specific purpose for us as we don't have an organize imports assist yet, so it currently acts the same as `ImportGranularity::Item`.

We now try to guess the import style on a per file basis and fall back to the user granularity setting if the file has no specific style yet or where it is ambiguous. This can be turned off by setting `import.enforceGranularity` to `true`.

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8870

Co-authored-by: Lukas Tobias Wirth <lukastw97@gmail.com>
2021-05-20 08:27:16 +00:00
Lukas Tobias Wirth
b4fe479236 Replace ImportGranularity::Guess with guessing boolean flag 2021-05-19 15:57:10 +02:00
Lukas Tobias Wirth
5fd9f6c7b9 Add ImportGranularity::Guess 2021-05-18 20:21:47 +02:00
Lukas Tobias Wirth
64f7072c25 MergeBehavior -> ImportGranularity 2021-05-18 19:53:20 +02:00
alcroito
1f7d2a6c22 Add new LSP extension for workspace symbol lookup
The new extension allows filtering of workspace symbool lookup
results by search scope or search kind.

Filtering can be configured in 3 different ways:

 - The '#' or '*' markers can be added inline with the symbol lookup
   query.

   The '#' marker means symbols should be looked up in the current
   workspace and any dependencies. If not specified, only current
   workspace is considered.

   The '*' marker means all kinds of symbols should be looked up
   (types, functions, etc). If not specified, only type symbols are
   returned.

 - Each LSP request can take an optional search_scope or search_kind
   argument query parameter.

 - Finally there are 2 global config options that can be set for all
   requests served by the active RA instance.

Add support for setting the global config options to the VSCode
extension.
The extension does not use the per-request way, but it's useful for
other IDEs.

The latest version of VSCode filters out the inline markers, so
currently the only reasonable way to use the new functionality is
via the global config.
2021-05-18 00:40:30 +02:00
Aleksey Kladov
41510f437e minor: adjust config name 2021-05-17 18:37:06 +03:00
bors[bot]
f9d4a9eaee
Merge #8795
8795: Allow semantic tokens for strings to be disabled r=matklad a=djrenren

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7111

Pretty straightforward change, but open to any suggestions if there's a more recommended testing strategy than what I went with.

Co-authored-by: John Renner <john@jrenner.net>
2021-05-17 14:41:56 +00:00
Jonas Schievink
a85a2c4d15 Allow viewing the crate graph in a webview 2021-05-11 16:15:31 +02:00
John Renner
7ae3967e57 Formatting and docs 2021-05-10 13:34:09 -07:00
Lukas Wirth
6a8d47e7f0 Give MergeBehaviour variants better names 2021-05-10 21:14:59 +02:00
Aleksey Kladov
cf72715439 ⬆️ package-lock.json 2021-05-08 12:20:06 +03:00
Aleksey Kladov
5c1a901035 internal: ensure that client and server-side configs are not mixed up
https://github.com/rust-lang/rust/issues/84647 would help big time here.
2021-04-28 13:13:30 +03:00
bors[bot]
fb45d2adec
Merge #8624
8624: Automatically detect rust library source file map  r=vsrs a=vsrs

This PR adds a new possible `rust-analyzer.debug.sourceFileMap` value:
```json
{
    "rust-analyzer.debug.sourceFileMap": "auto"
}
```

I did not make it the default because it uses two shell calls (`rustc --print sysroot` and `rustc -V -v`). First one can be slow (https://github.com/rust-lang/rustup/issues/783)

Fixes #8619

Co-authored-by: vsrs <vit@conrlab.com>
2021-04-27 20:41:35 +00:00
bors[bot]
e2b87735cc
Merge #8629 #8657
8629: Allow pressing | to surround closure arguments in VSCode r=matklad a=Smittyvb

This makes pressing <kbd>|</kbd> while some text is selected surround that text with pipes. This is useful when writing closures. 

In this demo, I press <kbd>|</kbd> to easily surround some text (`predicate`) with pipe characters to create a closure. Before, this would have replaced `predicate` with just `|`.

![](https://user-images.githubusercontent.com/10530973/115778847-3c257e00-a385-11eb-8c80-e0db970747db.gif)

(I am getting failures when I do `cargo test` even on `master` locally (due to #8585 I think), but GH Actions is fine with this)

8657: npm update r=matklad a=kjeremy



Co-authored-by: Smittyvb <me@smitop.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2021-04-27 13:22:09 +00:00
Jorge Mederos Alvarado
0230f22d2a Fix how and when old inlay hint decorations are disposed 2021-04-26 20:29:54 -04:00
Jorge Mederos Alvarado
9e5ef0ce72 Add option to opt out from smaller inlay hints font size 2021-04-26 20:29:54 -04:00
Jorge Mederos Alvarado
a2ba0f4846 add option to package.json 2021-04-26 20:29:54 -04:00
Jeremy Kolb
1c927650f7 npm update 2021-04-25 16:16:01 -04:00
Smittyvb
c38e3e9ee9
Support | as a surrounding pairs 2021-04-22 15:57:30 -04:00
vsrs
1b4197cb35 Use explicit rustc commit-hash
Required for lldb on mac
2021-04-22 18:59:03 +03:00
vsrs
1ebfe11730 Add special auto value for debug.sourceFileMap 2021-04-22 16:09:46 +03:00
vsrs
8f781e782c Autodetect rust library source file map 2021-04-22 15:27:56 +03:00
James Leitch
72718bc2d7 Code review feedback. 2021-04-21 15:10:53 -07:00
James Leitch
9fcad82980 Diagnostic Remap Path Prefixes added. 2021-04-21 15:10:53 -07:00
Jonas Schievink
30aae2cefb Move cursor position when using item movers 2021-04-14 00:03:04 +02:00
Aleksey Kladov
186c5c47cb feat: avoid checking the whole project during initial loading 2021-04-12 15:29:31 +03:00
Aleksey Kladov
ad02bfe58f Sacrifice for the semicolon god 2021-04-06 15:50:02 +03:00
Aleksey Kladov
8fe20b19d4 More robust status notifications 2021-04-06 15:45:31 +03:00
Jonas Schievink
e6580aa380 Use const instead of let 2021-03-27 19:02:08 +01:00
Jonas Schievink
201fbac8a9 Fix handling of multi-cursor snippets
This allows one snippet per TextEdit, multiple in the same TextEdit
are still broken
2021-03-27 18:50:55 +01:00
Kirill Bulatov
5e83a56dfb Bump the default hint length 2021-03-23 19:43:55 +02:00
Kirill Bulatov
f1e1a2c0a7 Limit the hints size by default 2021-03-23 19:04:48 +02:00
ivan770
236abe2e60
Improve cursor positioning after moving 2021-03-18 11:22:28 +02:00
ivan770
5f5a3e6eae
Fix tsfmt and eslint warnings 2021-03-18 11:22:27 +02:00
ivan770
a154ef7ca1
Remove movable array, improve client code 2021-03-18 11:22:27 +02:00
ivan770
7d60458495
Item up and down movers 2021-03-18 11:22:27 +02:00
bors[bot]
d38fd77845
Merge #8028
8028: Return multiple modules in `parent_module` feature r=matklad a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-15 17:50:20 +00:00
Aleksey Kladov
469b739c28 Enable proc-macros by default 2021-03-15 18:19:08 +03:00
Lukas Wirth
f05fef7063 Support multiple parents in parentModule in vscode-client 2021-03-15 15:50:55 +01:00
bors[bot]
7accf6bc37
Merge #7799
7799: Related tests r=matklad a=vsrs

![tests](https://user-images.githubusercontent.com/62505555/109397453-a9013680-7947-11eb-8b11-ac03079f7645.gif)
This adds an ability to look for tests for the item under the cursor: function, constant, data type, etc

The LSP part is bound to change. But the feature itself already works and I'm looking for a feedback :)



Co-authored-by: vsrs <vit@conrlab.com>
2021-03-13 13:50:35 +00:00
Laurențiu Nicola
88ef0541a5 Improve version display 2021-03-12 19:49:00 +02:00
vsrs
daa2637486 Apply review suggestions 2021-03-11 17:39:41 +03:00
Aleksey Kladov
37b7b56821 Make code less surprising
Theres no reason to have literal `\n\n` in the source code
2021-03-09 14:47:42 +03:00
Joshua Nelson
c7b0914b3f Add more documentation for rustc_private 2021-03-08 16:56:42 -05:00
bors[bot]
d57c9f7980
Merge #7891
7891: Improve handling of rustc_private r=matklad a=DJMcNab

This PR changes how `rust-analyzer` handles `rustc_private`. In particular, packages now must opt-in to using `rustc_private` in `Cargo.toml`, by adding:
```toml
[package.metadata.rust-analyzer]
rustc_private=true
```

This means that depending on crates which also use `rustc_private` will be significantly improved, since their dependencies on the `rustc_private` crates will be resolved properly.

A similar approach could be used in #6714 to allow annotating that your package uses the `test` crate, although I have not yet handled that in this PR.

Additionally, we now only index the crates which are transitive dependencies of `rustc_driver` in the `rustcSource` directory. This should not cause any change in behaviour when using `rustcSource: "discover"`, as the source used then will only be a partial clone. However, if `rustcSource` pointing at a local checkout of rustc, this should significantly improve the memory usage and lower indexing time. This is because we avoids indexing all crates in `src/tools/`, which includes `rust-analyzer` itself.

Furthermore, we also prefer named dependencies over dependencies from `rustcSource`. This ensures that feature resolution for crates which are depended on by both `rustc` and your crate uses the correct set for analysing your crate.

See also [introductory zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Fixed.20crate.20graphs.20and.20optional.20builtin.20crates/near/229086673)

I have tested this in [priroda](https://github.com/oli-obk/priroda/), and it provides a significant improvement to the development experience (once I give `miri` the required data in `Cargo.toml`)

Todo:
- [ ] Documentation

This is ready to review, and I will add documentation if this would be accepted (or if I get time to do so anyway)

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2021-03-08 16:51:20 +00:00
Daniel McNab
20007fd3a8 Document rustc_private in metadata 2021-03-08 16:47:40 +00:00
Daniel McNab
bbecea03fd Revert "Support disabling rustc build scripts"
This reverts commit ddce6bb282.
2021-03-08 16:37:52 +00:00
Aleksey Kladov
c7b5d6be4c Make code completion "just work" in more cases 2021-03-08 14:57:56 +03:00
bors[bot]
13982e4ee4
Merge #7901
7901: Make extension respect http proxy settings r=matklad a=kamyuentse

This patch makes vscode extension respect proxy settings when fetching release metadata and rust-analyzer binary.

Co-authored-by: Kam Y. Tse <kevin.xjy@gmail.com>
2021-03-08 09:41:21 +00:00
Daniel McNab
ddce6bb282 Support disabling rustc build scripts 2021-03-08 09:05:19 +00:00
Kam Y. Tse
77b7c96aea
Make extension respect http proxy settings 2021-03-07 18:21:48 +08:00
asv
96fc01a30b Make group imports configurable 2021-03-07 10:15:17 +02:00
Aleksey Kladov
3d80e0a154 Migrate to user-centric config name for cargo check stuff 2021-03-04 15:38:53 +03:00
cgiguere
3df8df23c6 clean uo rustup link 2021-03-01 15:19:30 -05:00
cgiguere
0b1981baf5 add sponsor links 2021-03-01 15:07:36 -05:00
Charles Giguere
a0de1723bd
Add more information to VSCode extenstion README
A lot of these are duplicated from the documentation or main README. While it's unfortunate to have duplicated information, the current VSCode page is very barebones and doesn't offer much confidence. 

This updated README offers a few more links and follows a structure similar to the official rust extension and other popular vscode extensions. The additions are, as much as possible specific to the vscode extension and not rust-analyzer as a LSP.

The note about not using the official extension is also right there at the top because that's a common issue people have when trying it out. 

I added the sponsor section since it's common in other extensions README, but I'm not sure if it's necessary
2021-03-01 14:47:54 -05:00
Lukas Wirth
91ff47ef6a Update vscode README with a small features list 2021-03-01 11:08:26 +01:00
vsrs
f234b80520 Remove erroneous comment 2021-02-27 21:59:53 +03:00
vsrs
45d4e6b639 Add progress reporting 2021-02-27 21:07:23 +03:00
vsrs
669e117644 Add LSP request and VSCode command 2021-02-27 20:04:43 +03:00
kjeremy
c3ab200114 Update our vscode npm packages 2021-02-23 11:39:19 -05:00
Laurențiu Nicola
23a8fc5284 Try to detect musl distros in the Code extension 2021-02-20 18:44:28 +02:00
kjeremy
a403be6456 Remove Semantic Tokens flicker workaround
https://github.com/microsoft/vscode-languageserver-node/issues/576 has been closed with
the latest vscode-languageclient release.
2021-02-16 16:27:30 -05:00
kjeremy
13008c4d30 vscode-languageclient 7.1.0-next.2 2021-02-16 16:23:37 -05:00
kjeremy
338c08f13e Use npm 7.x package-lock.json 2021-02-16 15:48:27 -05:00
Jeremy Kolb
8105418b25 Start LSP 3.17 support 2021-02-14 14:51:29 -05:00
bors[bot]
d50a37d3aa
Merge #7643 #7663
7643: Automatically detect the rustc-src directory (fixes #3517) r=matklad a=bnjbvr

If the configured rustcSource was not set, then try to automatically
detect a source for the sysroot rustc directory.

I wasn't sure how to do it in the case of the project.json file, though.

7663: Tolerate spaces in nix binary patching r=matklad a=CertainLach

If path to original file contains space (I.e on code insiders, where
default data directory is ~/Code - Insiders/), then there is syntax
error evaluating src arg.

Instead pass path as str, and coerce to path back in nix expression

Co-authored-by: Benjamin Bouvier <public@benj.me>
Co-authored-by: Yaroslav Bolyukin <iam@lach.pw>
2021-02-14 15:42:07 +00:00
Yaroslav Bolyukin
471795b019
fix: tolerate spaces in nix binary patching
If path to original file contains space (I.e on code insiders, where
default data directory is ~/Code - Insiders/), then there is syntax
error evaluating src arg.

Instead pass path as str, and coerce to path back in nix expression

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
2021-02-13 23:11:00 +03:00
Benjamin Bouvier
4a6e602c94 Allow automatically detect the rustc-src directory (fixes #3517).
If the configured rustcSource is set to "discover", try to automatically
detect a source from the sysroot rustc directory.
2021-02-13 18:20:46 +01:00
bors[bot]
82a1b91f20
Merge #7625
7625: Add **Copy Run Command Line** command for vscode r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-10 11:38:56 +00:00
Aleksey Kladov
97166e2ad9 Add **Copy Run Command Line** command for vscode
This is useful when you want to, e.g., run a specific test in a terminal
with `--release`.
2021-02-10 14:37:27 +03:00
bors[bot]
ff5ef2830c
Merge #7591 #7622
7591: Fix/no floating promises r=matklad a=sahandevs

closes #3515

- added `@typescript-eslint/no-floating-promises: error` rule
- changed `"no-console": ["error"]` to `"no-console": ["error", { allow: ["warn", "error"] }]` (we at least log the error messages of the floating promises)
- fixed lint/compile errors

7622: Resolve TupleStructPat in SourceAnalyzer::resolve_path r=Veykril a=Veykril

Closes #7594
bors r+

Co-authored-by: Sahandevs <sahandevs@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-10 08:44:53 +00:00
Aleksey Kladov
0f324bac6b Fix highlighting of injected attributes 2021-02-09 17:41:12 +03:00
Sahandevs
91dd61b9a6 use await instead 2021-02-09 17:42:46 +03:30
Sahandevs
2f82a84d2a fix errors 2021-02-07 22:06:16 +03:30
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
Zac Pullar-Strecker
bfda0d2583 WIP: Command to open docs under cursor 2020-10-08 14:59:31 +13:00
Casey Primozic
56a8a7645f
Bump chalk to use latest git to get fix
* Chalk very recently (like an hour ago) merged a fix that prevents rust analyzer from panicking.  This allows it to be usable again for code that hits those situations.  See #6134, #6145, Probably #6120
2020-10-06 15:05:20 -07:00
Lukas Wirth
8699331014 Make ImportPrefix a configuration option 2020-10-05 17:41:49 +02:00
Igor Aleksanov
5b26629a4d Support 'runnables' options in the vs code extension 2020-10-02 12:35:22 +03:00
Aleksey Kladov
af8063fe37 Extend **Status** command to also show dep info for the file
This should help with troubleshooting wrong project configuration
2020-09-29 22:13:23 +02:00
vsrs
b7fda5f936 Make method references CodeLens off by default. 2020-09-29 15:29:20 +03:00
vsrs
eeb40dbece Add method references CodeLens 2020-09-29 15:29:20 +03:00
Matthias Einwag
8eae893c76 Fix lint 2020-09-23 08:39:04 -07:00
Matthias Einwag
c7f4647749 Move unlink on download into download function
Since this is required by all callsites its easier to have it in the
function itself.
2020-09-23 08:37:02 -07:00
Matthias Einwag
df4d59512e Remane function 2020-09-23 08:27:25 -07:00
Matthias Einwag
d38f759c63 Use closure in trailing position and strongly type header map 2020-09-23 08:24:35 -07:00
Matthias Einwag
87933e15ce
Apply suggestions from code review
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-09-23 08:14:18 -07:00
Matthias Einwag
45de3e738c Remove stray newline 2020-09-23 01:06:10 -07:00
Matthias Einwag
145bd6f701 Fix clearing the token
The previous version would have interpreted an empty token as
an abort of the dialog and would have not properly cleared the token.
This is now fixed by checking for `undefined` for a an abort and
by setting the token to `undefined` in order to clear it.
2020-09-23 01:03:34 -07:00
Matthias Einwag
501b516db4 Add a command for updating the Github API token 2020-09-23 00:50:34 -07:00
Matthias Einwag
a0a7cd306e Use retry dialog also for downloads
Since the change already implements a retry dialog for
network operations, let's also use it for allowing to retry the
actual file.
2020-09-23 00:28:38 -07:00