Commit graph

1503 commits

Author SHA1 Message Date
bors[bot]
3b02aec0cc
Merge #10903
10903: internal: Replace `mocha` with a custom test runner r=Aloso a=lnicola

Closes #10723

r? `@Aloso`

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-02 17:37:56 +00:00
Laurențiu Nicola
157056db22 Fix proxyStrictSSL check 2021-12-02 15:46:23 +02:00
Laurențiu Nicola
76b3d437d3 Replace mocha with a custom test runner 2021-12-02 13:05:50 +02:00
Laurențiu Nicola
a59c1a0af0 Try to fix Code tests 2021-12-01 12:22:34 +02:00
Laurențiu Nicola
7d815b862f Refactor proxy settings 2021-11-28 10:54:35 +02:00
Laurențiu Nicola
2f5149886d Respect http.proxyStrictSSL 2021-11-27 07:29:44 +02:00
Laurențiu Nicola
a68ce62f6a Add toggle to disable cache priming 2021-11-19 19:30:11 +02:00
Paul Horn
553bb7f50a
Allow clients to configure the global workspace search limit 2021-11-18 17:52:02 +01:00
Jake Heinz
520ff62f4e flip the default 2021-11-13 23:39:34 +00:00
Jake Heinz
d3d768de0d inlay hints: add the option to always show constructor inlay hints 2021-11-13 23:12:29 +00:00
bors[bot]
f48b2622d8
Merge #10688
10688: internal: Type-check TS on CI and also turn off the strict setting `useUnknownInCatchVariables` r=lnicola a=ChayimFriedman2

We don't follow it and I found that turning it on will have little benefit.

I'm not sure if we should also type-check when building in launch.json.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2021-11-08 13:37:34 +00:00
Laurențiu Nicola
1fe48a7184 Avoid deprecated methods in client-side tests 2021-11-07 10:00:58 +02:00
Chayim Refael Friedman
36bdb5c94d Type-check TS on CI and also turn off the strict setting useUnknownInCatchVariables
We don't follow it and I found that turning it on will have little benefit.
2021-11-04 01:23:45 +02:00
bors[bot]
057558b756
Merge #10595
10595: internal: Fix a format error r=Veykril a=dzvon

Fixes #10581

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-10-29 10:40:43 +00:00
Dezhi Wu
74396d27c0 Fix: correct markdown link form. 2021-10-29 18:25:32 +08:00
Dezhi Wu
ffc6cdd871 Fix: transform the asciidoc form link to markdown style when generating the package.json 2021-10-28 10:13:43 +08:00
Lukas Wirth
4c582ffe9f Don't ask the user to reload when chaning HoverAction configs in VSCode 2021-10-25 14:48:36 +02:00
Dezhi Wu
1a24ee9a1b Fix a format error 2021-10-20 20:13:03 +08:00
bors[bot]
f87debcf87
Merge #10434
10434: Allow `Locate parent module` command in Cargo.toml r=Veykril a=rainy-me

close #10355

Co-authored-by: rainy-me <github@rainy.me>
Co-authored-by: rainy-me <github@yue.coffee>
2021-10-14 10:56:08 +00:00
Laurențiu Nicola
e43e1240a7 Document rustc source auto-discovery 2021-10-14 08:57:07 +03:00
rainy-me
59c755227d Provide navigations to parent modules 2021-10-14 07:16:42 +09:00
bors[bot]
5ff992465e
Merge #10447
10447: Add enum variant references CodeLens. r=Veykril a=ericsampson



Co-authored-by: Eric Sampson <esampson@eaze.com>
2021-10-05 22:03:23 +00:00
Lukas Wirth
041cfbe0f4 Render the expansion of snippets as their docs 2021-10-05 18:11:22 +02:00
Lukas Wirth
ca1fdd75f1 Regen docs 2021-10-04 22:13:12 +02:00
Eric Sampson
99dd8066d9 need to update some generated files. 2021-10-04 02:30:46 -05:00
Eric Sampson
a0bb31587e Add enum variant references CodeLens. 2021-10-04 02:18:31 -05:00
Laurențiu Nicola
f5c9204ff2 Limit depth to 1 when searching for Cargo.toml 2021-10-03 17:58:03 +03:00
rainy-me
39044fe39c Allow locate parent module action in cargo toml 2021-10-03 11:58:10 +09:00
bors[bot]
c88277f676
Merge #10421
10421: minor: Bump npm non-dev deps r=lnicola a=lnicola

