Commit Graph

25966 Commits

Author SHA1 Message Date
Lukas Wirth
53b292478d internal: Add offset param to token descending API 2023-08-16 10:07:18 +02:00
bors
b14770934a Auto merge of #15463 - ponyii:fix/start-hovering-default-values-of-generic-const, r=HKalbasi
fix: start hovering default values of generic constants

It's just a kind of a postscriptum for [my last PR](https://github.com/rust-lang/rust-analyzer/pull/15179) adding default values of const generics to `hir::ConstParamData`. Here I patch other pieces of code which used to ignore const default values and which I managed to find (you're welcome to show me more)
2023-08-15 20:34:48 +00:00
ponyii
fec5ff9890 start hovering default values of generic constants 2023-08-15 20:26:42 +04:00
bors
54c4125086 Auto merge of #15461 - lnicola:analysis-stats-memory, r=Veykril
internal: Always collect memory usage info in analysis-stats
2023-08-15 16:20:24 +00:00
Laurențiu Nicola
4c67becd44 Always collect memory usage info in analysis-stats 2023-08-15 18:22:37 +03:00
bors
d548146c30 Auto merge of #15420 - Wilfred:discover_command_max_buffer, r=Veykril
Increase the buffer size for discover project command

The default value for maxBuffer is 1 MiB[1]. If the discover project command returns stdout or stderr that is greater than 1 MiB, the extension would error with "RangeError: stderr maxBuffer length exceeded".

Set the default value for maxBuffer to 10 MiB for project discovery.

[1] https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback
2023-08-15 12:13:12 +00:00
bors
ef2ee59631 Auto merge of #15446 - Veykril:checkOnSaveToggle, r=Veykril
Add status bar button to toggle check on save state

Closes https://github.com/rust-lang/rust-analyzer/issues/15440
cc https://github.com/rust-lang/rust-analyzer/issues/13208
2023-08-15 11:38:44 +00:00
bors
b771de3fdc Auto merge of #15179 - ponyii:fix/default-values-of-const-params-are-ignored, r=HKalbasi
the "add missing members" assists: implemented substitution of default values of const params

To achieve this, I've made `hir::ConstParamData` store the default values
2023-08-15 10:17:43 +00:00
Lukas Wirth
e76d20e072 Add status bar button to toggle check on save state 2023-08-15 11:39:53 +02:00
bors
7ca45dcf04 Auto merge of #15410 - alibektas:15240/invalid-demorgan, r=Veykril
internal : rewrite DeMorgan assist

fixes #15239 , #15240 . This PR is a rewrite of the DeMorgan assist that essentially rids of all the string manipulation and modifies syntax trees to apply demorgan on a binary expr. The main reason for the rewrite is that I wanted to use `Expr::needs_parens_in` method to see if the expr on which the assist is applied would still need the parens it had once the parent expression's operator had equal precedence with that of the expression. I used `.clone_(subtree|for_update)` left and right and probably more than I should have, so I would also be happy to hear how I could have prevented redundant cloning.
2023-08-15 07:29:28 +00:00
bors
c18ce9a08b Auto merge of #15429 - alibektas:deunwrap/generate_delegate_methods, r=Veykril
minor : Deunwrap generate_delegate_methods

#15398 subtask 8
2023-08-15 07:15:25 +00:00
bors
0b2a241b57 Auto merge of #15426 - alibektas:deunwrap/convert_to_guarded_return, r=Veykril
minor : Deunwrap convert_to_guarded_return

Closes subtask 12 of #15398
2023-08-15 07:00:03 +00:00
bors
f73cd39f7b Auto merge of #15383 - max-heller:issue-12568, r=Veykril
Suggest type completions for type arguments and constant completions for constant arguments

When determining completions for generic arguments, suggest only types or only constants if the corresponding generic parameter is a type parameter or constant parameter.

Closes #12568
2023-08-15 06:39:50 +00:00
bors
0fa822dfe1 Auto merge of #15418 - oxalica:fix/sig-from-macro, r=Veykril
Fix signature help of methods from macros

Currently the receiver type is copied from AST instead re-formatting through `HirDisplay`. Macro generated functions seem to have no spaces and their signature help are rendered like `fn foo(&'amutself)` instead of `fn foo(&'a mut self)`.
2023-08-15 06:25:13 +00:00
bors
2fbe69d117 Auto merge of #15438 - Veykril:eager-parser-stuck, r=Veykril
fix: Fix parser being stuck in eager macro inputs

