Commit Graph

26577 Commits

Author SHA1 Message Date
dfireBird
20c6f27024
Insert fn call parens only if the parens inserted around field name 2023-12-04 22:37:34 +05:30
bors
e402c494b7 Auto merge of #15879 - dfireBird:fix-14656, r=Veykril
Implement completion for the callable fields.

Fixes #14656

PR is opened with basic changes. It could be improved by having a new `SymbolKind` for the callable fields and implementing a separate render function similar to the `render_method` for the new `SymbolKind`.
It could also be done without any changes to the `SymbolKind` of course, have the new function called based on the type of field.
I prefer the former method.

Please give any thoughts or changes you think is appropriate for this method. I could start working on that in this same PR.
2023-12-01 16:20:36 +00:00
bors
6e6a0b0a3d Auto merge of #16000 - HKalbasi:drop-inlay-hint, r=HKalbasi
Initial support for implicit drop inlay hint

cc #15785
2023-12-01 13:36:08 +00:00
dfireBird
b7effe54ee
fix close parens position to move after field access 2023-12-01 18:55:26 +05:30
hkalbasi
4d55cac466 Initial support for implicit drop inlay hint 2023-12-01 16:16:46 +03:30
bors
c2f133489c Auto merge of #15912 - Sarrus1:master, r=HKalbasi
chore: remove unused `PhantomData`

This PR removes an unused `PhantomData` in `FileItemTreeId`.

*Note:* I am not sure how this should be implemented, maybe as a type instead of a wrapper struct? I'd be happy to do so if needed 👍
2023-12-01 11:07:35 +00:00
bors
57e90240a5 Auto merge of #15961 - ohno418:top-level-let-stmt, r=Veykril
Improve error handling for top-level `let` statements

This commit addresses the issue of excessive and unrelated errors generated by top-level `let` statements. Now, only a single error is produced, indicating that `let` statements are invalid at the top level.

---

Fixes https://github.com/rust-lang/rust-analyzer/issues/14963.

While I'm not really sure if handling a particular case in a special manner is appropriate, it would be good to suppress the excessive number of annoying and unrelated errors.
2023-12-01 10:41:16 +00:00
Yutaro Ohno
e076192dd8 Improve error handling for top-level let statements
This commit addresses the issue of excessive and unrelated errors
generated by top-level `let` statements. Now, only a single error is
produced, indicating that `let` statements are invalid at the top level.
2023-12-01 10:37:21 +09:00
bors
c9d189d137 Auto merge of #15993 - meowtec:fix/workspaces-debug-cwd, r=Veykril
Debug use cargo workspace root as `cwd`

fixes #13022
2023-11-30 19:31:15 +00:00
bors
1c51e25a5a Auto merge of #15994 - ChayimFriedman2:err-comma-after-fus, r=Veykril
fix: Err for comma after functional update syntax

Error message copied from rustc, https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=20aeedb2db504c4e4ced54b665e761d6.

Fixes #15989.
2023-11-30 15:59:31 +00:00
bors
56abc0a29c Auto merge of #15971 - Young-Flash:fix_match_arm, r=lnicola
fix: don't make `MissingMatchArms` diagnostic for empty match body

before
<img width="423" alt="before" src="https://github.com/rust-lang/rust-analyzer/assets/71162630/5c0e46fb-0c03-42f2-96ff-8e5245c25965">

after
<img width="423" alt="after" src="https://github.com/rust-lang/rust-analyzer/assets/71162630/e2479dc5-3634-479b-af29-0b0ec7dc4a4f">

