Commit graph

18509 commits

Author SHA1 Message Date
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
Lukas Wirth
7a8c4c001b Turn macro_expand from query to normal function 2023-11-28 17:23:51 +01:00
Lukas Wirth
b98597f06d Re-enable proc-macros 2023-11-28 16:28:56 +01:00
Lukas Wirth
98cfdde8ba Thinner TokenMap 2023-11-28 10:56:25 +01:00
Lukas Wirth
92d447f976 🧹 2023-11-28 10:55:40 +01:00
Lukas Wirth
ab8f12e169 Rename hygiene vars and fields to span_map 2023-11-28 10:55:40 +01:00
Lukas Wirth
6208960c48 Deduplicate dummy test span maps 2023-11-28 10:55:40 +01:00
Lukas Wirth
c43078f99d Re-implement InFile wrappers as type aliases over generic InFileWrapper 2023-11-28 10:55:40 +01:00
Lukas Wirth
30093a6d81 spans always come from real file 2023-11-28 10:55:39 +01:00
Lukas Wirth
394d11b0fa Fix float-split hack not setting up spans correctly 2023-11-28 10:55:39 +01:00
Lukas Wirth
8423893d1c More incremental tests 2023-11-28 10:55:39 +01:00
Lukas Wirth
05f375eae2 hygiene 2.0 2023-11-28 10:55:39 +01:00
Lukas Wirth
e36b3f7b8c Proper span representation with syntax context 2023-11-28 10:55:39 +01:00
Lukas Wirth
890eb17b4e Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
Lukas Wirth
f79439caed Infect proc-macro-api crate with generic span type parameter 2023-11-28 10:55:39 +01:00
Lukas Wirth
83f91f61b1 Infect mbe crate with generic span type parameter 2023-11-28 10:55:39 +01: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
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
Laurențiu Nicola
3ccde009cb Switch to our own salsa fork 2023-11-26 13:06:36 +02: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
Andrew Hlynskyi
94cea4663a fix: add fallback for completion label details 2023-11-25 13:25:42 +02:00
David Tolnay
b68f5311b5
Replace option.map(cond) == Some(true) with option.is_some_and(cond) 2023-11-24 09:06:44 -08: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
Young-Flash
bd5a63b208 move parentheses judge logic into builder 2023-11-22 14:11:00 +08: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
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
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
Laurențiu Nicola
59f5d51852 Merge commit '141fc695dca1df7cfc3c9803972ec19bb178dcbc' into sync-from-ra 2023-11-16 22:27:35 +02:00
Laurențiu Nicola
480cb60be3 Bump libc 2023-11-16 21:48:49 +02:00
Sarrus1
97dea2c699
remove unused PhantomData 2023-11-16 18:39:36 +01:00
austaras
e95ec55273 fix: better resolve assoc item with type bound 2023-11-16 23:17:00 +08:00
Young-Flash
cfc881ae13 fix missing assoc item 2023-11-16 22:27:21 +08:00
bors
58de0b130a Auto merge of #15902 - lnicola:bump-deps, r=Veykril
internal: Bump deps pt. 1
2023-11-15 19:37:06 +00:00
Laurențiu Nicola
da24b6fb12 Bump memchr 2023-11-15 21:24:20 +02:00
Laurențiu Nicola
8ea06c8ec8 Bump arbitrary and derive-arbitrary 2023-11-15 21:22:34 +02:00
Laurențiu Nicola
c6fad55c98 Bump bitflags 2023-11-15 21:20:47 +02:00
Laurențiu Nicola
3ed27d21f2 Bump cargo_metadata 2023-11-15 21:18:49 +02:00
Laurențiu Nicola
2814d646cb Bump rayon 2023-11-15 21:14:56 +02:00
Laurențiu Nicola
b18ce4f8ea Bump xshell 2023-11-15 21:12:18 +02:00
Lukas Wirth
e8c4007cfc Fix builtin line! expansion 2023-11-15 14:06:10 +01:00
Laurențiu Nicola
c66084b9c6 Bump ra-ap-rustc_index and ra-ap-rustc_abi 2023-11-15 13:42:13 +02:00
Laurențiu Nicola
b267f6b071 Bump ra-ap-rustc_lexer 2023-11-15 13:40:43 +02:00
Laurențiu Nicola
829cf8db4c Bump dissimilar 2023-11-15 13:34:56 +02:00
Laurențiu Nicola
a1f81a7e75 Bump chalk 2023-11-15 13:31:45 +02:00
Laurențiu Nicola
441e8c71f1 Remove outdated comment 2023-11-15 13:27:48 +02:00
Laurențiu Nicola
c4dfa06b9d Bump tracing-log 2023-11-15 13:25:19 +02:00
Laurențiu Nicola
1fc056ec93 Bump indexmap 2023-11-15 13:21:34 +02:00
Laurențiu Nicola
2bfd6b659d Bump serde_json 2023-11-15 13:17:36 +02:00
Laurențiu Nicola
cb8434e594 Bump either 2023-11-15 13:07:36 +02:00
Laurențiu Nicola
2dbdaa247b Bump tracing-subscriber 2023-11-15 13:04:39 +02:00
Laurențiu Nicola
d83620a5ba Bump tracing-tree 2023-11-15 13:01:54 +02:00
Laurențiu Nicola
f53368dd3f Bump tracing 2023-11-15 13:00:32 +02:00
Laurențiu Nicola
f66df10f87 Bump itertools 2023-11-15 12:53:56 +02:00
Laurențiu Nicola
dfc885e0fd Bump anyhow 2023-11-15 12:49:32 +02:00
bors
57ef70cc08 Auto merge of #15901 - Veykril:inner-diag, r=lnicola
fix: Diagnose everything in nested items, not just def diagnostics

