Commit graph

2040 commits

Author SHA1 Message Date
Lukas Wirth
8f044d9681 Fix incorrect generic parameter hint defaults 2024-07-17 08:52:23 +02:00
Laurențiu Nicola
f0c3cb3738 Add --keep-going to rust-analyzer.cargo.buildScripts.overrideCommand docs 2024-07-17 08:42:39 +03:00
Lukas Wirth
33ce9a4211 Set RUSTC_SYSROOT for runnables 2024-07-16 13:48:14 +02:00
bors
8efe8a8528
Trigger VSCode to rename after extract variable assist is applied
When the user applies the "Extract Variable" assist, the cursor is
positioned at the newly inserted variable. This commit adds a command
to the assist that triggers the rename action in VSCode. This way, the
user can quickly rename the variable after applying the assist.

Fixes part of: #17579
2024-07-12 19:06:19 -07:00
Lukas Wirth
7fa20cbb04 Remove faq landing page, improve main one 2024-07-10 19:05:32 +02:00
Liao Junxuan
35b4957b80
feat: add inlay hints for generic parameters
fixes #11091

By default, only hints for const generic parameters are shown.
2024-07-08 19:11:41 +08:00
bors
a494aaba87 Auto merge of #17523 - wada314:master, r=Veykril
Add an option to use "::" for the external crate prefix.

Fixes #11823 .
Hi I'm very new to rust-analyzer and not sure how the review process are. Can somebody take a look at this PR? thanks!
2024-07-07 08:32:46 +00:00
bors
1adb52cde6 Auto merge of #17549 - Veykril:runnables-fix, r=Veykril
fix: Fix runnables being incorrectly constructed

I've misunderstood parts of the code here which caused runnables to arbitrarily break :) (I have yet to understand the conditions that made them break though, there is some odd caching involved I feel like ...)
Fixes https://github.com/rust-lang/rust-analyzer/issues/17402
2024-07-06 18:24:30 +00:00
Lukas Wirth
bb9678ea3b fix: Fix runnables being incorrectly constructed 2024-07-06 20:23:14 +02:00
bors
c888c0f109 Auto merge of #17548 - Veykril:debug-fix, r=Veykril
fix: Fix passing `message-format` after -- in debugging

Fixes https://github.com/rust-lang/rust-analyzer/pull/17495#issuecomment-2211717224
2024-07-06 16:04:53 +00:00
Lukas Wirth
7733403056 Fix passing message-format after -- in debugging 2024-07-06 18:03:33 +02:00
bors
35db3f5a03 Auto merge of #17547 - Veykril:runnables-env, r=Veykril
internal: Clean up runnable lsp extension

This feels like a natural addition to me, and also allows us to drop the expect-test hardcoding from the extension. Additionally, `cargoExtraArgs` is pointless, all the client will do is merge it with `cargoArgs` so the server can do that instead of delegating that to the client.
2024-07-06 15:02:41 +00:00
Lukas Wirth
3d7ee9b4ea Flatten cargoExtraArgs away from the runnable lsp extension 2024-07-06 16:36:27 +02:00
Lukas Wirth
fcddcf2ee5 Add environment to runnable lsp extension 2024-07-06 16:20:25 +02:00
bors
78d5f05e70 Auto merge of #17508 - jjoeldaniel:landing-page, r=Veykril
feat: Add landing/faq walkthrough pages

This is a basic implementation of a landing and FAQ page; I've included the bare-bones information as well as a [recommended section on inlay hints](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Landing.20Page/near/446135321).

I've also added `rust-analyzer: Open Walkthrough` and `rust-analyzer: Open FAQ` commands for ease of access.

I am hoping to create a small list of FAQ to include that might be useful as well as any other information I may have missed in the landing page. Feel free to share any suggestions!

