Commit Graph

27641 Commits

Author SHA1 Message Date
UserIsntAvailable
6e16edb3bf feat: append as <name> when renaming inside an "UseTree".
test: include `rename_path_inside_use_tree`.

Keeps tracks the progress of the changes. 3 other tests broke with the changes
of this.

feat: rename all other usages within the current file.

feat: fix most of the implementation problems.

test: `rename_path_inside_use_tree` tests a more complicated scenario.
2024-02-19 12:24:36 +01: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
bors
e7c9a76cb2 Auto merge of #16601 - Young-Flash:fix_typo_ci, r=Veykril
fix: checkout repo before run typos

I see some typos at lastest master :(
2024-02-19 10:45:51 +00:00
Young-Flash
f3d84e86c8 minor: fix typo 2024-02-19 18:12:08 +08:00
Young-Flash
af174b9428 internal: checkout repo before run typos 2024-02-19 18:09:33 +08:00
bors
68c506fd62 Auto merge of #16600 - lnicola:fix-release-3, r=lnicola
internal: Also downgrade node to 16

🙄
2024-02-19 07:27:01 +00:00
Laurențiu Nicola
8544e729f1 Also downgrade node to 16 2024-02-19 09:25:25 +02:00
bors
5390dbaa39 Auto merge of #16599 - lnicola:fix-release-2, r=lnicola
internal: Also downgrade actions/setup-node
2024-02-19 06:58:28 +00:00
Laurențiu Nicola
8ca834c86b Also downgrade actions/setup-node 2024-02-19 08:55:37 +02:00
bors
f71049bfb1 Auto merge of #16598 - lnicola:fix-release, r=lnicola
internal: Downgrade actions/checkout in release workflow
2024-02-19 06:34:06 +00:00
Laurențiu Nicola
591356738d Downgrade actions/checkout in release workflow 2024-02-19 08:32:33 +02:00
bors
14924b03ce Auto merge of #16597 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
2024-02-18 17:13:20 +00:00
Laurențiu Nicola
3aaaa1409f Merge branch 'master' into sync-from-rust 2024-02-18 19:10:56 +02:00
Laurențiu Nicola
6b17dba68c Merge commit 'ac998a74b3c8ff4b81c3eeb9a18811d4cc76226d' into sync-from-ra 2024-02-18 09:41:20 +02:00
bors
ac998a74b3 Auto merge of #16579 - DropDemBits:structured-snippet-fix-with-escaped-bits-and-cr, r=Veykril
fix: Fix snippets being placed leftwards of where they should be

Snippet bits were being escaped before placing snippets, shifting snippets leftwards. Snippets were also being shifted leftwards on files with CRLF line endings since they were placed done after the Unix -> DOS line ending conversion.

Hoping this fixes all of the little bugs related to snippet rendering 😅
2024-02-16 18:45:43 +00:00
bors
0932f89586 Auto merge of #16588 - compiler-errors:async-and-const-bounds, r=Veykril
internal: Parse (nightly) `const` and `async` trait bounds

Both of these bound modifiers were added recently:

* `const` trait bounds: https://github.com/rust-lang/rust/pull/119099
* `async` trait bounds: https://github.com/rust-lang/rust/pull/120392

The latter will certainly will not do the right thing; namely, `async Fn` needs to be mapped to the `AsyncFn` trait. IDK how to do that, so advice would be appreciated, though perhaps we could land this first so the parser isn't complaining about these bounds?
2024-02-16 16:25:22 +00:00
Michael Goulet
36020bb512 Update grammar
Bounds are CONSTNESS ASYNCNESS POLARITY
2024-02-16 16:16:37 +00:00
bors
25d12673db Auto merge of #16586 - Veykril:crate-graph-side-table, r=Veykril
fix: Remove cargo knowledge from `CrateData`

Fixes https://github.com/rust-lang/rust-analyzer/issues/16170, Fixes https://github.com/rust-lang/rust-analyzer/issues/15656
2024-02-16 16:04:14 +00:00
Michael Goulet
3e4deab3d8 Add support for const and async trait bounds 2024-02-16 16:00:04 +00:00
Lukas Wirth
ead369117a CrateOrigin::Local means local to the project workspace, not cargo workspace 2024-02-16 16:28:17 +01:00
bors
bb0f93a260 Auto merge of #16587 - LucasFA:update-actions, r=lnicola
ci: Update GitHub Actions and Node version

Use newer versions of actions; Node 16 -> 18

Fix several warnings in the actions tab regarding usage of the EOL Node 16
2024-02-16 15:03:52 +00:00
LucasFA
c8fd8a33d2
Update GitHub actions dependencies
Use newer versions of actions, Node 16 -> 18

Fixes several warnings in the actions tab regarding usage of Node 16
2024-02-16 15:58:10 +01:00
Lukas Wirth
0ccb3b8731 Move dedup-dev-deps tests into rust-analyzer crate 2024-02-16 15:47:40 +01:00
Lukas Wirth
b1404d387a fix: Split toolchain and datalayout out of CrateData 2024-02-16 14:48:25 +01:00
bors
890666167b Auto merge of #16585 - lnicola:bump-checkout, r=lnicola
internal: bump `actions/checkout` to v4

Silences more Node version warnings.
2024-02-16 12:31:18 +00:00
Laurențiu Nicola
ed425f8700 Bump actions/checkout to v4 2024-02-16 14:23:10 +02:00
bors
c864953c0f Auto merge of #16583 - Veykril:unknown-mismatch, r=Veykril
fix: Don't show type mismatches for `{unknown}` to non-`{unknown}` mismatches

Fixes https://github.com/rust-lang/rust-analyzer/issues/15704

Basically we zip the two types, inspecting their substitutions if the constructors are the same, if we encounter a zip step with an `{unknown}` on one side and a non-`{unknown}` on the other we error out and discard the diagnostic. Otherwise we keep it.
2024-02-16 12:01:33 +00:00
Lukas Wirth
fd652ceb73 fix: Don't show type mismatches for {unknown} to non-{unknown} mismatches 2024-02-16 12:16:43 +01:00
bors
a01655552d Auto merge of #16582 - Veykril:find-path-length, r=Veykril
fix: Respect textual length of paths in find-path

Fixes https://github.com/rust-lang/rust-analyzer/issues/16572
2024-02-16 09:58:11 +00:00
Lukas Wirth
c00c9ee959 fix: Respect textual length of paths in find-path 2024-02-16 10:54:54 +01:00
bors
5261fb2354 Auto merge of #16576 - michel-slm:add-lsp-server-license, r=Veykril
lsp-server: add license files

The `lsp-server` crate is currently published without license files, which is needed when packaging in Linux distributions.

Symlink the files from the repository root so they are kept in sync.

Test showing the files get picked up by `cargo package`:
```
michel in rust-analyzer/lib/lsp-server on  add-lsp-server-license [+] is 📦 v0.7.6 via 🐍 v3.12.1 (.venv311) via 🦀 v1.76.0
⬢ [fedora:39] ❯ cargo package --allow-dirty --no-verify
    Updating crates.io index
   Packaging lsp-server v0.7.6 (/home/michel/src/github/rust-lang/rust-analyzer/lib/lsp-server)
    Updating crates.io index
    Packaged 12 files, 59.6KiB (16.3KiB compressed)

michel in rust-analyzer/lib/lsp-server on  add-lsp-server-license [+] is 📦 v0.7.6 via 🐍 v3.12.1 (.venv311) via 🦀 v1.76.0
⬢ [fedora:39] ❯ tar tf ../../target/package/lsp-server-0.7.6.crate | grep LICENSE
lsp-server-0.7.6/LICENSE-APACHE
lsp-server-0.7.6/LICENSE-MIT
```
2024-02-16 09:10:35 +00:00
bors
8a0a09a368 Auto merge of #16577 - DropDemBits:structured-snippet-migrate-7, r=Veykril
internal: Migrate assists to the structured snippet API, part 7/7

Continuing from #16467

Migrates the following assists:

- `generate_trait_from_impl`

This adds `add_placeholder_snippet_group`, which adds a group of placeholder snippets which are linked together and allows for renaming generated items without going through a separate rename step.

This also removes the last usages of `SourceChangeBuilder::{insert,replace}_snippet`, as all assists have finally been migrated to the structured snippet versions of those methods.
2024-02-16 08:49:43 +00:00
DropDemBits
e8457bb78b
Escape { and } as well
These are used in placeholder snippets, which may occur elsewhere in the insert text.
2024-02-16 00:28:02 -05:00
DropDemBits
1d8ed3408e
Escape snippet bits in-between placing snippets
Done so that we don't shift the range that we insert the snippet at.
2024-02-16 00:28:02 -05:00
DropDemBits
1aeec93412
Only use snippet_text_edit to make snippet SnippetTextEdits
The eventual LSP representation looks like it will diverge from RA's representation of `SnippetTextEdit`s, so this'll make it easier to transition to the LSP representation later.
2024-02-16 00:28:02 -05:00
DropDemBits
e4a3cc34d5
Add better snippet bits test 2024-02-16 00:28:01 -05:00
DropDemBits
e9efb568f6
Add dos line ending test 2024-02-16 00:28:01 -05:00
DropDemBits
4af075dcda
Remove SourceChangeBuilder::{insert,remove}_snippet
All assists have been migrated to use the structured snippet versions of these methods.
2024-02-15 21:34:29 -05:00
DropDemBits
eb6d6ba17c
Migrate generate_trait_from_impl to mutable ast 2024-02-15 21:34:29 -05:00
DropDemBits
115646d7d5
Align set_visibility with the rest of the set_ edit-in-place methods 2024-02-15 20:40:14 -05:00
DropDemBits
581d457e13
Add add_placeholder_snippet_group
Used for allowing newly generated syntax constructs to be renamed without having to go through a separate rename step.
2024-02-15 20:24:31 -05:00
Michel Lind
fafb16b052
lsp-server: add license files
The `lsp-server` crate is currently published without license files, which is
needed when packaging in Linux distributions.

Symlink the files from the repository root so they are kept in sync.

Test showing the files get picked up by `cargo package`:
```
michel in rust-analyzer/lib/lsp-server on  add-lsp-server-license [+] is 📦 v0.7.6 via 🐍 v3.12.1 (.venv311) via 🦀 v1.76.0
⬢ [fedora:39] ❯ cargo package --allow-dirty --no-verify
    Updating crates.io index
   Packaging lsp-server v0.7.6 (/home/michel/src/github/rust-lang/rust-analyzer/lib/lsp-server)
    Updating crates.io index
    Packaged 12 files, 59.6KiB (16.3KiB compressed)

michel in rust-analyzer/lib/lsp-server on  add-lsp-server-license [+] is 📦 v0.7.6 via 🐍 v3.12.1 (.venv311) via 🦀 v1.76.0
⬢ [fedora:39] ❯ tar tf ../../target/package/lsp-server-0.7.6.crate | grep LICENSE
lsp-server-0.7.6/LICENSE-APACHE
lsp-server-0.7.6/LICENSE-MIT
```

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
2024-02-15 18:01:36 -06: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
DropDemBits
d846586bc9
fix: Support multiple tab stops in completions in VSCode
Uses the native VSCode support for `SnippetTextEdit`s, but in a semi-hacky way as it's not fully supported yet.
2024-02-15 18:13:04 -05:00
bors
b9b0d29b8e Auto merge of #16574 - davidsemakula:needless-return-fix, r=Veykril
fix: Fix "needless return" diagnostic for trailing item declarations

Fixes #16566
2024-02-15 17:36:17 +00:00
davidsemakula
9ae0f924dd fix "needless return" for trailing item declarations 2024-02-15 20:07:58 +03:00
bors
b30b77d373 Auto merge of #16573 - Veykril:salsa-doc-tests, r=Veykril
internal: Remove salsa doc compile tests

These don't play well with the github CI error annotations
2024-02-15 16:29:39 +00:00
Lukas Wirth
1443d49b72 Remove salsa doc compile tests 2024-02-15 17:28:24 +01:00
bors
db277c7bb3 Auto merge of #16569 - DropDemBits:structured-snippet-fix-adjust-snippet-ranges, r=Veykril
fix: Place snippets correctly in multi-edit assists

Fixes #16539
2024-02-15 15:54:23 +00:00
bors
8443305015 Auto merge of #16559 - Wilfred:scip_documentation_field, r=lnicola
Set documentation field in SCIP from doc comment

Previously, the documentation field was the same as the text shown to users when they hover over that symbol. The documentation should really just be the doc comment, and as of #16179 the signature is already stored in the signatureDocumentation field.
2024-02-15 09:07:29 +00:00