about summary refs log tree commit diff
path: root/crates
AgeCommit message (Collapse)AuthorLines
2022-07-20fix: Fix search for associated trait items being inconsistentLukas Wirth-43/+125
2022-07-20Auto merge of #12811 - TopGunSnake:12790, r=Veykrilbors-2/+188
fix: Insert `pub(crate)` after doc comments and attribute macros Fixes #12790 Original behavior was to insert `pub(crate)` at the `first_child_or_token`, which for an item with a comment or attribute macro, would put the visibility marker before the comment or macro, instead of after. This merge request alters the call to find the node with appropriate `SyntaxKind` in the `children_or_tokens`. It also adds a test case to the module to verify the behavior. Test case verifies function, module, records, enum, impl, trait, and type cases.
2022-07-20Fix generated `PartialEq::ne`Michael Chisolm-1/+33
2022-07-20Auto merge of #12800 - hi-rustin:rustin-patch-issue-12717, r=hi-rustinbors-2/+4
Find original as node before compute ref match part of https://github.com/rust-lang/rust-analyzer/issues/12717
2022-07-19Inverted the match logic to skip comments, attribute macros, and whitespace ↵TopGunSnake-13/+4
before the appropriate keywords.
2022-07-19Auto merge of #12789 - DorianListens:dscheidt/unused-param-overlapping, ↵bors-4/+37
r=DorianListens fix: Prevent panic in Remove Unused Parameter assist Instead of calling `builder.delete` for every text range we find with `process_usage`, we now ensure that the ranges do not overlap before removing them. If a range is fully contained by a prior one, it is dropped. fixes #12784
2022-07-19Upgrade to expect-test@1.4.0Amos Wenger-15/+15
cf. https://github.com/rust-analyzer/expect-test/issues/33 cf. https://github.com/rust-lang/rust/pull/99444#issuecomment-1188844202
2022-07-19Auto merge of #12809 - lnicola:empty-diagnostics, r=lnicolabors-8/+18
fix: Work around Code bug with empty diagnostics Closes #11404
2022-07-19Work around Code bug with empty diagnosticsLaurențiu Nicola-8/+18
2022-07-18Added case for constTopGunSnake-1/+8
2022-07-18Cleaned up trailing whitespace for tidy::files_are_tidyTopGunSnake-24/+24
2022-07-18Added coverage for trait, mod, impl, and enum cases.TopGunSnake-3/+49
2022-07-18Add test case and token finder to address 12790TopGunSnake-2/+144
2022-07-18Auto merge of #12796 - mmirate:patch-1, r=Veykrilbors-7/+7
chore: change str_ref_to_string to str_ref_to_owned `ToString` is implemented by many different types than `&str`, and represents a serialization into string data. The fact that said data is returned as owned, is an implementation detail resulting from the lack of a parameter for a pre-allocated buffer. If merely copying borrowed string data to owned string data is all that is desired, `ToOwned` is a much better choice, because if the user later refactors the code such that the input is no longer an `&str`, then they will get a compiler error instead of a mysterious runtime-behavioral change.
2022-07-18fix: Prevent panic in Remove Unused Parameter assistDorian Scheidt-4/+37
Instead of calling `builder.delete` for every text range we find with `process_usage`, we now ensure that the ranges do not overlap before removing them. If a range is fully contained by a prior one, it is dropped. fixes #12784
2022-07-18Auto merge of #12807 - Veykril:completion-item-details, r=Veykrilbors-11/+38
Add simple support for completion item details Supercedes https://github.com/rust-lang/rust-analyzer/pull/9891 This doesn't yet really implement anything new, it just adds the scaffolding for the protocol conversion
2022-07-18Add simple support for completion item detailsLukas Wirth-11/+38
2022-07-18Auto merge of #12804 - jonas-schievink:config-watcher, r=Veykrilbors-8/+23
fix: make file watcher config a drop-down (and clarify the options) Fixes https://github.com/rust-lang/rust-analyzer/issues/12794 Also renames "notify" to "server", since that's clearer ("notify" is still accepted for compatibility).
2022-07-18Auto merge of #12549 - bitgaoshu:goto_where_trait_m_impl, r=Veykrilbors-130/+419
feat: Go to implementation of trait methods try goto where the trait method implies, #4558
2022-07-18Move `convert_to_def_in_trait` into `ide-db`Lukas Wirth-47/+30
2022-07-18Improve file watcher configJonas Schievink-8/+23
2022-07-18Remove macro ABI version from doc commentJonas Schievink-1/+1
It's hard to remember to keep this in sync, but since the file path already contains the version, this comment is pretty unnecessary.
2022-07-18Find original as node before compute ref matchhi-rustin-2/+4
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-07-18Remove outdated proc macro ABIsJonas Schievink-16176/+16
2022-07-18Auto merge of #12788 - hasali19:extract-var-mut, r=jonas-schievinkbors-5/+31
Fix extract variable assist for subexpression in mutable borrow This checks if the expression is in a mutable borrow and if so makes the extracted variable `mut`. Closes #12786
2022-07-18chore: change str_ref_to_string to str_ref_to_ownedMilo Mirate-7/+7
ToString is implemented by many different types than &str, and represents a serialization into string data. The fact that said data is returned as owned, is an implementation detail. If merely copying borrowed string data to owned string data is all that is desired, ToOwned is a much better choice, because if the user later refactors the code such that the input is no longer an `&str`, then they will get a compiler error instead of a mysterious change-in-behavior.
2022-07-18Support the 1.64 nightly proc macro ABIJonas Schievink-1/+4443
2022-07-18fix: “Generate constant” ignores the path prefix of the identifierharpsword-15/+151
2022-07-17Fix extract variable assist for subexpression in mutable borrowHasan Ali-5/+31
2022-07-17fix: un-inline `ConstScalarOrPath::from_expr_opt`Artur Sinila-4/+2
2022-07-17Auto merge of #12778 - Logarithmus:feature/fix-negative-const-generics, ↵bors-85/+217
r=flodiebold Support negative, `char` & `bool` const generics Before: ![Before](https://user-images.githubusercontent.com/29541480/179379832-0c3b2a74-fef6-427e-b89f-7e31d9c37b3d.png) After: ![After](https://user-images.githubusercontent.com/29541480/179379863-b62475dd-e7bf-41f2-b437-08dfe55951af.png) I tried to implement stuff like `Const<{NUM1 + 3 + NUM2}>` by using already existing constant evaluation mechanism for ordinary constants, but turned out to be harder than I thought, maybe because I've never ever tinkered with compilers before
2022-07-17fix: address suggestionsArtur Sinila-53/+72
2022-07-17refactor: inline some variablesArtur Sinila-4/+2
2022-07-17Check for local IDs belong to same definitioniDawer-2/+42
2022-07-17feat: support negative const generic parametersArtur Sinila-125/+140
* feat: support `bool` & `char` const generics
2022-07-17tests: add hover tests for const genericsArtur Sinila-0/+100
2022-07-16Auto merge of #12689 - Veykril:macro-rec, r=Veykrilbors-27/+57
internal: Record all macro definitions in ItemScope Fixes https://github.com/rust-lang/rust-analyzer/issues/12100 Doesn't resolve the shadowing issues though, fixing those is gonna be really tricky I believe unless we can come up with a nice scheme to "order" item tree items (using syntax ranges and file ids would be a pain and also a bad idea since that'll require us to potentially reparse files in collection).
2022-07-16Auto merge of #12539 - soruh:instanciate_empty_structs, r=Veykrilbors-4/+287
Automatically instaciate trivially instaciable structs in "Generate new" and "Fill struct fields" As proposed in #12535 this PR changes the "Generate new" and "Fill struct fields" assist/diagnostic to instanciate structs with no fields and enums with a single empty variant. For example: ```rust pub enum Bar { Bar {}, } struct Foo<T> { a: usize, bar: Bar, _phantom: std::marker::PhantomData<T>, } impl<T> Foo<T> { /* generate new */ fn random() -> Self { Self { /* Fill struct fields */ } } } ``` was previously: ```rust impl<T> Foo<T> { fn new(a: usize, bar: Bar, _phantom: std::marker::PhantomData<T>) -> Self { Self { a, bar, _phantom } } fn random() -> Self { Self { a: todo!(), bar: todo!(), _phantom: todo!(), } } } ``` and is now: ```rust impl<T> Foo<T> { fn new(a: usize) -> Self { Self { a, bar: Bar::Bar {}, _phantom: std::marker::PhantomData } } fn random() -> Self { Self { a: todo!(), bar: Bar::Bar {}, _phantom: std::marker::PhantomData, } } } ``` I'd be happy about any suggestions. ## TODO - [x] deduplicate `use_trivial_constructor` (unclear how to do as it's used in two separate crates) - [x] write tests Closes #12535
2022-07-16Auto merge of #12712 - harpsword:fix-rename-crate-root, r=Veykrilbors-0/+33
fix: ignore renames for crate root close #12684 . I just ignore renames for crate root in `rename_mod` func.
2022-07-16Improve syntax fixup a bit, handle incomplete `if`Florian Diebold-34/+120
- allow appending tokens after a token, not just a node - allow inserting delimiters (and remove them again) - fix up `if {}` and `if` without anything following
2022-07-16Auto merge of #12773 - Veykril:self-compl, r=Veykrilbors-18/+124
fix: Improve self param completion applicability Fixes https://github.com/rust-lang/rust-analyzer/issues/9522
2022-07-16fix: Improve self param completion applicabilityLukas Wirth-18/+124
2022-07-16Auto merge of #12772 - Veykril:nameres, r=Veykrilbors-65/+60
internal: Remove allocation in DefCollector::reseed_with_unresolved_attribute
2022-07-16Auto merge of #12766 - Veykril:completion-vis, r=Veykrilbors-63/+121
fix: Don't show qualified path completions for private items Fixes https://github.com/rust-lang/rust-analyzer/issues/12703
2022-07-16internal: Remove allocation in DefCollector::reseed_with_unresolved_attributeLukas Wirth-65/+60
2022-07-15fix: Don't show qualified path completions for private itemsLukas Wirth-63/+121
2022-07-14Auto merge of #12765 - Veykril:import-insert-fix, r=Veykrilbors-24/+37
fix: Fix imports being inserted before doc comments in inline modules Fixes https://github.com/rust-lang/rust-analyzer/issues/12758
2022-07-14fix: Fix imports being inserted before doc comments in inline modulesLukas Wirth-24/+37
2022-07-14Auto merge of #12556 - DorianListens:dscheidt/generic-extract, r=Veykrilbors-7/+467
fix: Support generics in extract_function assist This change attempts to resolve issue #7636: Extract into Function does not create a generic function with constraints when extracting generic code. In `FunctionBody::analyze_container`, we now traverse the `ancestors` in search of `AnyHasGenericParams`, and attach any `GenericParamList`s and `WhereClause`s we find to the `ContainerInfo`. Later, in `format_function`, we collect all the `GenericParam`s and `WherePred`s from the container, and filter them to keep only types matching `TypeParam`s used within the newly extracted function body or param list. We can then include the new `GenericParamList` and `WhereClause` in the new function definition. This change only impacts `TypeParam`s. `LifetimeParam`s and `ConstParam`s are out of scope for this change. I've never contributed to this project before, but I did try to follow the style guide. I believe that this change represents an improvement over the status quo, but I think it's also fair to argue that it doesn't fully "fix" the linked issue. I'm totally open to merging this as is, or going further to try to make a more complete solution. Also: if there are other unit or integration tests I should add, please let me know where to look!
2022-07-14Auto merge of #12691 - Veykril:proc-macro-diag, r=Veykrilbors-41/+63
fix: Fix unresolved proc macro diagnostics pointing to macro expansions Fixes https://github.com/rust-lang/rust-analyzer/issues/12657