Fixes #10407

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-02 16:43:24 +00:00
Laurențiu Nicola
502fa1755a Remove temporary file on exception 2021-10-02 10:07:50 +03:00
Laurențiu Nicola
2c7b50217e Overwrite file when running patchelf 2021-10-02 10:05:39 +03:00
Laurențiu Nicola
aa88d7e0d6 Bump npm non-dev deps 2021-10-02 07:38:44 +03:00
hamidreza kalbasi
0dbaf64b12 add vscode native onEnterRules 2021-09-28 20:23:25 +03:30
Laurențiu Nicola
81891f7abe Enable attribute proc macros by default 2021-09-27 18:11:31 +03:00
Lukas Wirth
b24c8d5c89 Update semanticTokenModifiers in package.json 2021-09-25 14:10:46 +02:00
Carlos Menezes
8ad484b341 Add missing files 2021-09-24 14:53:11 +01:00
Laurențiu Nicola
db5e01189a Change the global setting when toggling inlay hints 2021-09-23 20:45:45 +03:00
Laurențiu Nicola
8522b4aece Add workaround for rename error reporting 2021-09-13 14:52:03 +03:00
IceSentry
d9e4b231c7 configure colorizedBracketPairs 2021-09-09 00:25:38 -04:00
Oliver Cooper
d246a5f58b
Undefined scope comment 2021-09-09 08:50:24 +12:00
Oliver Cooper
001608914b Removed deprecated Task constructor 2021-09-08 10:46:31 +12:00
Oliver Cooper
0517247bbc Don't filter cargo tasks by scope
Fixes #9093
2021-08-31 20:35:22 +12:00
Fumiaki MATSUSHIMA
7bbca5d6f3 Set esbuild target as node14 2021-08-28 14:43:44 +00:00
=
e3dd43ceba remove workaround from old node versions 2021-08-27 11:31:25 +02:00
unexge
3a9ba0e506 feat: join lines merges assignments 2021-08-22 21:28:39 +03:00
bors[bot]
19348bc478
Merge #9908
9908: fix check of the toolchain's path r=lnicola a=gfreezy

fixed #9907

Co-authored-by: Alex.F <gfreezy@gmail.com>
2021-08-21 13:41:09 +00:00
Alex.F
8e4039c7d7 inline await statement 2021-08-17 15:24:13 +08:00
Alex.F
635b89fdaa clean imports 2021-08-16 10:35:27 +08:00
Alex.F
6b3a6ddb39 fix lint 2021-08-16 00:21:12 +08:00
Alex.F
d13f6ba750 use async version 2021-08-16 00:19:45 +08:00
Laurențiu Nicola
743b016313 Don't call deprecated compile regex method 2021-08-13 14:16:33 +03:00
André Oliveira
25e1ca38ab Update 'package-lock.json' 2021-08-10 13:46:44 +00:00
André Oliveira
7666eb1fb8 Embed the scripts in the html template 2021-08-10 13:43:58 +00:00
André Oliveira
51a6d2204e Remove unecessary joinPaths 2021-08-10 13:43:58 +00:00
André Oliveira
f4a60e2af3 Include the needed node_modules files in the final extension bundle 2021-08-10 13:43:58 +00:00
André Oliveira
11bbaecca0 Formatting issues 2021-08-10 13:43:57 +00:00
André Oliveira
5e571a375b replace let by const 2021-08-10 13:43:57 +00:00
André Oliveira
b29508949d Remove debug logs 2021-08-10 13:43:57 +00:00
André Oliveira
6d59219d26 Reduce path handling code 2021-08-10 13:43:57 +00:00
André Oliveira
1039acb10a Add more features to the rendering
- Allow the zoom to go further than 10x
- Adapt css to dark and high constrast themess
- Use 'javascript/worker' for the wasm graphviz
- Add Ctrl + LeftMouseClick to reset zoom
2021-08-10 13:43:55 +00:00
André Oliveira
8a563e4a46 Use local node_modules to allow the graph to load offline
- Fix some warnings
2021-08-10 13:43:08 +00:00
André Oliveira
f4f68e62c2 Use d3-graphviz for rendering crates graph on the extension side 2021-08-10 13:40:49 +00:00
Mukund Lakshman
463860439f vscode extension: use esbuild instead of rollup. 2021-08-10 10:18:08 +01:00
Aleksey Kladov
bb8607434d internal: remove client-side support for latest requests
Companion for #9826
2021-08-09 19:24:43 +03:00
Ryan Levick
ac50e35325 Give better error message when the rust-analyzer binar path was set in the user's config but the binary is invalid 2021-08-03 14:03:49 +02:00
Gianluca Recchia
93433364ab
Exclude rust-analyzer.server.path from VS Code's sync feature
By changing the scope of this configuration to `machine-overridible`,
this setting becomes fully local for the VS Code instance the user is
running.

