Commit Graph

28393 Commits

Author SHA1 Message Date
Lukas Wirth
6b98e55dbb Add Static and Const highlighting token types 2024-04-15 16:54:17 +02:00
Wyatt Herkamp
0faa2940c7 Use the text range for the name. Not the entire syntax in Unused Variable Diagnostic. 2024-04-15 10:46:21 -04:00
bors
af728741de Auto merge of #17073 - roife:better-inline-preview, r=Veykril
Better inline preview for postfix completion

Better inline preview for postfix completion, a proper implementation of c5686c8941.

Here editors may filter completion item with the text within `delete_range`, so we need to include the `receiver text` in the `lookup` (aka `FilterText` in LSP spec) for editors to find the completion item. (See https://github.com/rust-lang/rust-analyzer/issues/17036#issuecomment-2056614180, Thanks to [pascalkuthe](https://github.com/pascalkuthe))
2024-04-15 14:33:38 +00:00
davidsemakula
69fe457cb5 internal: simplify TokenSet implementation 2024-04-15 17:33:09 +03:00
roife
8db1c64268 tests: fix tests for postfix 2024-04-15 22:21:15 +08:00
roife
76a8a976f3 fix: better inline preview for postfix completion 2024-04-15 22:21:06 +08:00
bors
c0371309b4 Auto merge of #17072 - Veykril:hir-ty-display, r=Veykril
internal: Use `hir_fmt_args` everywhere in `hir_ty::display`
2024-04-15 14:19:04 +00:00
Lukas Wirth
91659da5a6 internal: Use hir_fmt_args everywhere in hir_ty::display 2024-04-15 16:17:29 +02:00
bors
2e7059ca58 Auto merge of #16877 - Veykril:stackoverflow, r=Veykril
fix: Fix `impl Trait<Self>` causing stackoverflows

Fixes https://github.com/rust-lang/rust-analyzer/issues/15646
2024-04-15 13:47:46 +00:00
Lukas Wirth
1915980031 fix: Fix impl Trait<Self> causing stackoverflows 2024-04-15 15:41:20 +02:00
bors
40bb8f3272 Auto merge of #16813 - wyatt-herkamp:to-from-cfg_attr-assist, r=Veykril
Wrap/Unwrap cfg_attr

https://github.com/rust-lang/rust-analyzer/assets/11785959/f5f1bb71-22e7-438b-9a22-65ebab1b362d

https://github.com/rust-lang/rust-analyzer/assets/11785959/36933a4e-0000-455a-abe3-af774cd854d0

## TODO
- [x] Add Tests
- [x] Wrap derive elements

Closes #13965
2024-04-15 12:56:55 +00:00
Lukas Wirth
60d3a7320e Differentiate between full configs and toml only config groupings 2024-04-15 14:16:43 +02:00
Ali Bektas
67d8d2d4a0 Make ConfigData Ser and TOML De
This commit makes rust-analyzer::config module TOML ser and de.

Co-Authored-By: Cormac Relf <web@cormacrelf.net>
2024-04-15 14:14:23 +02:00
davidsemakula
8e459125df internal: add auto-import assist tests for raw identifiers 2024-04-15 15:06:26 +03:00
davidsemakula
e326b634d1 internal: add reserved keywords 2024-04-15 15:06:26 +03:00
davidsemakula
89779ca55e internal: improve TokenSet implementation 2024-04-15 15:06:26 +03:00
bors
2cbc2841d8 Auto merge of #17070 - Veykril:simplify, r=Veykril
internal: Remove unnecessay `GlobalState::send_hint_refresh_query` field
2024-04-15 09:06:51 +00:00
Lukas Wirth
a37c7208b0 internal: Remove unnecessay GlobalState::send_hint_refresh_query field 2024-04-15 11:05:09 +02:00
bors
d80df712e7 Auto merge of #17069 - lnicola:fix-skip-array-dispatch, r=lnicola
minor: Fix `rustc_skip_array_during_method_dispatch` edition check

CC #16450
2024-04-15 05:56:22 +00:00
Laurențiu Nicola
f5e4eb2ef9 Fix rustc_skip_array_during_method_dispatch edition check 2024-04-15 08:54:07 +03:00
bors
5dbe3fe75c Auto merge of #17065 - Veykril:edition-parse-mac, r=Veykril
internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros

Follow up to https://github.com/rust-lang/rust-analyzer/pull/16450, cc https://github.com/rust-lang/rust-analyzer/issues/16324
2024-04-14 14:13:11 +00:00
Lukas Wirth
a483d3bc37 internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros 2024-04-14 16:02:38 +02:00
bors
74cef6d79b Auto merge of #16450 - Urhengulas:edition-aware-parser, r=Veykril
internal: Prepare parser interface for editions
2024-04-14 13:34:12 +00:00
Lukas Wirth
83370fe5d7 Use Edition::CURRENT 2024-04-14 15:30:29 +02:00
Lukas Wirth
9c75e9fa7d Deduplicate Edition enum 2024-04-14 15:29:01 +02:00
Johann Hemmann
e7852803c5 Mark edition field as unused 2024-04-14 15:11:38 +02:00
Johann Hemmann
2cf5d8811a Raise edition one more level 2024-04-14 15:11:33 +02:00
Johann Hemmann
454e481422 Add edition to all parse functions of the parser crate 2024-04-14 15:07:43 +02:00
Johann Hemmann
392538c830 Add edition to parser struct 2024-04-14 15:06:09 +02:00
bors
f3c7bd0c90 Auto merge of #17064 - Veykril:inlay-hints-fix, r=Veykril
minor: Carry inlay hint resolve hash as a string
2024-04-14 10:27:40 +00:00
Lukas Wirth
189aba7943 minor: Carry inlay hint resolve hash as a string 2024-04-14 10:55:20 +02:00
bors
7dad0a231e Auto merge of #17063 - Veykril:inlay-hints-fix, r=Veykril
fix: Fix inlay hint resolution being broken

So, things broke because we now store a hash (u64) in the resolution payload, but javascript and hence JSON only support integers of up to 53 bits (anything beyond gets truncated in various ways) which caused almost all hashes to always differ when resolving them. This masks the hash to 53 bits to work around that.

Fixes https://github.com/rust-lang/rust-analyzer/issues/16962
2024-04-14 06:28:40 +00:00
Lukas Wirth
2c5c12acfe fix: Fix inlay hint resolution being broken 2024-04-14 08:27:24 +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
bors
773b4a5ac7 Auto merge of #17019 - Wilfred:source_root_prefixes, r=Veykril
fix: VFS should not confuse paths with source roots that have the same prefix

Previously, the VFS would assign paths to the source root that had the longest string prefix match. This would break when we had source roots in subdirectories:

```
/foo
/foo/bar
```

Given a file `/foo/bar_baz.rs`, we would attribute it to the `/foo/bar` source root, which is wrong.

As a result, we would attribute paths to the wrong crate when a crate was in a subdirectory of another one. This is more common in larger monorepos, but could occur in any Rust project.

Fix this in the VFS, and add a test.
2024-04-13 20:30:08 +00:00
bors
9b1946250f Auto merge of #17054 - roife:fix-issue-17036, r=Veykril
Revert "fix: set the right postfix snippets competion source range"

This reverts commit c5686c8941.

Fix #17036. See https://github.com/rust-lang/rust-analyzer/issues/17036#issuecomment-2050185641
2024-04-13 19:34:45 +00:00
bors
e1d7ce71ae Auto merge of #17051 - roife:auto-closing-for-triple-backticks, r=Veykril
fix: support auto-closing for triple backticks

It might fix #16051, see https://github.com/rust-lang/rust-analyzer/issues/16051#issuecomment-2042606030
2024-04-13 19:22:03 +00:00
bors
85542e0de3 Auto merge of #17035 - Wilfred:windows_ci_on_prs, r=Veykril
Run Windows tests on PRs too

Previously PRs would only do a build on Windows, which confusingly meant that PRs got a green tick for Windows despite not testing them.

See discussion in #17019.
2024-04-13 19:07:13 +00:00
bors
a1884b0958 Auto merge of #17030 - Veykril:bump-chalk, r=Veykril
internal: Bump chalk

And make use of the new error lifetime
2024-04-13 18:54:17 +00:00
bors
0636e7c436 Auto merge of #17059 - Kohei316:refactor-generate-function, r=Veykril
internal: make function builder create ast directly

I am working on #17050.
In the process, I noticed a place in the code that could be refactored.
Currently, the `function builder` creates the `ast` through the `function template` , but those two processes can be combined into one function.
I thought I should work on this first and created a PR.
2024-04-13 18:41:27 +00:00
morine0122
145078e09f make function builder create ast directly 2024-04-13 20:16:12 +09:00
bors
07ae540f4e Auto merge of #17056 - HKalbasi:test-explorer, r=HKalbasi
Run cargo test per workspace in the test explorer

fix #16875
fix #17022
2024-04-13 03:27:47 +00:00
hkalbasi
964afc92c1 Run cargo test per workspace in the test explorer 2024-04-13 06:22:58 +03:30
roife
7528460151 Revert "fix: set the right postfix snippets competion source range"
This reverts commit c5686c8941.
2024-04-12 19:20:41 +08:00
roife
4346bbcd92 fix: support auto-closing for triple backticks 2024-04-11 18:46:22 +08:00
bors
657b33b0cb Auto merge of #17033 - ShoyuVanilla:flyck-log, r=Veykril
Log flycheck errors

Resolves #16969

The non-cargo messages are appended to the error strings here;

7a8374c162/crates/flycheck/src/lib.rs (L460-L482)

that one is formatted into `Err` here;

7a8374c162/crates/flycheck/src/command.rs (L144-L155)

and finally, this PR appends it at the end of existing Flycheck error message
2024-04-11 07:01:20 +00:00
bors
a5feb4f05f Auto merge of #17034 - ColinKinloch:flatpak_sdk_rust_enable, r=lnicola
Document enabling the flatpak rust SDK extension

Just having `org.freedesktop.Sdk.Extension.rust-stable` and `org.freedesktop.Sdk.Extension.llvm15` installed is not enough.
`/usr/lib/sdk/rust-stable/bin` at least needs to be added to the `PATH`.

In the case of VSCodium [ide-flatpak-wrapper](https://github.com/noonsleeper/ide-flatpak-wrapper) in included to do this.
2024-04-09 11:53:28 +00:00
Wilfred Hughes
b03844d786 [vfs] Don't confuse paths with source roots that have the same prefix 2024-04-08 15:48:04 -07:00
Wilfred Hughes
6df559f706 Run Windows tests on PRs too
Previously PRs would only do a build on Windows, which confusingly
meant that PRs got a green tick for Windows despite not testing them.

See discussion in #17019.
2024-04-08 11:36:09 -07:00