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
bors
f40c7d8a9c
Auto merge of #16822 - Veykril:inlays, r=Veykril
...
fix: Make inlay hint resolving work better for inlays targetting the same position
2024-03-18 09:00:59 +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
bors
a71a0328d8
Auto merge of #16830 - Jesse-Bakker:fix-ty-panic, r=ShoyuVanilla
...
Fix panic with impl trait associated types in where clause
Not sure if this is the correct fix, but the tests are green :')
Fixes #16823
2024-03-18 08:35:53 +00:00
Lukas Wirth
4b679f90dd
Generate AST in a more stable manner
2024-03-18 09:24:10 +01:00
bors
f07489ada9
Auto merge of #16868 - roife:fix-issue-16848, r=Veykril
...
fix: handle attributes when typing curly bracket
fix #16848 .
When inserting a `{`, if it is identified that the front part of `expr` is `attr`, we consider it as inserting `{}` around the entire `expr` (excluding the attr part).
2024-03-18 08:22:26 +00:00
bors
65c601fa42
Auto merge of #16863 - Nadrieril:update-pat-ana, r=Veykril
...
Bump dependencies and use in-tree `rustc_pattern_analysis`
One last `pattern_analysis` API change. I don't have any more planned! So we can now use the in-tree version when available.
2024-03-18 08:08:11 +00:00
roife
109344cfb7
fix: handle attributes when typing curly bracket
2024-03-18 13:29:14 +08:00
bors
b6d1887bc4
Auto merge of #16861 - Veykril:macro-diag-exceptions, r=Veykril
...
fix: Ignore some warnings if they originate from within macro expansions
These tend to be annoying noise as we can't handle `allow`s for them properly for the time being.
2024-03-17 20:41:40 +00:00
Lukas Wirth
bb541c38d3
fix: Ignore some warnings if they originate from within macro expansions
2024-03-17 21:30:56 +01:00
Nadrieril
8d59aaf735
Use in-tree rustc_pattern_analysis
2024-03-17 14:16:30 +01:00
Nadrieril
b99618c191
Bump dependencies
2024-03-17 14:11:44 +01:00
Matthias Krüger
2a8edaa14d
remove redundant clone()s
2024-03-17 14:06:21 +01:00
Lukas Wirth
20d521db74
Adjust benchmark_syntax_highlighting_parser
for changes
2024-03-17 11:38:10 +01:00
Lukas Wirth
77607ab99a
More precise highlighting rules for constant modifier
2024-03-17 11:26:05 +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
bors
5ecace48f6
Auto merge of #16846 - roife:fix-issue16826, r=Veykril
...
fix: incorrect handling of `use` and panic issue in `extract_module`.
fix #16826
This PR includes the following changes:
1. Simplify the implementation partially, removing many unnecessary loops and `clone()`.
2. When it is found that the top level of the selection contains a `use` statement, a copy of the `use` will be reinserted before extraction. (#16826 )
3. Fixed an issue during `extract_module`, where if the top level of the selected part contains `A` and `use A::B`, it caused a duplication of `use A`.
2024-03-16 17:35:49 +00:00
bors
b94c2852fa
Auto merge of #16856 - Veykril:macarons, r=Veykril
...
fix: Fix wrong where clause rendering on hover
We were not accounting for proper newline indentation in some places making the hover look weird (or just straight up wrong for type aliases)
2024-03-16 17:23:02 +00:00
Lukas Wirth
d69a81fddb
fix: Fix wrong where clause rendering on hover
2024-03-16 17:49:59 +01:00
Shoyu Vanilla
fc53c59388
fix: typo
2024-03-16 03:53:55 +09:00
Shoyu Vanilla
d2aba91a0c
feat: Implement ATPIT
2024-03-16 03:31:12 +09:00
hkalbasi
dcfc9ccace
Distinguish integration tests from crates in test explorer
2024-03-15 17:16:28 +03:30
bors
f9a4d05195
Auto merge of #16845 - HKalbasi:test-explorer, r=HKalbasi
...
Show compilation progress in test explorer
Fix part of #16827
2024-03-15 13:15:35 +00:00
roife
10aa999c74
fix: typo
2024-03-15 21:14:17 +08:00
roife
d40c0fe48b
test: add test for extract_module
2024-03-15 21:05:04 +08:00
roife
513c6d35ed
fix: re-insert use stmts that is extracted
2024-03-15 21:04:51 +08:00
hkalbasi
eeff20d172
Show compilation progress in test explorer
2024-03-15 16:28:59 +03:30
Lukas Wirth
0dd89d7ee7
Remove usages of SpanData where Span suffices
2024-03-15 13:02:40 +01:00
roife
de716058c9
fix: remove useless loop
2024-03-15 19:54:58 +08:00
Lukas Wirth
b59c8c76db
Repalce Span with SyntaxContextId in MacroCallLoc
2024-03-15 12:47:05 +01:00
Lukas Wirth
08327e0e5d
Drop eager macro parse errors, they can't crop up
2024-03-15 11:45:51 +01:00
Lukas Wirth
3b1ad2379d
internal: Make def site span for proc-macro more invalidation resistant
2024-03-15 10:14:00 +01:00
Lukas Wirth
c50c4f8bbb
internal: Use assoc items as anchors for spans
2024-03-15 09:28:39 +01:00
roife
5b2809f329
fix: simplification on extract_module
2024-03-15 14:24:16 +08:00
Lukas Wirth
d085ade631
Remove dead test code
2024-03-14 16:24:51 +01:00
Lukas Wirth
d2f8eae2ec
feat: Support macro calls in eager macros for IDE features
2024-03-14 15:40:35 +01:00
roife
6248b45340
fix: do not add use stmt when use stmt is selected in extract_module
2024-03-14 19:50:36 +08:00
roife
02214a6d12
fix: remove redundant use node insertion
2024-03-14 19:37:52 +08:00
roife
418056597b
fix: donot generate redundant use stmt for items in selection in extract_module
2024-03-14 15:18:31 +08:00
roife
9c8a57ed08
fix: simplify extract_module
2024-03-14 15:04:17 +08:00
Lukas Wirth
9767156a29
Simplify
2024-03-13 20:02:21 +01:00
Lukas Wirth
abe3177445
Shrink MacroCallLoc
2024-03-13 18:05:27 +01:00
Jesse Bakker
95828850b2
Fix panic with impl trait associated types in where clause
2024-03-13 18:02:15 +01:00
Lukas Wirth
87e0bbc534
Stronger typing for macro_arg query
2024-03-13 17:42:01 +01:00
Wilfred Hughes
30d3d68044
Fix unwanted leading whitespace in hover text
...
PR #16366 moved layout information to a separate line, so the
leading whitespace is no longer necessary.
2024-03-12 12:27:57 -07:00
bors
a2e274142f
Auto merge of #16819 - Veykril:span-upmapping, r=Veykril
...
internal: Improve rooted upmapping
cc https://github.com/rust-lang/rust-analyzer/issues/16235
2024-03-12 12:58:52 +00:00
Lukas Wirth
9ba4493918
internal: Improve rooted upmapping
2024-03-12 13:46:58 +01:00
bors
d3e6fea315
Auto merge of #16789 - wyatt-herkamp:cfg_attr, r=Veykril
...
cfg Attribute Stripping for Proc Macro Expansion
This will attempt to process cfg attributes and cfg_attr attributes for proc macro expansion.
![image](https://github.com/rust-lang/rust-analyzer/assets/11785959/b85ef203-14a5-44c9-9b67-59a65a5f2d96 )
Closes #8434 , #11657 , and #13904
2024-03-12 10:19:19 +00:00
Wyatt Herkamp
447de3d788
Review Updates and added tests.
2024-03-11 11:05:59 -04:00
Lukas Wirth
fdc527f096
fix: Fix method resolution snapshotting receiver_ty too early
2024-03-11 15:35:06 +01:00
bors
8f8bcfc131
Auto merge of #16335 - lnicola:salsa-lz4-file-text, r=Veykril
...
internal: Compress file text using LZ4
I haven't tested properly, but this roughly looks like:
```
1246 MB
59mb 4899 FileTextQuery
1008 MB
20mb 4899 CompressedFileTextQuery
555kb 1790 FileTextQuery
```
We might want to test on something more interesting, like `bevy`.
2024-03-11 13:43:33 +00:00
bors
2f872156fe
Auto merge of #16808 - ShoyuVanilla:proc-macro-sem-token, r=Veykril
...
feat: Add proc macro semantic token type
Closes #11529
2024-03-11 13:20:29 +00:00
Shoyu Vanilla
fc11216ad5
feat: Add proc macro semantic token type
2024-03-11 22:14:59 +09:00
bors
40ee359046
Auto merge of #16810 - Young-Flash:unused_var_fix, r=Veykril
...
feat: add fix for unused_variables
add a leading underscore for unused variable
2024-03-11 13:01:50 +00:00
bors
2320e12541
Auto merge of #16771 - Veykril:self-param-split, r=Veykril
...
internal: Don't desugar self param into a pattern
Small experiment to see if this simplifies things
2024-03-11 12:45:46 +00:00
Young-Flash
562f4a2688
test: update test for unused_variables
2024-03-11 19:36:53 +08:00
Young-Flash
77136575da
feat: add fix for unused_variables
2024-03-11 19:36:53 +08:00
Wyatt Herkamp
0fb5d0d918
Check for cfg_attr on the actual item and Debug instead of info in cfg_process
2024-03-11 06:55:04 -04:00
bors
a0dd822972
Auto merge of #16473 - SomeoneToIgnore:kb/remove-resolve-stub, r=Veykril
...
Stop eagerly resolving inlay hint text edits for VSCode
Send less json over the wire.
After https://github.com/microsoft/vscode/issues/193124 was fixed, this change is not needed anymore.
VSCode 1.86.0 now supports double click for unresolved hint data too.
2024-03-11 09:44:02 +00:00
bors
a58f574816
Auto merge of #16762 - wyatt-herkamp:master, r=Veykril
...
Added QuickFix for unresolved field.
Adds an AssistKind::QuickFix for unresolved field.
Currently, Snippets are not available for Diagnostics. So the type defaults to the Unit type if the type is not able to be inferred.
https://github.com/rust-lang/rust-analyzer/assets/11785959/bd4c67bd-f8cb-4254-9a87-641ae80a7a28
Closes https://github.com/rust-lang/rust-analyzer/issues/4563
2024-03-11 09:31:22 +00:00
Lukas Wirth
0dbaccd484
Track vscode version for conditional bug server sided bugfixes
2024-03-11 10:31:06 +01:00
Kirill Bulatov
57a0ad4343
Stop eagerly resolving inlay hint text edits for VSCode
...
After https://github.com/microsoft/vscode/issues/193124 was fixed,
this change is not needed anymore.
2024-03-11 10:22:02 +01:00
bors
a5035f4931
Auto merge of #16749 - Veykril:on-demand-validation-err, r=Veykril
...
internal: Some method resolution cleanups
2024-03-11 09:18:24 +00:00
bors
1069f57d8b
Auto merge of #16784 - Veykril:body-invalid, r=Veykril
...
internal: Remove synstructure const hack support
The latest version of it no longer emits these
2024-03-11 09:05:26 +00:00
Lukas Wirth
c679482d7e
Add method resolution deref inference var test
2024-03-11 10:02:03 +01:00
Lukas Wirth
458f4a2960
internal: Treat the self param as different from patterns when lowering
2024-03-11 09:46:28 +01:00
Lukas Wirth
558feeab61
internal: Remove synstructure const hack support
2024-03-11 09:44:40 +01:00
Laurențiu Nicola
f65fe4e281
Fix import
2024-03-11 09:31:02 +02:00
Laurențiu Nicola
ce642071d8
Bring back in-rust-tree feature to ide
2024-03-10 11:08:11 +02:00
Laurențiu Nicola
aa74d57825
Merge commit '574e23ec508064613783cba3d1833a95fd9a5080' into sync-from-ra
2024-03-10 08:47:38 +02:00
Laurențiu Nicola
717ba1d56a
Clippy fixes
2024-03-10 08:42:50 +02:00
Wyatt Herkamp
948a2dee09
Clippy Fix
2024-03-09 14:12:27 -05:00
Wyatt Herkamp
79f2651262
Add cfg_attr and cleanup code
2024-03-09 13:25:56 -05:00
Laurențiu Nicola
a12ccd5923
Fix test
2024-03-08 20:39:47 +02:00
Laurențiu Nicola
0f43b55e83
Stop using an Arc when setting the file text
2024-03-08 20:30:12 +02:00
Laurențiu Nicola
02b6c181dd
Compress file text using lz4 in salsa
2024-03-08 20:22:08 +02:00
Wyatt Herkamp
f45b080965
Starting Fix for cfg stripping
2024-03-08 11:10:29 -05:00
bors
2397e7a887
Auto merge of #16787 - pksunkara:remove-macro-call-check, r=lnicola
...
Remove unncessary check for macro call
Since `macro_rules` is a contextual keyword, it is an `IDENT` token and thus `is_path_start` already identifies it correctly. You can tell the previous check is unnecessary because the relevant tests still pass.
2024-03-08 13:23:31 +00:00
bors
2b7b44bf27
Auto merge of #16786 - pksunkara:improve-readability, r=lnicola
...
internal: Improve readability of the parser code
The code is basically equivalent to the previous version, but it improves the readability by making it much more simpler and concise.
2024-03-08 12:21:18 +00:00
Pavan Kumar Sunkara
a838e44032
Remove unncessary check for macro call
2024-03-08 12:03:35 +00:00
Pavan Kumar Sunkara
2a41b2cd94
Improve readability of the parser code
2024-03-08 12:00:24 +00:00
Pavan Kumar Sunkara
b37ccfce44
Remove unused keyword from visibility recovery
2024-03-08 11:53:03 +00:00
DropDemBits
bc381837e3
fix: Preserve $
and \
in postfix format completions
...
`parse_format_exprs` doesn't escape these two anymore, so they have to be escaped as a separate step.
2024-03-07 16:55:09 -05:00
DropDemBits
7dadc64d1c
minor: Update comments in format_string_exprs
...
`parse_format_exprs` no longer handles escaping `$` and `\`
2024-03-07 16:08:20 -05:00
bors
48cb059182
Auto merge of #16781 - DropDemBits:extract-format-args-escaping, r=Veykril
...
fix: Don't escape `\` and `$` in "Extract format expressions" assist
Fixes #16745
2024-03-07 20:04:33 +00:00
DropDemBits
1f37e5ac9a
fix: Don't escape \
and $
in "Extract format expressions" assist
2024-03-07 14:20:23 -05:00
Laurențiu Nicola
cd2347e132
Skip match diagnostics for partially unknown types
2024-03-07 19:11:23 +02:00
bors
bbb441ec6d
Auto merge of #16778 - Nadrieril:update-pat-ana, r=lnicola
...
Update `rustc_pattern_analysis` to 0.42.0
There was an important API change in 0.41.0, and (hopefully) a fix for https://github.com/rust-lang/rust-analyzer/issues/16774 in 0.42.0.
2024-03-07 16:22:26 +00:00
Nadrieril
e31484c108
Update the other crates too
2024-03-07 16:44:46 +01:00
Nadrieril
1b0b4220fd
Update rustc_pattern_analysis
to 0.42.0
2024-03-07 16:33:31 +01:00
bors
b1f6d56e44
Auto merge of #16777 - Veykril:body-invalid, r=Veykril
...
fix: Don't invalid body query results when generating desugared names
The hack remains until we get hygiene, but with this the generated names are stable across bodies
2024-03-07 14:21:26 +00:00
Lukas Wirth
09b9a921a8
fix: Don't invalid body query results when generating desugared names
2024-03-07 15:03:16 +01:00
bors
e101f24798
Auto merge of #16776 - Veykril:parse-macro-parse, r=Veykril
...
fix: Don't force draw a dependency edge to the real_span_map query
This can cause extra invalidations as like direct `AstIdMap` dependencies
2024-03-07 13:19:36 +00:00
Lukas Wirth
c04c0dd5ba
fix: Don't force draw a dependency edge to the real_span_map query
2024-03-07 14:14:59 +01:00
bors
0ffc1ef115
Auto merge of #16775 - Veykril:parse-macro-parse, r=Veykril
...
fix: Remove accidental dependency between `parse_macro_expansion` and `parse`
Turns out my idea from https://github.com/rust-lang/rust-analyzer/pull/15251 causes all builtin derive expansions to obviously rely on the main parse, meaning the entire `macro_arg` layer becomes kind of pointless. So this reverts that PR again.
2024-03-07 10:47:35 +00:00
bors
a1fda6476c
Auto merge of #16742 - alibektas:13529/source_root_tree, r=Veykril
...
internal: Implement parent-child relation for `SourceRoot`s
This commit adds the said relation by keeping a map of type `FxHashMap<SourceRootId,Option<SourceRootId>>` inside the `GlobalState`. Its primary use case is reading `rust-analyzer.toml`(#13529 ) files that can be placed in every local source root. As a config will be found by traversing this "tree" we need the parent information for every local source root. This commit omits defining this relation for library source roots entirely.
2024-03-07 10:30:08 +00:00