Commit Graph

1630 Commits

Author SHA1 Message Date
bors
c468e39b5a Auto merge of #14112 - Veykril:vscode-untrusted, r=lnicola
minor: Explicitly disable the rust-analyzer extension in untrusted workspaces

This is the default, but its always better to be explicit here + we can add a small note as to why.
2023-02-09 18:46:11 +00:00
Lukas Wirth
7fc0f8985d Explicitly disable the rust-analyzer extension in unstrusted workspaces 2023-02-09 17:34:21 +01:00
bors
a05ce5a3e7 Auto merge of #13986 - MariaSolOs:limit-completions, r=Veykril
Add setting for limiting number of completions

For #13911.
2023-02-08 09:31:35 +00:00
bors
14ad6087c5 Auto merge of #14090 - MariaSolOs:regions, r=Veykril
Unify language configuration folding markers with server behaviour

Fixes #14089.
2023-02-06 14:37:39 +00:00
Lukas Wirth
cb9a5b9549 Support sysroot library source being defined inside the workspace 2023-02-06 12:07:33 +01:00
Maria José Solano
3674502a98 Unify language config markers with server 2023-02-04 17:46:11 -08:00
Jonas Schievink
5b1187a046 Remove some types ¯\_(ツ)_/¯ 2023-01-31 15:49:39 +01:00
Jonas Schievink
56f81ebc3e Lazily create the trace output channel 2023-01-31 15:43:47 +01:00
Lukas Wirth
e6ad8a2edc fix: config substitution failing extension activation 2023-01-25 09:17:49 +01:00
Lukas Wirth
ec9476015c Substitute VSCode variables more generally 2023-01-24 13:46:56 +01:00
Lukas Wirth
64110714f0 🧹 lsp_ext.ts 2023-01-23 16:58:35 +01:00
Lukas Wirth
544c581e5f Bump package-lock.json 2023-01-23 13:52:13 +01:00
Lukas Wirth
b9fe5afb30 Add a 'open server logs' button to the error notification 2023-01-23 13:24:42 +01:00
OmarTawfik
7198cd04ac allow using vscode variables in config.serverPath 2023-01-20 13:22:11 -08:00
Maria José Solano
2ea703c659 Update VS Code settings 2023-01-19 18:34:19 -08:00
Lukas Wirth
f932d39945 Regen config 2023-01-16 17:02:30 +01:00
Lukas Wirth
4267b11c40
Revert "Use ZWNJ to prevent VSCode from forming ligatures between hints and code" 2023-01-10 09:43:08 +01:00
Ian Chamberlain
65cf7abbe2
Use experimental capability to enable color codes 2023-01-09 11:50:35 -05:00
Ian Chamberlain
738ce83d85
Strip colors before matching preview diagnostics 2023-01-09 11:49:59 -05:00
Ian Chamberlain
c3e4bc3136
Update docs to include note about ANSI diagnostics 2023-01-09 11:49:58 -05:00
Ian Chamberlain
1b8141b54c
Parse + decorate rendered ANSI cargo output
Use ANSI control characters to display text decorations matching the
VScode terminal theme, and strip them out when providing text content
for rustc diagnostics.

This adds the small `anser` library to parse the control codes, and it
also supports HTML output so it should be fairly easy to switch to a
rendered HTML/webview implementation if desired.
2023-01-09 11:46:29 -05:00
bors
fd300eebc9 Auto merge of #13799 - Veykril:flycheck, r=Veykril
Rename `checkOnSave` settings to `check`

Now that flychecks can be triggered without saving the setting name doesn't make that much sense anymore. This PR renames it to just `check`, but keeps `checkOnSave` as the enabling setting.
2023-01-09 15:35:38 +00:00
Maybe Waffle
12b7f9f7bf Add an option to minimize parentheses for adjustment hints 2023-01-09 13:35:17 +00:00
Maybe Waffle
b89c4f0a05 Implement postfix adjustment hints
I'd say "First stab at implementing..." but I've been working on this
for a month already lol
2023-01-09 13:27:59 +00:00
Lukas Wirth
d2bb62b6a8 Rename checkOnSave settings to check 2023-01-09 14:17:13 +01:00
Lukas Wirth
87d57f51bc Rename checkOnSave settings to flycheck 2023-01-09 14:17:13 +01:00
bors
fe8ee9c43a Auto merge of #13744 - vtta:numthreads, r=Veykril
feat: add the ability to limit the number of threads launched by `main_loop`

