about summary refs log tree commit diff
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-20Auto merge of #12821 - SpecialMike:fix-partial-eq-default, r=Veykrilbors-1/+33
fix: Correctly generate default `PartialEq::ne` Fixes #12779 For the `Generate default members` assist on the `PartialEq` trait, the assist will now give the default implementation instead of generating a function.
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-19Auto merge of #12817 - fasterthanlime:expect-test-1-4-0, r=lnicolabors-17/+20
Upgrade to expect-test@1.4.0, add CARGO_WORKSPACE_DIR env var This should make ra's test suite runnable from within `rust-analyzer/rust`. `@cuviper` ran into that when trying to run RA tests from rust CI: https://github.com/rust-lang/rust/pull/99444#issuecomment-1188844202
2022-07-19Add CARGO_WORKSPACE_DIR env var in `.cargo/config.toml`Amos Wenger-0/+3
As discussed in https://github.com/rust-analyzer/expect-test/issues/33
2022-07-19Upgrade to expect-test@1.4.0Amos Wenger-17/+17
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 #11819 - ↵bors-0/+0
rust-lang:dependabot/npm_and_yarn/editors/code/minimist-1.2.6, r=Veykril Bump minimist from 1.2.5 to 1.2.6 in /editors/code Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/substack/minimist/commit/7efb22a518b53b06f5b02a1038a88bd6290c2846"><code>7efb22a</code></a> 1.2.6</li> <li><a href="https://github.com/substack/minimist/commit/ef88b9325f77b5ee643ccfc97e2ebda577e4c4e2"><code>ef88b93</code></a> security notice for additional prototype pollution issue</li> <li><a href="https://github.com/substack/minimist/commit/c2b981977fa834b223b408cfb860f933c9811e4d"><code>c2b9819</code></a> isConstructorOrProto adapted from PR</li> <li><a href="https://github.com/substack/minimist/commit/bc8ecee43875261f4f17eb20b1243d3ed15e70eb"><code>bc8ecee</code></a> test from prototype pollution PR</li> <li>See full diff in <a href="https://github.com/substack/minimist/compare/1.2.5...1.2.6">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=minimist&package-manager=npm_and_yarn&previous-version=1.2.5&new-version=1.2.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - ``@dependabot` rebase` will rebase this PR - ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it - ``@dependabot` merge` will merge this PR after your CI passes on it - ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it - ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging - ``@dependabot` reopen` will reopen this PR if it is closed - ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` use these labels` will set the current labels as the default for future PRs for this repo and language - ``@dependabot` use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - ``@dependabot` use these assignees` will set the current assignees as the default for future PRs for this repo and language - ``@dependabot` use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/rust-analyzer/rust-analyzer/network/alerts). </details>
2022-07-18Auto merge of #12804 - jonas-schievink:config-watcher, r=Veykrilbors-9/+32
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-9/+32
2022-07-18Auto merge of #12802 - rust-lang:jonas-schievink-patch-1, r=jonas-schievinkbors-1/+1
minor: Remove macro ABI version from doc comment 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-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-18Auto merge of #12798 - jonas-schievink:trim-proc-macro-abis, r=jonas-schievinkbors-16176/+16
internal: Remove outdated proc macro ABIs Drops support for 1.48 to 1.57. We still support 1.58+, which is 4 versions out of date, so that should be plenty.
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-18Auto merge of #12795 - jonas-schievink:proc-macro-abi-1.64, r=jonas-schievinkbors-1/+4443
feat: Support the 1.64 nightly proc macro ABI Should resolve https://github.com/rust-lang/rust-analyzer/issues/12600 Not sure why I thought the Rust version was the same as on beta, that's never the case (but future nightly changes can break the ABI again).
2022-07-18Support the 1.64 nightly proc macro ABIJonas Schievink-1/+4443
2022-07-18Auto merge of #12286 - harpsword:fix_generate_constant, r=Veykrilbors-15/+151
fix: “Generate constant” ignores the path prefix of the identifier fix #12022 add abilities to generate constant with prefix path, even these mods in path are not exist. ## some examples https://user-images.githubusercontent.com/10148927/168710096-59d5c594-0e4a-4ba7-bfb3-21c4b99409ea.mov https://user-images.githubusercontent.com/10148927/168710111-cd6d3df4-58eb-4358-ae9e-791bfc408efa.mov https://user-images.githubusercontent.com/10148927/168710115-601923b7-2164-4b9a-85a9-fbb4b29796a1.mov https://user-images.githubusercontent.com/10148927/168710118-3d4bc9c1-758b-4e6f-9709-568fa920937d.mov
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-17Auto merge of #12785 - Logarithmus:feature/fix-negative-const-generics, ↵bors-4/+2
r=Veykril fix: un-inline `ConstScalarOrPath::from_expr_opt` Sorry, but I missed these from #12778 `@flodiebold`
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-65/+72
2022-07-17refactor: inline some variablesArtur Sinila-4/+2
2022-07-17Auto merge of #12781 - iDawer:hir_display.stack_overflow, r=lnicolabors-2/+42
fix: Stack overflows and wrong type inference of associated type shorthands This fixes `generic_predicates_for_param_query` comparing local IDs that belong to different definitions. As the query is used in multiple places this fix affects various r-a features when an associated type shorthand and `impl Trait` involved. Notably inference, goto, completion, hover. Fixes #12484
2022-07-17Check for local IDs belong to same definitioniDawer-2/+42
2022-07-17feat: support negative const generic parametersArtur Sinila-125/+152
* 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-16Auto merge of #12775 - flodiebold:syntax-fixup-if, r=flodieboldbors-34/+120
fix: Improve syntax fixup a bit, handle incomplete `if` - 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