close https://github.com/rust-lang/rust-analyzer/issues/15954
2023-11-30 12:10:45 +00:00
Chayim Refael Friedman
2fd19ed598 Err for comma after functional update syntax 2023-11-30 14:04:36 +02:00
Young-Flash
b46f37854e update: filter out syntax error in test 2023-11-30 19:35:25 +08:00
meowtec
4ca86edac9 Debug use cargo workspace root as cwd. fixes #13022 2023-11-30 19:21:59 +08:00
dfireBird
21c09eb544
update dot tests function with check_edit 2023-11-28 22:21:57 +05:30
dfireBird
5c0c8ceaf7
refactor complete_fn_fields function and correct branch checks 2023-11-28 22:21:57 +05:30
dfireBird
8296b16f38
fix the insertion of the surronding parens
Before it was inserting whenever function field is found but it should
happend only in the case of function call.
2023-11-28 22:21:57 +05:30
dfireBird
aa1cf8d357
add tests for tuple fields and expect fn type cases 2023-11-28 22:21:57 +05:30
dfireBird
eedeb58a4e
refactor obtaining receivers into idiomatic way
variable name change for clearer usage indication
2023-11-28 22:21:57 +05:30
dfireBird
5bcafd7dc0
add tests for the completion of the callable field 2023-11-28 22:21:57 +05:30
dfireBird
7cf3ab4bd2
implement completion render for callable fields 2023-11-28 22:21:57 +05:30
dfireBird
a0e690a7e9
add different completion for fn fields 2023-11-28 22:21:57 +05:30
bors
c7c582afb5 Auto merge of #15985 - davidbarsky:david/bump-triomphe, r=lnicola
internal: bump triomphe to 0.1.10
2023-11-28 15:44:44 +00:00
David Barsky
914a1570e2 internal: bump triomphe to 0.1.10 2023-11-28 10:27:17 -05:00
bors
2ee17bc5f2 Auto merge of #15970 - Austaras:master, r=Veykril
fix variant resolve for type alias

Closes #15943
2023-11-27 16:26:19 +00:00
bors
4ab67291fa Auto merge of #15857 - Young-Flash:fix, r=Veykril
fix: remove parenthesis should ensure space

close https://github.com/rust-lang/rust-analyzer/issues/15844
2023-11-27 16:14:31 +00:00
bors
9aa867cd01 Auto merge of #15946 - roife:master, r=Veykril
internal: simplify the removal of dulicate workspaces.

### Summary:
Refactoring the duplicate removal process for `workspaces` in `fetch_workspaces`.

### Changes Made:

Replaced `[].iter().enumerate().skip(...).filter_map(...)` with a more concise `[i+1..].positions(...)` provided by `itertools`, which enhances clarity without changing functionality

### Impact:

This change aims to enhance the duplicate removal process for `workspaces`. This change has been tested on my machine.

Please review and provide feedback. Thanks!
2023-11-27 16:02:53 +00:00
bors
23dc01f958 Auto merge of #15976 - lnicola:sync-from-rust, r=lnicola
minor: Sync from rust
2023-11-27 15:03:48 +00:00
Laurențiu Nicola
57172f7b94 Merge branch 'master' into sync-from-rust 2023-11-27 17:01:38 +02:00
Laurențiu Nicola
81606ecf68 Merge commit '237712fa314237e428e7ef2ab83b979f928a43a1' into sync-from-ra 2023-11-27 12:40:39 +02:00
Young-Flash
cab91480b2 fix: don't make MissingMatchArms diagnostic for empty match body 2023-11-26 22:57:30 +08:00
austaras
2411f1383a fix variant resolve for type alias 2023-11-26 21:00:11 +08:00
bors
237712fa31 Auto merge of #15967 - lnicola:salsa-fork, r=lnicola
internal: Switch to our own `salsa` fork

This gets rid of `syn` 1, among others.
2023-11-26 11:11:54 +00:00
Laurențiu Nicola
3ccde009cb Switch to our own salsa fork 2023-11-26 13:06:36 +02:00
bors
79ec2c584b Auto merge of #15964 - lnicola:bump-deps, r=lnicola
minor: Bump rustc deps and chalk