## Motivation
`main_loop` defaults to launch as many threads as cpus in one machine. When developing on multi-core remote servers on multiple projects, this will lead to thousands of idle threads being created. This is very annoying when one wants check whether his program under developing is running correctly via `htop`.

<img width="756" alt="image" src="https://user-images.githubusercontent.com/41831480/206656419-fa3f0dd2-e554-4f36-be1b-29d54739930c.png">

## Contribution
This patch introduce the configuration option `rust-analyzer.numThreads` to set the desired thread number used by the main thread pool.
This should have no effects on the performance as not all threads are actually used.
<img width="1325" alt="image" src="https://user-images.githubusercontent.com/41831480/206656834-fe625c4c-b993-4771-8a82-7427c297fd41.png">

## Demonstration
The following is a snippet of `lunarvim` configuration using my own build.
```lua
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "rust_analyzer" })
require("lvim.lsp.manager").setup("rust_analyzer", {
  cmd = { "env", "RA_LOG=debug", "RA_LOG_FILE=/tmp/ra-test.log",
    "/home/jlhu/Projects/rust-analyzer/target/debug/rust-analyzer",
  },
  init_options = {
    numThreads = 4,
  },
  settings = {
    cachePriming = {
      numThreads = 8,
    },
  },
})

```

## Limitations
The `numThreads` can only be modified via `initializationOptions` in early initialisation because everything has to wait until the thread pool starts including the dynamic settings modification support.
The `numThreads` also does not reflect the end results of how many threads is actually created, because I have not yet tracked down everything that spawns threads.
2023-01-09 11:53:23 +00:00
dependabot[bot]
41d290d671
Bump d3-color and d3-graphviz in /editors/code
Bumps [d3-color](https://github.com/d3/d3-color) to 3.1.0 and updates ancestor dependency [d3-graphviz](https://github.com/magjac/d3-graphviz). These dependencies need to be updated together.


Updates `d3-color` from 2.0.0 to 3.1.0
- [Release notes](https://github.com/d3/d3-color/releases)
- [Commits](https://github.com/d3/d3-color/compare/v2.0.0...v3.1.0)

Updates `d3-graphviz` from 4.1.1 to 5.0.2
- [Release notes](https://github.com/magjac/d3-graphviz/releases)
- [Changelog](https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md)
- [Commits](https://github.com/magjac/d3-graphviz/compare/v4.1.1...v5.0.2)

---
updated-dependencies:
- dependency-name: d3-color
  dependency-type: indirect
- dependency-name: d3-graphviz
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-07 19:20:08 +00:00
Lukas Wirth
c4d8cf1dad Use ZWNJ to prevent VSCode from forming ligatures between hints and code 2023-01-03 12:32:38 +01:00
bors
50801b7d6a Auto merge of #13853 - veber-alex:diag_fix, r=Veykril
Use diagnostic code as link to full message

fixes #13823 by adding a vscode setting that will keeping the existing diagnostic code and use it as a link to the full compiler error message.
While I was there I also fixed `index` to fallback to `rendered.length` to make the previewRustcOutput feature work.
2023-01-03 09:40:20 +00:00
Alex Veber
ddc0147d53 Fix diagnostic code 2023-01-03 08:33:27 +02:00
Lukas Wirth
df8fc78ece Enum variant discriminants hints 2022-12-23 11:37:42 +01:00
bors
eb3963b22e Auto merge of #13817 - WaffleLapkin:hide_adjustment_hints_outside_of_unsafe, r=Veykril
feat: Add an option to hide adjustment hints outside of `unsafe` blocks and functions

As the title suggests: this PR adds an option (namely `rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe`) that allows to hide adjustment hints outside of `unsafe` blocks and functions:

![2022-12-21_23-11](https://user-images.githubusercontent.com/38225716/208986376-d607de62-8290-4e16-b7fe-15b762dc5f60.png)

Requested by `@BoxyUwU` <3
2022-12-22 09:37:00 +00:00
Maybe Waffle
3bfe7040e8 Add an option to hide adjustment hints outside of unsafe blocks 2022-12-21 19:20:42 +00:00
hkalbasi
e1aa73ef40 Disable inlay hint location links on vscode < 1.76 2022-12-21 18:54:49 +03:30
Lukas Wirth
cf8d89e46b Add a command to clear flycheck diagnostics 2022-12-17 23:43:26 +01:00
Lukas Wirth
d8ddde27f9 Make cancelFlycheck request a notification 2022-12-17 23:29:31 +01:00
Lukas Wirth
a04feb915a Add command for manually running flychecks 2022-12-16 22:47:19 +01:00
Junliang HU
9f5a547b3f Regenerate config 2022-12-09 21:36:35 +08:00
Maria José Solano
fb60b104a2 Add JSON schema contribution 2022-12-04 12:04:56 -08:00
Maria José Solano
8661740626 Use typed notification method 2022-11-27 09:46:37 -08:00
bors
1e6a49a801 Auto merge of #13670 - Veykril:derive-helper, r=Veykril
Add `deriveHelper` to `semanticTokenTypes` section of package.json
2022-11-24 21:27:32 +00:00
Lukas Wirth
9fba39f0c0 Add deriveHelper to semanticTokenTypes section of package.json 2022-11-24 22:26:05 +01:00
Isobel Redelmeier
b116fe9be0
Fix: Handle empty checkOnSave/target values
This fixes a regression introduced by #13290, in which failing to set
`checkOnSave/target` (or `checkOnSave/targets`) would lead to an invalid
config.
2022-11-21 16:40:32 -05:00
bors
38fa47fd79 Auto merge of #13290 - poliorcetics:multiple-targets, r=Veykril
Support multiple targets for checkOnSave (in conjunction with cargo 1.64.0+)

This PR adds support for the ability to pass multiple `--target` flags when using
`cargo` 1.64.0+.

## Questions

I needed to change the type of two configurations options, but I did not plurialize the names to
avoid too much churn, should I ?

## Zulip thread

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Issue.2013282.20.28supporting.20multiple.20targets.20with.201.2E64.2B.29

## Example

To see it working, on a macOS machine:

```sh
$ cd /tmp
$ cargo new cargo-multiple-targets-support-ra-test
$ cd !$
$ mkdir .cargo
$ echo '
[build]
target = [
    "aarch64-apple-darwin",
    "x86_64-apple-darwin",
]
' > .cargo/config.toml
$ echo '
fn main() {
    #[cfg(all(target_arch = "aarch64", target_os = "macos"))]
    {
        let a = std::fs::read_to_string("/tmp/test-read");
    }

    #[cfg(all(target_arch = "x86_64", target_os = "macos"))]
    {
        let a = std::fs::read_to_string("/tmp/test-read");
    }

    #[cfg(all(target_arch = "x86_64", target_os = "windows"))]
    {
        let a = std::fs::read_to_string("/tmp/test-read");
    }
}
' > src/main.rs
# launch your favorite editor with the version of RA from this PR
#
# You should see warnings under the first two `let a = ...` but not the third
```

## Screen

![Two panes of a terminal emulator, on the left pane is the main.rs file described above, with warnings for the first two let a = declaration, on the right pane is a display of the .cargo/config.toml, an ls of the current files in the directory and a call to cargo build to show the same warnings as in the editor on the left pane](https://user-images.githubusercontent.com/7951708/192122707-7a00606a-e581-4534-b9d5-b81c92694e8e.png)

Helps with #13282
2022-11-19 13:09:37 +00:00
Lukas Wirth
073a63b93e feat: Allow viewing the full compiler diagnostic in a readonly textview 2022-11-18 19:56:08 +01:00
Alexis (Poliorcetics) Bourget
0d4737adb6 feat: Support passing multiple targets to cargo (for Rust 1.64.0+) 2022-11-11 14:36:07 +01:00
bors
977a029c1e Auto merge of #13582 - lnicola:nest-cargo-toml, r=lnicola
feat: Nest Cargo.lock under Cargo.toml in Code

Closes #13580
2022-11-08 08:44:43 +00:00
Laurențiu Nicola
4403dde711 Nest Cargo.lock under Cargo.toml in Code 2022-11-08 09:57:05 +02:00
bors
b0e56ef5e8 Auto merge of #13545 - Veykril:adjustment-hints, r=Veykril
Generalize reborrow hints as adjustment hints

Like reborrow hints, these are still mainly useful for teaching/learning

![image](https://user-images.githubusercontent.com/3757771/200073606-b5cd3b95-a9ad-454d-a3c4-d4d89bf45928.png)
2022-11-07 14:38:59 +00:00