Commit Graph

2559 Commits

Author SHA1 Message Date
Lukas Wirth
597c293a69 Adjust package.json semantic highlighting items 2024-04-15 17:00:03 +02:00
Lukas Wirth
6b98e55dbb Add Static and Const highlighting token types 2024-04-15 16:54:17 +02:00
Lukas Wirth
a37c7208b0 internal: Remove unnecessay GlobalState::send_hint_refresh_query field 2024-04-15 11:05:09 +02: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
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
hkalbasi
964afc92c1 Run cargo test per workspace in the test explorer 2024-04-13 06:22:58 +03:30
bors
d9c29afaee Auto merge of #17023 - Veykril:cleanup, r=Veykril
internal: Some cleanup and perf
2024-04-06 13:06:11 +00:00
Lukas Wirth
a82e028e30 Cleanup util::Generics method names 2024-04-06 14:29:40 +02:00
bors
9cced6da93 Auto merge of #17016 - HKalbasi:test-explorer, r=HKalbasi
Apply cargo flags in test explorer

cc #16827
2024-04-05 00:06:41 +00:00
hkalbasi
eab385e1f6 Apply cargo flags in test explorer 2024-04-05 02:37:40 +03:30
Johannes Altmanninger
d24b0ba330 Fix off-by-one error converting to LSP UTF8 offsets with multi-byte char
On this file,

```rust
fn main() {
    let 된장 = 1;
}
```

when using `"positionEncodings":["utf-16"]` I get an "unused variable" diagnostic on the variable
name (codepoint offset range `8..10`). So far so good.

When using `positionEncodings":["utf-8"]`, I expect to get the equivalent range in bytes (LSP:
"Character offsets count UTF-8 code units (e.g bytes)."), which is `8..14`, because both
characters are 3 bytes in UTF-8.  However I actually get `10..14`.

Looks like this is because we accidentally treat a 1-based index as an offset value: when
converting from our internal char-indices to LSP byte offsets, we look at one character to many.
This causes wrong results if the extra character is a multi-byte one, such as when computing
the start coordinate of 된장.

Fix that by actually passing an offset. While at it, fix the variable name of the line number,
which is not an offset (yet).

Originally reported at https://github.com/kakoune-lsp/kakoune-lsp/issues/740
2024-04-03 14:46:51 +02:00
bors
3691380c35 Auto merge of #16920 - Veykril:clippy-lints, r=Veykril
internal: Fix new nightly clippy lints
2024-04-01 16:00:18 +00:00
Lukas Wirth
2ae3e57c26 Fix new clippy lints 2024-04-01 17:55:56 +02:00
Lukas Wirth
ff279f1e91 Fix allFeatures config docs 2024-04-01 14:16:36 +02:00
bors
a6ddf5fb80 Auto merge of #16961 - Wilfred:fix_crate_ids, r=Veykril
Fix crate IDs when multiple workspaces are loaded

Previously, we assumed that the crate numbers in a `rust-project.json` always matched the `CrateId` values in the crate graph. This isn't true when there are multiple workspaces, because the crate graphs are merged and the `CrateId` values in the merged graph are different.

This broke flycheck (see first commit), because we were unable to find the workspace when a file changed, so we every single flycheck, producing duplicate compilation errors.

Instead, use the crate root module path to look up the relevant flycheck. This makes `ProjectWorkspace::Json` consistenet with `ProjectWorkspace::Cargo`.

Also, define a separate JSON crate number type, to prevent bugs like this happening again.
2024-04-01 10:43:06 +00: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
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
Wilfred Hughes
5e370b1cb8 Use crate root to choose relevant workspace for flycheck 2024-03-27 10:33:20 -07:00
Alexis (Poliorcetics) Bourget
8f9a58c73d
fix: check for client support of relative glob patterns before using them 2024-03-27 03:21:34 +01: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
bors
0583aaa555 Auto merge of #16805 - dfireBird:lifetime_lowering, r=Veykril
feat: Implement resolving and lowering of Lifetimes (no inference yet)
2024-03-26 07:58:43 +00:00
bors
e52bb8cddb Auto merge of #16906 - Young-Flash:limit_struct_hover_display, r=Veykril
feat: limit struct hover display nums

