Commit graph

255357 commits

Author SHA1 Message Date
Lukas Wirth
16a28cacc2 fix: Fix IDE features breaking in some attr macros 2024-06-20 11:00:19 +02:00
Lukas Wirth
e5d5c7b20a Invert matching on builtin macros in expand_allowed_builtins 2024-06-20 10:31:20 +02:00
Ishan Jain
a2d4e2934e
removed format_args from allowed expansions 2024-06-19 16:58:48 +05:30
Ishan Jain
33d4ab65e8
updated tests 2024-06-19 16:11:50 +05:30
Ishan Jain
9b619035b9
Created expand_allowed_builtins, updated expand_macro to call this function 2024-06-15 15:20:46 +05:30
Ishan Jain
1623f15166
allow format_args! expansion 2024-06-14 10:13:41 +05:30
Ishan Jain
4d58fc1729
fixed tests 2024-06-14 09:52:46 +05:30
Ishan Jain
8ab0fc3353
added tests 2024-06-14 09:17:56 +05:30
Ishan Jain
e728026bc5
hir/semantics: Only allow expansion of specific built in macros 2024-06-13 10:45:11 +05:30
bors
a97aef8466 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
1e9e86c655 feature: add build system info; runnables to rust-project.json 2024-06-11 11:55:17 -04:00
bors
5e1ab70dff Auto merge of #17394 - Veykril:recurse-fix, r=Veykril
fix: Fix `HirDisplay` stackoverflow for parameter Self defaults

Fixes https://github.com/rust-lang/rust-analyzer/issues/10932
2024-06-11 15:05:26 +00:00
Lukas Wirth
36caa43ec1 fix: Fix HirDisplay stackoverflow for parameter Self defaults 2024-06-11 17:04:07 +02:00
bors
21e9022cda Auto merge of #17364 - roife:fix-issue-12917, r=Veykril
feat: show type bounds from containers when hovering on functions

fix #12917.

### Changes

1. Added Support for displaying the container and type bounds from it when hovering on functions with generic types.
2. Added a user config to determine whether to display container bounds (enabled by default).
3. Added regression tests.
4. Simplified and refactored `hir/display.rs` to improve readability.
2024-06-11 13:28:11 +00:00
bors
a3ec3b9621 Auto merge of #17392 - randomicon00:17242, r=Veykril
Change 'Length' to 'Len'