Fixes https://github.com/rust-lang/rust-analyzer/issues/15437
2023-08-12 14:30:38 +00:00
Lukas Wirth
9ac88d8d36 Fix parser being stuck in eager macro inputs 2023-08-12 08:27:27 +02:00
Lukas Wirth
33f9250d21 Pass server extraEnv to isValidExecutable 2023-08-12 07:10:20 +02:00
bors
6cf06c1675 Auto merge of #15445 - Veykril:worl-symbols-traits, r=Veykril
fix: Fix `only_types` config filtering out traits from world symbols

It is a bit confusing that this apparently did not filter every trait out though...

Closes https://github.com/rust-lang/rust-analyzer/issues/15444
Closes https://github.com/rust-lang/rust-analyzer/issues/15200
2023-08-12 04:55:17 +00:00
Lukas Wirth
d6d188fce2 fix: Fix only_types config filtering out traits from world symbols 2023-08-12 06:40:49 +02:00
bors
39ebc378c2 Auto merge of #15436 - Veykril:temp-alloc, r=Veykril
Preserve `resolve_obligations_as_possible` temporary allocation across calls

This saves ~20ms in the highlihting bench on my machine
```
  284ms - highlight
      150ms - infer:wait @ per_query_memory_usage
          150ms - infer_query
                0   - PerNs::filter_visibility (436 calls)
                0   - crate_def_map:wait (336 calls)
                2ms - deref_by_trait (909 calls)
                0   - generic_params_query (1 calls)
                0   - inherent_impls_in_block_query (1 calls)
              107ms - resolve_obligations_as_possible (17013 calls)
                0   - trait_solve::wait (1017 calls)
        0   - PerNs::filter_visibility (13 calls)
       17ms - Semantics::analyze_impl (19 calls)
        0   - SourceBinder::to_module_def (30 calls)
        0   - attrs_query (6 calls)
        0   - classify_lifetime (1 calls)
        0   - classify_lifetime_ref (4 calls)
       35ms - classify_name (28 calls)
       54ms - classify_name_ref (452 calls)
        0   - crate_def_map:wait (375 calls)
        7ms - descend_into_macros (776 calls)
        0   - generic_params_query (5 calls)
        0   - impl_data_with_diagnostics_query (1 calls)
       17ms - infer:wait (32 calls)
        0   - resolve_obligations_as_possible (1 calls)
        0   - source_file_to_def (1 calls)
        0   - trait_solve::wait (1 calls)
```
to
```

  256ms - highlight
      121ms - infer:wait @ per_query_memory_usage
          121ms - infer_query
                0   - PerNs::filter_visibility (436 calls)
                0   - crate_def_map:wait (336 calls)
                2ms - deref_by_trait (909 calls)
                0   - generic_params_query (1 calls)
                0   - inherent_impls_in_block_query (1 calls)
               81ms - resolve_obligations_as_possible (17013 calls)
                0   - trait_solve::wait (1017 calls)
        0   - PerNs::filter_visibility (13 calls)
       17ms - Semantics::analyze_impl (19 calls)
        0   - SourceBinder::to_module_def (30 calls)
        0   - attrs_query (6 calls)
        0   - classify_lifetime (1 calls)
        0   - classify_lifetime_ref (4 calls)
       35ms - classify_name (28 calls)
       56ms - classify_name_ref (452 calls)
        0   - crate_def_map:wait (375 calls)
        7ms - descend_into_macros (776 calls)
        0   - generic_params_query (5 calls)
        0   - impl_data_with_diagnostics_query (1 calls)
       16ms - infer:wait (32 calls)
        0   - resolve_obligations_as_possible (1 calls)
        0   - source_file_to_def (1 calls)
        0   - trait_solve::wait (1 calls)
```
2023-08-12 04:38:32 +00:00
Lukas Wirth
c1c8e787d2 Preserve resolve_obligations_as_possible temporary allocation across calls 2023-08-12 06:36:31 +02:00
bors
1fde334195 Auto merge of #15433 - alibektas:deunwrap/remove_unused_imports, r=lnicola
minor : Deunwrap remove_unused_imports

#15398 Subtask 3
2023-08-11 11:14:45 +00:00
bors
de28baf874 Auto merge of #15424 - lnicola:remove-remove-dbg-unwrap, r=lnicola
minor: Remove `unwrap` from `Remove dbg!`