follow up https://github.com/rust-lang/rust-analyzer/pull/15847, https://github.com/rust-lang/rust-analyzer/pull/15938
2024-03-25 22:13:59 +00:00
Young-Flash
d81148a009 expose config for hover struct field display 2024-03-25 19:55:19 +08:00
Laurențiu Nicola
84d38c7e94 Move xtask flags around outide the generated section 2024-03-23 11:35:32 +02:00
Lukas Wirth
8e324e98a1 Rename ProcMacroKind::FuncLike to Bang 2024-03-22 11:20:56 +01:00
Lukas Wirth
fe28e470cd Use relative glob patterns in DidChangeWatchedFilesRegistrationOptions 2024-03-21 21:27:34 +01:00
Lukas Wirth
23613a9de7 fix: Some file watching related vfs fixes 2024-03-21 21:22:19 +01:00
Lukas Wirth
cd8eb0fe6d internal: Remove span trait 2024-03-21 20:08:30 +01:00
bors
6fce1d71df Auto merge of #16892 - Veykril:crate-graph-non-eager, r=Veykril
internal: Don't eagerly try to read crate root file contents before VFS

Fixes https://github.com/rust-lang/rust-analyzer/issues/8623
2024-03-19 15:36:26 +00:00
Lukas Wirth
7b91d01360 internal: Don't eagerly try to read crate root file contents before VFS 2024-03-19 16:12:56 +01:00
bors
4e54b4bd6c Auto merge of #16889 - Veykril:utf8-path, r=Veykril
internal: Enforce utf8 paths

Cargo already requires this, and I highly doubt r-a works with non-utf8 paths generally either. This just makes dealing with paths a lot easier.
2024-03-19 14:57:18 +00:00
Lukas Wirth
399dbc074b internal: Enforce utf8 paths 2024-03-19 15:39:00 +01:00
Lukas Wirth
232125be12 minor: Do progress reporting for crate-graph construction 2024-03-19 10:06:51 +01:00
hkalbasi
92300e8f86 Use --workspace and --no-fail-fast in test explorer 2024-03-19 01:46:41 +03:30
dfireBird
8d08b337fa
include lifetime in the filter for data layout in analysis-stats
clippy fixes
2024-03-18 17:18:08 +05:30
bors
7c2bb75bc8 Auto merge of #16860 - Veykril:macarons, r=Veykril
feat: Syntax highlighting improvements

Specifically
- Adds a new `constant` modifier, attached to keyword `const` (except for `*const ()` and `&raw const ()`), `const` items and `const` functions
- Adds (or rather reveals) `associated` modifier for associated items
- Fixes usage of the standard `static` modifier, now it acts like `associated` except being omitted for methods.
- Splits `SymbolKind::Function` into `Function` and `Method`. We already split other things like that (notable self param from params), so the split makes sense in general as a lot special cases around it anyways.
2024-03-18 09:14:08 +00:00
Lukas Wirth
4a93368590 Use a hash to find the correct inlay hint when resolving 2024-03-18 09:51:51 +01:00
Lukas Wirth
3115fd8b41 Simplify inlay hints needs_resolve 2024-03-18 09:50:27 +01:00
Matthias Krüger
2a8edaa14d remove redundant clone()s 2024-03-17 14:06:21 +01:00
Lukas Wirth
640c8b722e Move custom async modifier to standard one 2024-03-17 11:10:29 +01:00
Lukas Wirth
23fff55f0c Split SymbolKind::Function into Function and Method 2024-03-17 11:07:22 +01:00
Lukas Wirth
c8f6655327 Don't emit modifiers depending on the symbol kind in lsp conversion layer 2024-03-17 10:40:32 +01:00
Lukas Wirth
66adc1cc94 Emit Const modifier in syntax highlighting for const-like things 2024-03-17 10:35:33 +01:00
hkalbasi
dcfc9ccace Distinguish integration tests from crates in test explorer 2024-03-15 17:16:28 +03:30
hkalbasi
eeff20d172 Show compilation progress in test explorer 2024-03-15 16:28:59 +03:30
Lukas Wirth
c50c4f8bbb internal: Use assoc items as anchors for spans 2024-03-15 09:28:39 +01:00