Turns out we only calculated def diagnostics for these before (was wondering why I wasn't getting any type mismatches)
2023-11-15 10:07:15 +00:00
bors
535eb0da9d Auto merge of #15874 - DropDemBits:structured-snippet-migrate-4, r=Veykril
internal: Migrate assists to the structured snippet API, part 4

Continuing from #15260

Migrates the following assists:
- `add_turbo_fish`
- `add_type_ascription`
- `destructure_tuple_binding`
- `destructure_tuple_binding_in_subpattern`

I did this a while ago, but forgot to make a PR for the changes until now. 😅
2023-11-15 09:54:45 +00:00
bors
a47330308b Auto merge of #15875 - Young-Flash:fix_grammar, r=Veykril
fix `PathSegment` grammar

close https://github.com/rust-lang/rust-analyzer/issues/15778
2023-11-15 09:43:11 +00:00
Lukas Wirth
498f39eae2 fix: Diagnose everything in nested items, not just def diagnostics 2023-11-15 10:34:09 +01:00
Laurențiu Nicola
6b53c09ef5 Merge branch 'master' into sync-from-rust 2023-11-15 09:46:27 +02:00
Laurențiu Nicola
610eafe009 Merge commit '76633199f4316b9c659d4ec0c102774d693cd940' into sync-from-rust 2023-11-15 09:45:17 +02:00
DropDemBits
3f99a56fae
Fix panic in add_type_ascription
Assist wasn't applicable when the let statement was missing a pattern
before, so we should do the same now.
2023-11-14 18:43:48 -05:00
DropDemBits
df629627c5
Add tests for LetStmt::set_ty 2023-11-14 17:35:24 -05:00
Lukas Wirth
723d799ec1 Diagnose missing assoc items in trait impls 2023-11-14 22:00:52 +01:00
Lukas Wirth
e21d21a8fb Diagnose incorrect unsafety for trait impls 2023-11-14 21:05:27 +01:00
Lukas Wirth
d5faad1dae Fix inlay-hint tests being invalidated by minicore chanes 2023-11-14 18:53:48 +01:00
Lukas Wirth
6ddccc9a6e Diagnose some orphan trait impl cases 2023-11-14 18:09:34 +01:00
Laurențiu Nicola
d45ff2484f Depend on rustc_driver 2023-11-14 18:07:02 +02:00
Lukas Wirth
b74015512d Remove UserError from LayoutError 2023-11-14 13:32:04 +01:00
Lukas Wirth
e844784d8d Simplify 2023-11-14 12:53:14 +01:00
DropDemBits
787ca888e3
Add IdentPat::set_pat
Needed so that the `tuple_pat` node gets added to the syntax tree,
which is required as we're using structured snippets.
2023-11-13 20:41:06 -05:00
DropDemBits
6f68cd3394
Remove unwraps from destructure_tuple_binding 2023-11-13 18:42:58 -05:00
Laurențiu Nicola
b6951defa6 Add missing rustc_private features 2023-11-13 21:38:57 +02:00
Michael Schmidt
67058605d8
FIxed typo in highlight_related.rs 2023-11-13 13:13:39 +01:00
Young-Flash
3e5bc9a9c8 impl qualifying_trait for PathSegment 2023-11-13 18:14:00 +08:00
Lukas Wirth
d6b908ec41 Fix import preference config keys 2023-11-12 17:48:40 +01:00
Laurențiu Nicola
bad3d9e766 Include toml files in the vfs 2023-11-12 16:45:47 +02:00
bors
1152f593b3 Auto merge of #15870 - lnicola:expand-macro, r=lnicola
minor: Make "Expand macro" command title more explicit

Closes [#15856](https://github.com/rust-lang/rust-analyzer/issues/15856).

I opted for "caret", since it's the better term (cursor is the mouse), but I'm not sure how popular it is these days.
2023-11-12 13:48:43 +00:00