Commit Graph

26556 Commits

Author SHA1 Message Date
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
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
Ali Bektas
f79e8182c1 v3 2023-11-23 02:15:47 +01:00
Ali Bektas
74d8fdc8fe Update test data for crate deduping
Make data reflect a case where dev deps are existent.
base-db::CrateGraph::extend now adds dev dependencies for a crate
in case of its upgrading from a CrateOrigin::Lib kind of a crate to a
CrateOrigin::Local one.
2023-11-23 02:15:47 +01:00
Ali Bektas
25e990d753 v3 2023-11-23 02:15:47 +01:00
Ali Bektas
7e4aad5ba5 v2 2023-11-23 02:15:47 +01:00
Ali Bektas
886eaa0a7d Relaxation for crate graph mergin
Partially fixes #15656 . When a crate graph is extended which is the case when new workspaces are added to the project
the rules for deduplication were too strict. One problem that arises from this is that in certain conditions
when we see the same crate having different `CrateOrigin`s the first form would be maintained. 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 02:15:46 +01:00
roife
e790d7ff3a internal: simplify the removal of dulicate workspaces.
refactor: replace multiple steps with `positions` in `fetch_workspaces` for clarity.
2023-11-22 21:14:39 +08:00
bors
7ceefc7ee9 Auto merge of #15894 - schrieveslaach:cancelable-initialization, r=Veykril
Cancelable Initialization

This commit provides additional initialization methods to Connection in order to support CTRL + C sigterm handling.

In the process of adding LSP to Nushell (see https://github.com/nushell/nushell/pull/10941) this gap has been identified.
2023-11-22 08:48:17 +00:00
Young-Flash
bd5a63b208 move parentheses judge logic into builder 2023-11-22 14:11:00 +08:00
Marc Schreiber
81c2d3552e Cancelable Initialization
This commit provides additional initialization methods to Connection in
order to support CTRL + C sigterm handling.
2023-11-21 21:29:33 +01:00
bors
45136511a5 Auto merge of #15921 - Young-Flash:tmp, r=Veykril
chore: add use case for `PathSegment::qualifying_trait`

add use case for `PathSegment::qualifying_trait`, which introduced in https://github.com/rust-lang/rust-analyzer/pull/15875
2023-11-21 14:59:17 +00:00
bors
91b31489dd Auto merge of #15944 - brunobell:patch-1, r=lnicola
Update Arch Linux package URL in manual.adoc

The old URL returns 404 now.
2023-11-21 14:47:39 +00:00
Dash Lu
9f8191b62d Update Arch Linux package URL in manual.adoc 2023-11-21 22:41:49 +08:00
bors
8d3522e557 Auto merge of #15825 - Austaras:master, r=flodiebold
fix: better resolve assoc item with type bound

Closes #15772
2023-11-21 09:44:43 +00:00
bors
2e7e8cc7b9 Auto merge of #15940 - pascalkuthe:fix_rename, r=Veykril
ensure renames happen after edit

This is a bugfix for an issue I fould while working on helix. Rust-analyzer currently always sends any filesystem edits (rename/file creation) before any other edits. When renaming a file that is also being edited that would mean that the edit would be discarded and therefore an incomplete/incorrect refactor (or even cause the creation of a new file in helix altough that  is probably a pub on our side).

Example:

* create a module: `mod foo` containing a `pub sturct Bar;`
* reexport the struct uneder a different name in the `foo` module using a *fully qualified path*: `pub use crate::foo::Bar as Bar2`.
* rename the `foo` module to `foo2` using rust-analyzer
* obsereve that the path is not correctly updated (rust-analyer first sends a rename `foo.rs` to `foo2.rs` and then edits `foo.rs` after)

This PR fixes that issue by simply executing all rename operations after all edit operations (while still executing file creation operations first). I also added a testcase similar to the example above.

Relevent excerpt from the LSP standard:

> Since version 3.13.0 a workspace edit can contain resource operations (create, delete or rename files and folders) as well. If resource operations are present clients need to execute the operations in the order in which they are provided. So a workspace edit for example can consist of the following two changes: (1) create file a.txt and (2) a text document edit which insert text into file a.txt. An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will cause failure of the operation. How the client recovers from the failure is described by the client capability: workspace.workspaceEdit.failureHandling
2023-11-21 09:33:01 +00:00
bors
1a5cee1731 Auto merge of #15911 - Young-Flash:fix_missing_assoc_item, r=lnicola
fix: handle default constant values in `trait_impl_missing_assoc_item` diagnostic

A patch of https://github.com/rust-lang/rust-analyzer/pull/15895, close https://github.com/rust-lang/rust-analyzer/issues/15909

cc `@Veykril`
2023-11-20 17:49:45 +00:00
bors
375142902c Auto merge of #15885 - RunDevelopment:patch-1, r=lnicola
Fix typo in highlight_related.rs

While reading the user manual, I noticed a random tick, so I went ahead and fixed it. The `await` keyword should be properly rendered as inline code.

![image](https://github.com/rust-lang/rust-analyzer/assets/20878432/f134a4c9-e539-4635-97ac-506790893869)
2023-11-20 17:37:59 +00:00
bors
255eed40c4 Auto merge of #15925 - lnicola:pathres-nodebug, r=lnicola
internal: Remove debugging code in path resolution

Closes #15924
2023-11-17 19:00:20 +00:00
Laurențiu Nicola
a54c0dafc8 Remove debugging code in path resolution 2023-11-17 20:58:43 +02:00
Young-Flash
1cbda612bc chore: add use case for PathSegment::qualifying_trait 2023-11-17 21:31:33 +08:00
austaras
808f6687f7 address comment 2023-11-17 16:53:38 +08:00