Commit Graph

26681 Commits

Author SHA1 Message Date
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
bors
bc978217b3 Auto merge of #15917 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
2023-11-17 08:02:39 +00:00
Laurențiu Nicola
6a0e02dd53 Merge branch 'master' into sync-from-rust 2023-11-17 10:00:45 +02:00
Laurențiu Nicola
59f5d51852 Merge commit '141fc695dca1df7cfc3c9803972ec19bb178dcbc' into sync-from-ra 2023-11-16 22:27:35 +02:00
bors
141fc695dc Auto merge of #15913 - lnicola:bump-libc, r=lnicola
internal: Bump libc

CC https://github.com/rust-lang/rust/pull/117981
2023-11-16 19:50:35 +00:00
Laurențiu Nicola
480cb60be3 Bump libc 2023-11-16 21:48:49 +02:00
bors
37a8790829 Auto merge of #15830 - davidbarsky:davidbarsky/allow-companion-extension-to-call-rust-analyzer, r=davidbarsky
code: expose workspaces to other extensions; remove `addProject` command

This (mostly red) PR does three things:
- Exposes two methods to companion extensions (`setWorkspaces` and `notifyRustAnalyzer`).
    - `setWorkspaces` is needed to update `linkedProjects` _without_ writing workspace/global configuration.
    - `notifyRustAnalyzer` to get the server to pull the new configuration.
- Makes `Ctx` implement `RustAnalyzerExtensionApi` to prevent accidental regressions.
- Remove `rust-analyzer.addProject`, as that will live in a buck2 companion extension. No need for that to be in rust-analyzer!

I can see the utility of combining `notifyRustAnalyzer` and `setWorkspaces` into a single method (`updateWorkspacesAndNotify()`?), but I don't feel strongly about this. My feeling is that this API could be easily changed in the future.
2023-11-16 17:43:14 +00:00
Sarrus1
97dea2c699
remove unused PhantomData 2023-11-16 18:39:36 +01:00
David Barsky
0cd68bfed3 code: expose workspaces to other extensions; remove addProject command 2023-11-16 12:38:15 -05: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
Laurențiu Nicola
83e6d7938c Bump tracing-tree again 2023-11-15 21:08:35 +02:00
bors
bae9c084e9 Auto merge of #15904 - davidbarsky:davidbarsky/bump-minimum-vscode-version-to-1.78, r=lnicola
editor/code: bump minimum version of VS Code to 1.78

Undoes https://github.com/rust-lang/rust-analyzer/pull/15333.
2023-11-15 15:34:26 +00:00
David Barsky
df7fa7f680 editor/code: bump minimum version of VS Code to 1.78 2023-11-15 10:32:40 -05:00
bors
1d3bf72808 Auto merge of #15905 - lnicola:tsconfig, r=lnicola
minor: Tweak tsconfig.json

CC https://github.com/rust-lang/rust-analyzer/pull/15904
2023-11-15 15:13:03 +00:00
Laurențiu Nicola
8e8e7de93b Tweak tsconfig.json 2023-11-15 17:08:39 +02:00
bors
b8b4b22c1b Auto merge of #15903 - Veykril:inner-diag, r=Veykril
Fix builtin line! expansion

`concat` expects only literals, not whole syntax nodes, so we need to expand as such
2023-11-15 13:21:17 +00: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
Jan Procházka
9c8727eea5
Update editors/code/package.json
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2023-11-15 12:41:54 +01:00
Laurențiu Nicola
b267f6b071 Bump ra-ap-rustc_lexer 2023-11-15 13:40:43 +02:00