This finally upgrades `ra-ap-rustc_parse_format` (even though it's probably a no-op?).
2023-11-25 18:40:52 +00:00
Laurențiu Nicola
fc880be491 Bump chalk 2023-11-25 20:38:11 +02:00
Laurențiu Nicola
aadeb66d03 Bump ra-ap-rustc_index and ra-ap-rustc_abi 2023-11-25 20:36:45 +02:00
Laurențiu Nicola
c01679eb7b Bump ra-ap-rustc_lexer 2023-11-25 20:36:06 +02:00
Laurențiu Nicola
fa74ac8457 Bump ra-ap-rustc_parse_format 2023-11-25 20:35:26 +02:00
bors
35da60a2bc Auto merge of #15962 - ahlinc:label-datail2, r=lnicola
fix: add fallback for completion label details

This PR adds a fallback to a previous implementation in a case when the label detail field isn't supported by LSP client and the support isn't reported by the LSP initialize request. In this case additional info about trait and aliases would be merged into the label field as it was before the #15956 PR.
2023-11-25 11:54:36 +00:00
Andrew Hlynskyi
94cea4663a fix: add fallback for completion label details 2023-11-25 13:25:42 +02:00
bors
34cffbf1d7 Auto merge of #15960 - dtolnay-contrib:issomeand, r=lnicola
Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)`

Extracted from https://github.com/rust-lang/rust/pull/118253.
2023-11-24 17:14:28 +00:00
David Tolnay
b68f5311b5
Replace option.map(cond) == Some(true) with option.is_some_and(cond) 2023-11-24 09:06:44 -08:00
bors
fec3828c5f Auto merge of #15846 - jprochazk:disable-error-notification, r=Veykril
editor/code: add option to suppress error notifications

Fixes https://github.com/rust-lang/rust-analyzer/issues/14193

- Added the `rust-analyzer.showRequestFailedErrorNotification` configuration option, which defaults to `true`
- If `rust-analyzer.showRequestFailedErrorNotification` is set to `true`, the current behavior is preserved.
- If `rust-analyzer.showRequestFailedErrorNotification` is set to `false`, no error toasts will be displayed for any of the failed requests caused by panics in r-a. This _only_ applies to events that are triggered "implicitly", such as `textDocument/hover`.

To test this, you can manually introduce a panic in one of the language server LSP handlers for non-command events. I added an explicit `panic!()` in the `textDocument/hover` event handler:

#### `rust-analyzer.showRequestFailedErrorNotification` set to `true` (default)

[2023-11-07 17-17-48.webm](https://github.com/rust-lang/rust-analyzer/assets/1665677/d0408ab8-79d1-42cf-a4e7-94e99d9783ec)

#### `rust-analyzer.showRequestFailedErrorNotification` set to `false`

[2023-11-07 17-16-49.webm](https://github.com/rust-lang/rust-analyzer/assets/1665677/0496d8d0-fb53-4bc6-a279-1a47f412dbdb)
2023-11-24 14:06:07 +00:00
bors
8733728323 Auto merge of #15956 - ahlinc:label-detail, r=lnicola
Improve completion label details display

This PR improves completion label details display by separating trait and alias info from the `label` LSP field to an additional existing `label_detail` field. Changes look like the following:

### Before

![Screenshot from 2023-11-24 12-03-08](https://github.com/rust-lang/rust-analyzer/assets/14666676/74066f0d-f1ac-4e99-8be5-c5141d513d23)

### After

![Screenshot from 2023-11-24 12-21-57](https://github.com/rust-lang/rust-analyzer/assets/14666676/45fca112-4612-40a3-81b9-07ff12de0962)

_All existing tests are passed without any changes in test themselves logic._
2023-11-24 12:54:33 +00:00
Andrew Hlynskyi
f0adf8c4ec Update tests 2023-11-24 14:38:00 +02:00
Andrew Hlynskyi
615abb3c92 Improve completion label details display 2023-11-24 14:38:00 +02:00
bors
cccc7ca2c6 Auto merge of #15754 - alibektas:15656/linked_projects_are_local_too, r=Veykril
fix: Dedup duplicate crates with differing origins in CrateGraph construction

Partially fixes #15656 . Until now the condition for deduplication in crate graphs were the strict equality of two crates. One problem that arises from this is that in certain conditions when we see the same crate having different `CrateOrigin`s the first occurrence would be kept. This approach however results in some unwanted results such as making renaming forbidden as this has been recently only made available for local crates. The given example in #15656 can still not be resolved with this PR as that involves taking inconsistencies between dependencies into consideration. This will be addressed in a future PR.
2023-11-23 13:01:46 +00:00
Ali Bektas
ba1b080805 Precede paths with $ROOT$ 2023-11-23 12:34:38 +01:00
Ali Bektas
736994f026 Make test cases simpler 2023-11-23 11:52:22 +01:00