Part of #15398.
2023-08-11 07:56:10 +00:00
Wilfred Hughes
0ef541e535 Increase the buffer size for discover project command
The default value for maxBuffer is 1 MiB[1]. If the discover project
command returns stdout or stderr that is greater than 1 MiB, the
extension would error with "RangeError: stderr maxBuffer length
exceeded".

Set the default value for maxBuffer to 10 MiB for project discovery.

[1] https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback
2023-08-10 12:28:50 -07:00
bors
1b678231d7 Auto merge of #15435 - Veykril:block-src, r=Veykril
Derive block attributes from block item tree
2023-08-10 18:24:21 +00:00
Lukas Wirth
9adff006e8 Simplify 2023-08-10 20:10:19 +02:00
Lukas Wirth
bfad781a77 Memoize block_item_tree_query 2023-08-10 19:24:39 +02:00
Lukas Wirth
fde2d9b47c Deduplicate FileId field in ModuleOrigin 2023-08-10 19:04:46 +02:00
Lukas Wirth
e5b23e3bc1 Derive block attributes from block item tree 2023-08-10 18:52:27 +02:00
Ali Bektas
423b00a83a Deunwrap remove_unused_imports 2023-08-10 01:22:26 +02:00
Ali Bektas
c81a0681a2 Deunwrap generate_delegate_methods 2023-08-09 23:42:52 +02:00
bors
05b0612051 Auto merge of #15428 - Veykril:lsp-types-pin, r=Veykril
Fix pinned version of lsp-types

lsp-types published a new patch version that breaks semver with the proposed feature set (this is intended and documented), we unfortunately forgot to specify the patch version for the pinned version so this breaks us.
2023-08-09 18:07:44 +00:00
Lukas Wirth
7e04142f25 Fix pinned version of lsp-types 2023-08-09 20:06:08 +02:00
Ali Bektas
ebf27058cd minor : Deunwrap convert_to_guarded_return 2023-08-09 17:17:43 +02:00
bors
b78d69c795 Auto merge of #15422 - Veykril:import-sources, r=Veykril
internal: Record import source IDs

cc https://github.com/rust-lang/rust-analyzer/issues/14079
2023-08-09 15:09:15 +00:00
Lukas Wirth
63aba76735 Remove unnecessary ItemTreeId field in ImportSource 2023-08-09 17:06:52 +02:00
Laurențiu Nicola
b658f9a954 Remove unwrap from Remove dbg 2023-08-09 17:54:34 +03:00
bors
b6ee96c3b5 Auto merge of #15423 - alibektas:deunwrap/convert_named_struct_to_tuple_struct, r=lnicola
internal : Deunwrap convert_named_struct_to_tuple_struct

Replaces `unwrap`s with `?` for the mentioned assist.
2023-08-09 14:52:09 +00:00
Ali Bektas
4e4dda5f59 Deunwrap convert_named_struct_to_tuple_struct 2023-08-09 16:40:23 +02:00
Lukas Wirth
c516dd51e9 Simplify 2023-08-09 15:54:10 +02:00
Lukas Wirth
992b928a93 Record import source IDs 2023-08-09 15:20:42 +02:00
bors
4bed01c36e Auto merge of #15421 - Veykril:workspace-loading, r=Veykril
internal: More error context when failing to invoke the rust toolchain
2023-08-09 12:10:21 +00:00
Lukas Wirth
18b24f60d0 More error context when failing to invoke the rust toolchain 2023-08-09 14:09:37 +02:00
Max Heller
fb98f522d2 fixme 2023-08-08 20:55:35 -04:00
Max Heller
400f618a5c convert TypeLocation::GenericArg to struct variant 2023-08-08 20:37:23 -04:00
Max Heller
0b57fa3931 test 2023-08-08 20:09:50 -04:00
Max Heller
a1d9e453b9 Apply suggestions from code review
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2023-08-08 20:05:24 -04:00
bors
fc2f90e0e5 Auto merge of #15419 - HKalbasi:mir, r=HKalbasi
Add mir lower support for tuple destructing assignment

And some other changes in mir eval
2023-08-08 21:02:57 +00:00
hkalbasi
021802c59c Support enum in memory map patch address 2023-08-09 00:27:23 +03:30
bors
ddbbd6a7e7 Auto merge of #15417 - lowr:patch/purge-generic-arg-data-in-expr, r=HKalbasi
internal: use `Cast::cast()` instead of explicit interning

I firmly believe that we should generally use `cast()` instead of interning `GenericArgData` to construct `GenericArg` because it's less verbose and more readable.
2023-08-08 19:27:18 +00:00