Having this setting excluded from syncing should help avoid
inconveniences for users who have VS Code installed on two different
operating systems, where the paths to the language server binary would
very likely mismatch.
2021-08-01 12:00:41 +02:00
Aleksey Kladov
be84f85c1d feat: gate custom clint-side commands behind capabilities
Some features of rust-analyzer requires support for custom commands on
the client side. Specifically, hover & code lens need this.

Stock LSP doesn't have a way for the server to know which client-side
commands are available. For that reason, we historically were just
sending the commands, not worrying whether the client supports then or
not.

That's not really great though, so in this PR we add infrastructure for
the client to explicitly opt-into custom commands, via `extensions`
field of the ClientCapabilities.

To preserve backwards compatability, if the client doesn't set the
field, we assume that it does support all custom commands. In the
future, we'll start treating that case as if the client doesn't support
commands.

So, if you maintain a rust-analyzer client and implement
`rust-analyzer/runSingle` and such, please also advertise this via a
capability.
2021-07-30 19:16:33 +03:00
Alexander Gonzalez
cff2a0fe32 lint: Format the typescript files properly 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
ca85185bc6 docs: Update the lsp-extensions.md with the Hover Range capability 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
1a0a5da1a4 refactor: Make handle_hover handle ranges too 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
2b5798e927 fix: Unregister the removed command 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
9f21891950 refactor: Remove unnecessary command 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
18644720eb feat: Completed the client side implementation of rust-analyzer/hoverRange 2021-07-27 18:29:22 -04:00
Kevin DeLorey
5b9f173254 Removed all dead config accessors. 2021-07-23 07:50:37 -06:00
Kevin DeLorey
d8f0213316 removed dead code 2021-07-23 07:41:55 -06:00
Kevin DeLorey
7797c59f18 Updated docs. 2021-07-22 19:35:47 -06:00
Kevin DeLorey
b75e0e7bb1 Initial commit of highlight related configuration w/ implementation. 2021-07-22 19:35:47 -06:00
Damien Elmes
d22b830ed1 mention files.watcherExclude
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-07-22 21:25:23 +10:00
Damien Elmes
106ea7ad85 minor update to excludeDirs doc
I saw reference to globs in #7755, but it doesn't look like they're
actually supported, and I had to dig through the source to discover
that the folders are relative to the workspace root. Further digging
was required to get VS Code from hanging for long periods trying to
watch giant Bazel folders that had already been excluded from Rust
Analyzer. Hopefully this tweak will save others the confusion :-)
2021-07-19 23:30:00 +10:00
Laurențiu Nicola
cfaf186d02 Rename the old server before update 2021-07-13 09:10:25 +03:00
Laurențiu Nicola
dfb666f9ec Remove unnecessary .vscodeignore entry 2021-07-10 18:37:19 +03:00
Laurențiu Nicola
5749c4d1ac Update eslint 2021-07-10 18:34:48 +03:00
Laurențiu Nicola
713ff1890d Update vsce 2021-07-10 18:32:34 +03:00
Laurențiu Nicola
8f05aceeed Update vscode 2021-07-10 18:31:42 +03:00
Laurențiu Nicola
27f55daf05 Update @types/node 2021-07-10 18:31:33 +03:00
Laurențiu Nicola
e965d46a97 Update @types/node-fetch 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
45a3130fb2 Update tslib 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
533b498cb7 Update typescript 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
8eb79ef41c Update mocha 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
461a44bf37 Update npm packages 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
eff09e89fe Update vsce 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
23d688b4c8 Make .vscodeignore more strict 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
ea3a756d1a Set output.exports to make rollup happy 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
f86e6a1c03 Update vsce a little 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
a2ecc5c1ca Update plugin-node-resolve 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
b65ddf03c7 Update typescript 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
fed134f574 Update eslint some more 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
d96c26eb16 Update rollup 2021-07-10 18:29:07 +03:00
Laurențiu Nicola
f6b216681d Update eslint plugins 2021-07-10 18:29:06 +03:00
Laurențiu Nicola
f97c86501d Update eslint 2021-07-10 18:29:06 +03:00
Laurențiu Nicola
7df4bdb873 Update @types/node 2021-07-10 18:29:06 +03:00
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