Commit graph

18462 commits

Author SHA1 Message Date
Lukas Wirth
18f1a3c3c6 Some final touches 2023-12-03 20:20:59 +01:00
Lukas Wirth
81410ab500 Cleanup FileId stuff 2023-12-02 19:32:53 +01:00
Lukas Wirth
02a3a9438a Some more minor cleanups 2023-12-02 17:04:13 +01:00
Lukas Wirth
5edf7bddc6 Fix mod item in included file resolving incorrectly 2023-12-02 13:49:09 +01:00
Lukas Wirth
d2a31acda1 Fix macro expansion expression parenthesis wrapping 2023-12-02 13:03:46 +01:00
Lukas Wirth
efa67294ed Fix eager macro input spans being discarded 2023-12-01 16:29:58 +01:00
Lukas Wirth
c11737cd63 Simplify include handling 2023-12-01 14:58:57 +01:00
Lukas Wirth
0003e568ca Pass calling span through to builtin macro expansions 2023-12-01 14:11:57 +01:00
Lukas Wirth
f48fa0c6cb Re-implement syntax fixups 2023-11-29 16:00:39 +01:00
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
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