This is a fix for #17242
2024-06-11 13:14:56 +00:00
randomicon00
ca7e04ffe1 edit: Length to Len in benchmark 2024-06-11 09:09:56 -04:00
roife
668327a672 refactor: move the logic that displays container type bounds to function fmt 2024-06-11 21:02:13 +08:00
roife
6c122f6990 fix: skip container header if no generics params 2024-06-11 21:02:13 +08:00
roife
687889c5c3 internal: simplify and rename display_xxx to write_xxx for consistency 2024-06-11 21:02:13 +08:00
roife
445e8866a3 feat: add hover config for showing container bounds 2024-06-11 21:02:13 +08:00
roife
e5f859868e feat: show type bounds from containers for functions 2024-06-11 21:02:13 +08:00
roife
80a2ac5681 internal: simplify and refactor write_where_clause 2024-06-11 21:02:13 +08:00
randomicon00
25004a1018 edit: change 'Length' to 'Len' 2024-06-11 08:49:30 -04:00
bors
4cf0490c21 Auto merge of #17389 - rust-lang:dependabot/npm_and_yarn/editors/code/braces-3.0.3, r=lnicola
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.
<details>
<summary>Commits</summary>
<ul>
<li><a href="74b2db2938"><code>74b2db2</code></a> 3.0.3</li>
<li><a href="88f1429a0f"><code>88f1429</code></a> update eslint. lint, fix unit tests.</li>
<li><a href="415d660c30"><code>415d660</code></a> Snyk js braces 6838727 (<a href="https://redirect.github.com/micromatch/braces/issues/40">#40</a>)</li>
<li><a href="190510f79d"><code>190510f</code></a> fix tests, skip 1 test in test/braces.expand</li>
<li><a href="716eb9f12d"><code>716eb9f</code></a> readme bump</li>
<li><a href="a5851e57f4"><code>a5851e5</code></a> Merge pull request <a href="https://redirect.github.com/micromatch/braces/issues/37">#37</a> from coderaiser/fix/vulnerability</li>
<li><a href="2092bd1fb1"><code>2092bd1</code></a> feature: braces: add maxSymbols (<a href="https://github.com/micromatch/braces/issues/">https://github.com/micromatch/braces/issues/</a>...</li>
<li><a href="9f5b4cf473"><code>9f5b4cf</code></a> fix: vulnerability (<a href="https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727">https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727</a>)</li>
<li><a href="98414f9f1f"><code>98414f9</code></a> remove funding file</li>
<li><a href="665ab5d561"><code>665ab5d</code></a> update keepEscaping doc (<a href="https://redirect.github.com/micromatch/braces/issues/27">#27</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/micromatch/braces/compare/3.0.2...3.0.3">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=braces&package-manager=npm_and_yarn&previous-version=3.0.2&new-version=3.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/rust-lang/rust-analyzer/network/alerts).

</details>
2024-06-11 09:05:34 +00:00
dependabot[bot]
5e3bf0a8a9
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
bors
d181bfdb0b Auto merge of #17374 - Veykril:configs, r=Veykril
Allow choosing logical cores for num threads config
2024-06-11 08:49:19 +00:00
Lukas Wirth
34d273b5be Simplify some config serialization stuff 2024-06-11 10:45:17 +02:00
bors
704b56b5bb Auto merge of #17377 - Young-Flash:hir_print, r=Veykril
internal: better print style for hir

before:
![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/cd5e27b3-b4b1-450f-ba50-3c4f4e345d70)

after:
![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/04e11345-cadd-49cb-b10c-6888ef51758e)
2024-06-11 08:05:40 +00:00
bors
c995190044 Auto merge of #17381 - roife:fix-issue-17378, r=Veykril
fix: ensure that the parent of a SourceRoot cannot be itself

fix #17378.

In `FileSetConfig.map`, different roots might be mapped to the same `root_id` due to deduplication in `ProjectFolders::new`:

```rust
// Example from rustup
/Users/roife/code/rustup/target/debug/build/rustup-863a063426b56c51/out
/Users/roife/code/rustup
```

In `source_root_parent_map`, r-a might encounter paths where their SourceRootId (i.e. `root_id`) is identical, yet one the them is the parent of the another. This situation can cause the `root_id` to be its own parent, potentially leading to an infinite loop.

This PR resolves such cases by adding a check.
2024-06-10 17:43:06 +00:00
roife
5aa6137470 fix: ensure that the parent of a SourceRoot cannot be itself 2024-06-10 23:15:26 +08:00
bors
8fd1b507ea Auto merge of #17380 - Veykril:sema-source, r=Veykril
fix: Remove extra parse cache from Semantics again

Should fix https://github.com/rust-lang/rust-analyzer/issues/17376, specifically 30c04d5aa9523140f0f2daa07bc461534fb09b95

The recent changes here were heavily triggering what I realized in https://github.com/rust-lang/rust-analyzer/issues/17367#issuecomment-2156374726
2024-06-10 10:06:44 +00:00
Lukas Wirth
ac9cdbbfa6 Remove extra parse cache from Semantics again 2024-06-10 12:04:35 +02:00
Lukas Wirth
0a57742600 Thread more HasSource::source calls through Semantics for caching 2024-06-10 10:33:07 +02:00
bors
0ef2213ed8 Auto merge of #17372 - Veykril:parallel-diagnostics, r=Veykril
feat: Compute native diagnostics in parallel
2024-06-10 07:34:36 +00:00
bors
5a1df7f548 Auto merge of #17375 - Veykril:attr-input-no-intern, r=Veykril
Don't intern attribute inputs as their spans make them unique
2024-06-09 19:35:14 +00:00
Lukas Wirth
a65c912663 Don't intern attribute inputs as their spans make them unique 2024-06-09 21:21:33 +02:00
Young-Flash
b45cf63f06 minor: use push_str instead 2024-06-09 22:31:55 +08:00
Young-Flash
6e08590436 internal: tweak test case 2024-06-09 20:55:40 +08:00
Lukas Wirth
a800a1d86a Fix divide by zero 2024-06-09 13:03:01 +02:00
Lukas Wirth
7053aed3dc Register virtual workspace Cargo.toml files in the VFS 2024-06-09 12:54:50 +02:00
Lukas Wirth
02dd22721c Allow choosing logical cores for num threads config 2024-06-09 12:04:28 +02:00
Lukas Wirth
3243ea0c2b feat: Compute native diagnostics in parallel 2024-06-09 11:44:44 +02:00
Young-Flash
f4153f46ed internal: better print style for hir 2024-06-09 12:00:43 +08:00
bors
994a9b86ff Auto merge of #17365 - DropDemBits:diagnostic-snippet-cap, r=Veykril
internal: Expose snippet capability to diagnostic quickfixes

Fixes #16767
2024-06-08 12:41:17 +00:00
bors
4f180b6fed Auto merge of #17368 - Veykril:dist-fix, r=Veykril
fix: Fix generated markers not being patchable in package.json

I think the newlines are tripping up CI, so I hope clearing the property to leave an empty object won't make VSCode made here.
2024-06-08 10:56:55 +00:00
Lukas Wirth
b4891c3f56 fix: Fix generated markers not being patchable in package.json 2024-06-08 12:54:43 +02:00
DropDemBits
4f67f71db5
internal: Expose snippet capability to diagnostic quickfixes 2024-06-07 21:29:48 -04:00
bors
c501753236 Auto merge of #17359 - Veykril:status-bar, r=Veykril
Add version info to status bar item
2024-06-07 12:51:28 +00:00
Lukas Wirth
fc92e5c87a Add version info to status bar item 2024-06-07 14:39:50 +02:00
bors
f711c68f98 Auto merge of #17360 - Veykril:rename-alias-foreign, r=Veykril
fix: Fix renaming imports of foreign items touching foreign sources

Fixes https://github.com/rust-lang/rust-analyzer/issues/17318
2024-06-07 12:38:20 +00:00