![landing/faq page demo](https://github.com/rust-lang/rust-analyzer/assets/100006388/4644e4f0-4555-4b29-83c1-b048084ad63d)

cc #13351
2024-07-06 13:59:36 +00:00
Shohei Wada
3725ab3146 squash. 2024-07-02 01:52:34 +09:00
bors
e6fd485683 Auto merge of #17495 - listochkin:pass-cargo-extra-args-for-debugger, r=Veykril
pass cargo extra args when debugging

fixes #17128
2024-07-01 10:34:09 +00:00
bors
72f278b5be Auto merge of #17522 - Veykril:comptimes, r=Veykril
internal: Cut compiletimes slightly
2024-07-01 08:43:11 +00:00
Lukas Wirth
b60b27bd22 Remove serde flag from indexmap dependency 2024-06-30 18:14:53 +02:00
Tavo Annus
1389312871 Make borrow checking configurable for term search 2024-06-29 12:24:08 +03:00
Joel Daniel Rico
57497645f8 Add landing/faq walkthroughs and commands for quick access 2024-06-28 11:13:12 -07:00
Andrei Listochkin
cb523fc88a
pass cargo extra args when debug
fixes #17128
2024-06-25 18:13:08 +01:00
bors
f998561964 Auto merge of #17411 - Wilfred:clearer_unlinked_file, r=Veykril
fix: Improve hover text in unlinked file diagnostics

Use full sentences, and mention how to disable the diagnostic if users are intentionally working on unowned files.

![Screenshot 2024-06-12 at 5 55 48 PM](https://github.com/rust-lang/rust-analyzer/assets/70800/c91ee1ed-1c72-495a-9ee3-9e360a5c6977)

(Full disclosure: I've tested a rust-analyzer build in VS Code, but the pop-up logic is currently disabled due to #17062, so I haven't tested that.)
2024-06-24 08:11:43 +00:00
Tavo Annus
51c3bd215a Fix suggestions of unstable constants 2024-06-22 21:33:58 +03:00
Wilfred Hughes
e62bc2d1f5 fix: Improve hover text in unlinked file diagnostics
Use full sentences, and mention how to disable the diagnostic
if users are intentionally working on unowned files.
2024-06-20 09:32:48 -07:00
panicbit
792155e790 remove panicbit.cargo extension warning 2024-06-19 15:37:09 +02:00
bors
87ee18da54 Auto merge of #17438 - jjoeldaniel:toggle_lsp_logs, r=Veykril
feat: add `toggleLSPLogs` command

Implement client-side command to toggle LSP logs in VSCode.

The command replaces the need to add/remove the `"rust-analyzer.trace.server": "verbose"` setting each time one wants to display logs. I've also updated the docs/ instances that reference the now outdated manual method.

The command labeled `rust-analyzer: Toggle LSP Logs` enables the setting project-wide and opens the relevant trace output channel.

Closes #8233
2024-06-19 08:39:42 +00:00
Lukas Wirth
ff07caa9de Tidy up vscode extension a bit 2024-06-19 09:42:06 +02:00
Lukas Wirth
8846b5cf4a Fix and cleanup VSCode task building 2024-06-17 14:06:01 +02:00
Joel Daniel Rico
2ebcf55ece feat: add toggleLSPLogs command
add `toggleLSPLogs` command
update docs to reflect new command
2024-06-17 04:08:32 -07:00
David Barsky
b50fc06e0d fix: avoid doubling cargo args in runnables 2024-06-13 11:08:58 -04:00
bors
4af21ffb02 Auto merge of #16840 - Wilfred:shell_runnable, r=Veykril
Allow rust-project.json to include arbitrary shell commands for runnables

This is a follow-up on #16135, resolving the feedback raised :)

Allow rust-project.json to include shell runnables, of the form:

```
{
  "build_info": {
    "label": "//project/foo:my-crate",
    "target_kind": "bin",
    "shell_runnables": [
      {
        "kind": "run",
        "program": "buck2",
        "args": ["run", "//project/foo:my-crate"]
      },
      {
        "kind": "test_one",
        "program": "test_runner",
        "args": ["--name=$$TEST_NAME$$"]
      }
    ]
  }
}

```

If these runnable configs are present for the current crate in rust-project.json, offer them as runnables in VS Code.

This PR required some boring changes to APIs that previously only handled cargo situations. I've split out these changes as commits labelled 'refactor', so it's easy to see the interesting changes.
2024-06-11 16:13:10 +00:00
Wilfred Hughes
71a78a9cdc feature: add build system info; runnables to rust-project.json 2024-06-11 11:55:17 -04:00
dependabot[bot]
2a4886a8b6
Chore(deps-dev): Bump braces from 3.0.2 to 3.0.3 in /editors/code
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-11 09:01:41 +00:00
Lukas Wirth
1dcb11be5d Simplify some config serialization stuff 2024-06-11 10:45:17 +02:00
Lukas Wirth
0ee8a4f472 Add version info to status bar item 2024-06-07 14:39:50 +02:00
roife
4a4b13cbda fix: incorrect formatting of hover actions 2024-06-06 21:07:59 +08:00
ChosenName
14df2a4b7a fmt 2024-06-04 22:16:08 -06:00
ChosenName
7d8125abe7
fmt 2024-06-04 21:35:41 -06:00
ChosenName
bf1a3a32bd
Update package.json 2024-06-04 21:08:30 -06:00
Jonas Rinke
2616b7e045 Removed return 2024-05-25 22:42:39 +02:00
Jonas Rinke
84ab0d83d5 Formatting 2024-05-25 17:08:17 +02:00
Jonas Rinke
cb28175d22 Semicolon 2024-05-25 17:04:48 +02:00
Jonas Rinke
aaa7e3a3c4 Use correct format for setting environment variables when debugging with cpptools 2024-05-25 16:53:01 +02:00
roife
f4d3547bc6 Use cwd from runnable.args for debugger 2024-05-24 03:51:05 +08:00
roife
89843ba083 Revert "Debug use cargo workspace root as cwd. fixes #13022"
This reverts commit 4ca86edac9.
2024-05-24 03:51:05 +08:00
Lukas Wirth
bd37e2790b Allow sysroots to only consist of the source root dir 2024-05-23 20:12:31 +02:00
Tavo Annus
ab18604309 Make term search fuel configurable 2024-05-08 19:46:33 +03:00
Wilfred Hughes
b1266405ef docs: Fix typo in VS Code setting description 2024-04-30 11:17:57 -07:00
Lukas Wirth
18ca22a98e Show workspace info in the status bar 2024-04-26 11:28:33 +02:00
bors
65eda41e65 Auto merge of #17021 - roife:add-hover-limits-for-adts, r=Veykril
Support hovering limits for adts

Fix #17009

1. Currently, r-a supports limiting the number of struct fields displayed when hovering. This PR extends it to support enum variants and union fields. Since the display of these three (ADTs) is similar, this PR extends 'hover_show_structFields' to 'hover_show_adtFieldsOrVariants'.
2. This PR also resolved the problem that the layout of ADT was not restricted by display limitations when hovering on the Self type.
3. Additionally, this PR changes the default value of display limitations to `10` (instead of the original `null`), which helps users discover this feature.
2024-04-25 07:23:27 +00:00
Lukas Wirth
a2ed6837bc Allow rust files to be used linkedProjects 2024-04-21 16:26:55 +02:00
roife
43576989a1 Add hovering limitations support for variants 2024-04-20 09:14:00 +08:00
bors
50bdeaad07 Auto merge of #17108 - Veykril:rustc-ws-hacks, r=Veykril
internal: Cleanup cfg and env handling in project-model

Fixes https://github.com/rust-lang/rust-analyzer/issues/16122#issuecomment-2065794340

`miri` and `debug_assertions` are now enabled via the `cargo.cfgs` config by default, allowing them to be disabled by overwriting the config.
2024-04-19 16:00:54 +00:00
roife
e0e28ec856 fix: add a separate setting for enum variants 2024-04-19 21:45:56 +08:00
Lukas Wirth
0485a85ee2 Set debug_assertions and miri cfgs as config defaults, allowing them to be overwritten 2024-04-19 11:06:55 +02:00
bors
eea61bd4d1 Auto merge of #16726 - Veykril:rustc-ws-hacks, r=Veykril
internal: Remove rustc core test cfg hacks

cc https://github.com/rust-lang/rust-analyzer/issues/16538
2024-04-19 07:28:50 +00:00
Lukas Wirth
2e54c0af40 Remove rustc core test cfg hacks 2024-04-19 09:27:05 +02:00
Kevin Reid
db292bd89e Make test harness arguments configurable and not --nocapture.
* Added config `runnables.extraTestBinaryArgs` to control the args.
* The default is `--show-output` rather than `--nocapture` to prevent
  unreadable output when 2 or more tests fail or print output at once.
* Renamed variables in `CargoTargetSpec::runnable_args()` for clarity.

Fixes <https://github.com/rust-lang/rust-analyzer/issues/12737>.
2024-04-18 18:37:09 -07:00
roife
6bb85985d7 fix: adjust the limitation for ADTs' fields to 5 2024-04-16 16:28:23 +08:00
roife
01c3559bf3 Update tests and docs for hover_show_adtFieldsOrVariants 2024-04-16 16:27:56 +08:00
Lukas Wirth
597c293a69 Adjust package.json semantic highlighting items 2024-04-15 17:00:03 +02:00
bors
beb205f347 Auto merge of #17062 - Veykril:disable-unlinked-file-popup, r=Veykril
Temporarily disable unlinked file popup

Not gonna look into this until the next release, so I'd rather disable it for the time being
2024-04-13 22:55:03 +00:00
Lukas Wirth
ff9ebc747d Temporarily disable unlinked file popup 2024-04-13 22:45:22 +02:00
roife
4346bbcd92 fix: support auto-closing for triple backticks 2024-04-11 18:46:22 +08:00
Lukas Wirth
ff279f1e91 Fix allFeatures config docs 2024-04-01 14:16:36 +02:00
bors
2678660880 Auto merge of #16924 - poliorcetics:ab/push-kxwqvtypvlsq, r=Veykril
feat: Add `rust-analyzer.cargo.allTargets` to configure passing `--all-targets` to cargo invocations

Closes #16859

## Unresolved question:

Should this be a setting for build scripts only ? All the other `--all-targets` I found where already covered by `checkOnSave.allTargets`
2024-04-01 10:30:15 +00:00
Wilfred Hughes
a758e349bc Document CargoTaskDefinition and factor out converting TaskDefinition to Execution 2024-03-29 16:07:22 -07:00
Wilfred Hughes
e8d6a5ec0b Rename RustTargetDefinition to CargoTaskDefinition 2024-03-29 16:07:22 -07:00
bors
f5a9250147 Auto merge of #16975 - HKalbasi:test-explorer, r=HKalbasi
Prompt the user to reload the window when enabling test explorer
2024-03-29 17:01:51 +00:00
hkalbasi
34cde2cebc Prompt the user to reload the window when enabling test explorer 2024-03-29 18:08:16 +03:30
bors
a8b7acf22f Auto merge of #16971 - HKalbasi:test-explorer, r=HKalbasi
Resolve tests per file instead of per crate in test explorer

Fix part of #16827
2024-03-29 02:06:22 +00:00
hkalbasi
beec6914c8 Resolve tests per file instead of per crate in test explorer 2024-03-29 05:34:43 +03:30
roife
3521089985 fix: use lldb when debugging with C++ extension 2024-03-28 14:38:23 +08:00
Laurențiu Nicola
662ea73e4e Revert debug extension priorities 2024-03-28 07:58:36 +02:00
Alexis (Poliorcetics) Bourget
174af88e76
feat: Add rust-analyzer.cargo.allTargets to configure passing --all-targets to cargo invocations 2024-03-27 01:57:41 +01:00
Young-Flash
d81148a009 expose config for hover struct field display 2024-03-25 19:55:19 +08:00
hkalbasi
92300e8f86 Use --workspace and --no-fail-fast in test explorer 2024-03-19 01:46:41 +03:30
bors
f6e2895ee6 Auto merge of #16839 - Wilfred:extension_refactor_for_shell, r=Veykril
Refactor extension to support arbitrary shell command runnables

Currently, the extension assumes that all runnables invoke cargo. Arguments are sometimes full CLI arguments, and sometimes arguments passed to a cargo subcommand.

Refactor the extension so that tasks are just a `program` and a list of strings `args`, and rename `CargoTask` to `RustTask` to make it generic.

(This was factored out of #16135 and tidied.)
2024-03-18 08:48:57 +00:00
dependabot[bot]
64c12e665b
Bump follow-redirects from 1.15.4 to 1.15.6 in /editors/code
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-16 06:57:29 +00:00
hkalbasi
eeff20d172 Show compilation progress in test explorer 2024-03-15 16:28:59 +03:30
Wilfred Hughes
4422a90b11 refactor: Store the CLI command directly in RustTargetDefinition 2024-03-14 16:41:49 -07:00
Wilfred Hughes
2e109c7da8 refactor: Use a single CLI args array rather than a separate subcommand field 2024-03-14 16:41:49 -07:00
Wilfred Hughes
d472fd932b refactor: Rename CargoTask to RustTask in extension 2024-03-14 16:41:49 -07:00
Laurențiu Nicola
cb6c26ba82 Don't auto-close block comments in strings 2024-03-12 14:44:35 +02:00
hkalbasi
dc99ad912a Some minor changes in the test explorer lsp extension 2024-03-09 01:21:27 +03:30
Lukas Wirth
1c6d1b4f2a fix: Add config and capability for test explorer 2024-03-06 19:20:58 +01:00
hkalbasi
44be2432f5 Add test explorer 2024-03-06 00:05:29 +03:30
Lukas Wirth
8844640c6f fix: Put style lints behind disabled-by-default config 2024-03-05 11:43:23 +01:00
bors
ce3216e0ae Auto merge of #15938 - Young-Flash:display_trait_item_when_hover, r=Veykril
feat: add hover display for trait assoc items

This PR enable preview assoc items when hover on `trait`

![image](https://github.com/rust-lang/rust-analyzer/assets/71162630/d9c3949c-33cf-4a32-aa97-3af46b28033a)

inspired by https://github.com/rust-lang/rust-analyzer/pull/15847
2024-03-05 08:26:53 +00:00
bors
d444acdb19 Auto merge of #16719 - lnicola:native-debug, r=lnicola
fix: Add basic support for Native Debug

Native Debug doesn't work very well and passing command-line arguments is nasty (https://github.com/rust-lang/rust-analyzer/issues/9815), but I guess it's a start.

Closes #9815
2024-03-04 08:16:01 +00:00
Young-Flash
dba67b46a1 update for review 2024-03-02 10:01:04 +08:00
Lukas Wirth
ed7e9aa5d8 Simplify 2024-03-01 13:25:24 +01:00
Laurențiu Nicola
a01e4f8b72 Add basic support for Native Debug 2024-02-29 16:14:58 +02:00
Lukas Wirth
30ad0ae209 internal: Revert #16541 2024-02-27 15:48:30 +01:00
Young-Flash
2e87f31fe9 add HoverDisplayConfig 2024-02-22 17:37:40 +08:00
Young-Flash
35ec5955eb add config item for hover display 2024-02-21 11:08:45 +08:00
bors
60982dc8fc Auto merge of #16475 - DropDemBits:native-vscode-snippet-text-edit, r=Veykril
feat: Support multiple tab stops for completions in VSCode

Uses the native VSCode support for `SnippetTextEdit`s. Fixes #13229 and fixes #8531.

https://github.com/rust-lang/rust-analyzer/assets/13354275/a2d2c033-bb30-4f34-92ca-bf3f4f744cdc

This is done in a slightly hacky way, as `vscode-languageclient` can't convert RA's `SnippetTextEdit`s into vscode `SnippetTextEdit`s and will appear to use a [different format](295aaa393f/types/src/main.ts (L1501-L1516)) in the future.

---

~~Marked as draft since as-is, this will cause completions to double-indent any multi-line code generated.~~
**Update:** This also fixes up edits so that any multi-line code won't be double-indented.
2024-02-19 10:58:44 +00:00
Lukas Wirth
ead369117a CrateOrigin::Local means local to the project workspace, not cargo workspace 2024-02-16 16:28:17 +01:00
DropDemBits
bcf14e27ce
Work around snippet edits doubling up extra indentation
We can't tell vscode to not add in the extra indentation, so we instead opt to remove it from the edits themselves, and then let vscode add it back in.
2024-02-15 18:39:17 -05:00