Commit Graph

24771 Commits

Author SHA1 Message Date
bors
057857ec23 Auto merge of #14334 - swarnimarun:is-float-char, r=lnicola
feat: add `is_float` & `is_char` to `hir::Type`

Some useful functions we didn't have on `Type` (were present on `BuiltinType`).

Also, I am considering exposing `TyKind` with `get_kind`, let me know if that's a better idea than implementing these API extensions incrementally.
2023-03-14 06:56:46 +00:00
bors
3ba7501dd0 Auto merge of #14342 - davidbarsky:davidbarsky/add-workspace-source-to-status, r=lnicola
Add path of workspace root folders to status output

Hi folks! Just a quick addition to the status output. There are some colleagues of mine who use a mix of Buck and Cargo. A person spent a bit of time this past week trying to figure out there the `rust-project.json` was coming from and pointed out that `rust-analyzer: Status` could be a good place to put this information. rust-analyzer doesn't seem to record the full path of the `Cargo.toml` or the `rust-project.json`, just the root directory. While not perfect, this should be enough for people to unblock themselves on. Here's an example of `rust-analyzer: Status` on the rust-analyzer repo:

```
Workspaces:
Loaded 192 packages across 1 workspace.
Workspace roots: [AbsPath("/Users/dbarsky/Developer/rust-analyzer")]
Analysis:
57mb of files
0b of index symbols (0)
2514 trees, 128 preserved
29535 trees, 128 preserved (Macros)
0b in total

File info:
Crate: rust_analyzer(CrateId(131))
Dependencies: proc_macro=CrateId(5), core=CrateId(2), alloc=CrateId(0), std=CrateId(7), test=CrateId(9), always_assert=CrateId(12), anyhow=CrateId(13), cfg=CrateId(25), crossbeam_channel=CrateId(35), dissimilar=CrateId(41), expect_test=CrateId(46), flycheck=CrateId(50), hir=CrateId(56), hir_def=CrateId(57), hir_ty=CrateId(59), ide=CrateId(63), ide_db=CrateId(66), ide_ssr=CrateId(68), itertools=CrateId(73), jod_thread=CrateId(75), lsp_server=CrateId(83), lsp_types=CrateId(85), mbe=CrateId(87), num_cpus=CrateId(96), oorandom=CrateId(99), parking_lot=CrateId(102), proc_macro_api=CrateId(110), proc_macro_srv=CrateId(111), profile=CrateId(118), project_model=CrateId(119), rayon=CrateId(125), rustc_hash=CrateId(136), scip=CrateId(141), serde=CrateId(145), serde_json=CrateId(147), sourcegen=CrateId(153), stdx=CrateId(155), syntax=CrateId(158), test_utils=CrateId(159), threadpool=CrateId(165), toolchain=CrateId(170), tracing=CrateId(171), tracing_log=CrateId(174), tracing_subscriber=CrateId(175), tracing_tree=CrateId(176), tt=CrateId(177), vfs=CrateId(188), vfs_notify=CrateId(189), xflags=CrateId(192), xshell=CrateId(194)
```
2023-03-14 06:43:45 +00:00
bors
ce4f79f327 Auto merge of #14345 - lnicola:sync-from-rust, r=lnicola
minor: Sync from downstream
2023-03-14 06:17:40 +00:00
Laurențiu Nicola
3b6db2246b Merge branch 'master' into sync-from-rust 2023-03-14 08:16:40 +02:00
feniljain
a10372dac6 fix: use compute_type_match correctly and update tests accordingly 2023-03-14 11:41:25 +05:30
David Barsky
78aed305e1 rename "addProject" command 2023-03-13 15:37:58 -04:00
David Barsky
677c0eeccb Add path of workspace root folders to status output 2023-03-13 14:45:41 -04:00
David Barsky
cb93c12c31 fmt 2023-03-13 13:33:39 -04:00
David Barsky
56273b3cf5 Remove rust-analyzer/addProject in favor of notifying r-a that configuration has changed 2023-03-13 13:30:19 -04:00
David Barsky
8d9bff0c74 Add a workspace config-based approach to reloading discovered projects. 2023-03-13 13:30:19 -04:00
David Barsky
91371494ee move rust-analyzer.discoverProjectCommand above $generated-start to avoid failing tests 2023-03-13 13:30:19 -04:00
David Barsky
7a6e1119af Update crates/rust-analyzer/src/handlers.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2023-03-13 13:30:19 -04:00
David Barsky
68d3eaead4 fix typo in package.json. 2023-03-13 13:30:19 -04:00
David Barsky
1f5c535089 remove errant -- in executeDiscoverProject 2023-03-13 13:30:19 -04:00
David Barsky
46e022098f fmt 2023-03-13 13:30:19 -04:00
David Barsky
8af3d6367e This commit add Cargo-style project discovery for Buck and Bazel users.
This feature requires the user to add a command that generates a
`rust-project.json` from a set of files. Project discovery can be invoked
in two ways:

1. At extension activation time, which includes the generated
   `rust-project.json` as part of the linkedProjects argument in
    InitializeParams
2. Through a new command titled "Add current file to workspace", which
   makes use of a new, rust-analyzer specific LSP request that adds
   the workspace without erasing any existing workspaces.

I think that the command-running functionality _could_ merit being
placed into its own extension (and expose it via extension contribution
points), if only provide build-system idiomatic progress reporting and
status handling, but I haven't (yet) made an extension that does this.
2023-03-13 13:30:18 -04:00
bors
544b4cfe4d Auto merge of #109069 - lnicola:rust-analyzer-2023-03-13, r=lnicola
⬆️ `rust-analyzer`

r? `@ghost`
2023-03-13 16:54:43 +00:00
Lukas Wirth
aaf08bdcc5 Shrink ProcMacroExpander size 2023-03-13 16:49:38 +01:00
Lukas Wirth
9fb9ee3b6a internal: Rename AstDatabase to ExpandDatabase 2023-03-13 16:35:41 +01:00
Lukas Wirth
228b44cb18 fix: Only skip adjustment hints for block, if and match expressions for reborrows 2023-03-13 16:10:49 +01:00
Swarnim Arun
cfbdf62344
fix: as suggested change remove_slice to as_slice 2023-03-13 17:28:37 +05:30
Lukas Wirth
cf95322541 Allow the status bar item to be clicked again 2023-03-13 12:32:53 +01:00
Swarnim Arun
34e3ea8cc8
feat: add remove_slice to hir::Type 2023-03-13 16:49:24 +05:30
Swarnim Arun
fe82649e77
feat: add is_float & is_char to hir::Type 2023-03-13 15:47:50 +05:30
Laurențiu Nicola
b2f6fd4f96 ⬆️ rust-analyzer 2023-03-13 10:42:24 +02:00
bors
9549753352 Auto merge of #14333 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2023-03-13 08:25:23 +00:00
Laurențiu Nicola
bdbd2a59b0 Merge branch 'master' into sync-from-rust 2023-03-13 10:21:53 +02:00
bors
f1e51afa45 Auto merge of #14328 - lnicola:build-scripts-extra-args, r=Veykril
fix: Pass flycheck extra args when running build scripts

Closes #14315

Not sure if we want to do it like this or to add an extra config key, though.
2023-03-12 15:19:29 +00:00
clubby789
c6da2f9d96 Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
Laurențiu Nicola
c3864eb511 Add and use rust-analyzer.cargo.extraArgs setting 2023-03-12 13:04:24 +02:00
Laurențiu Nicola
cfc9d5cd3b Pass flycheck extra args when running build scripts 2023-03-11 19:28:02 +02:00
bors
70e10deee8 Auto merge of #14326 - iDawer:refactor, r=Veykril
internal: Rename `hir::diagnostics::MissingMatchArms.match_expr` field

`hir::diagnostics::MissingMatchArms.match_expr` had confusing name: it is pointing to scrutinee expression. Renamed to `scrutinee_expr` and used better fitting type for it.

Also small refactorings/cleanup.
2023-03-11 07:36:00 +00:00
bors
6d42e75ce8 Auto merge of #14323 - ComputerDruid:fix_overlap_indexes, r=Veykril
Fix overlap deduping infinite loop

Fixes: #14276
2023-03-11 06:54:36 +00:00
Dan Johnson
2691143a67 Fix overlap deduping infinite loop
Fixes: 14276
2023-03-10 17:01:21 -08:00
iDawer
17b9d35b31 Refactor: Distinguish scrutinee expression from match expression 2023-03-10 18:43:50 +05:00
iDawer
5e8c586f3b Refactor hir::diagnostics::MissingMatchArms fields, better naming 2023-03-10 18:22:32 +05:00
iDawer
8f189f62c6 Remove unnecessary argument 2023-03-10 16:35:04 +05:00
iDawer
c38aa5f4f0 Use anonymous lifetimes 2023-03-10 16:16:28 +05:00
bors
9fca0a4afe Auto merge of #14316 - HKalbasi:master, r=HKalbasi
Fix stack overflow when derefrencing `&!`

fix #14310
2023-03-10 10:25:20 +00:00
hkalbasi
a980b562a7 Fix stack overflow when derefrencing &! 2023-03-10 13:44:34 +03:30
bors
070f8f8578 Auto merge of #14313 - Veykril:notifs, r=Veykril
Make project loading errors less intrusive

cc https://github.com/rust-lang/rust-analyzer/issues/14193 closes https://github.com/rust-lang/rust-analyzer/issues/9909

![image](https://user-images.githubusercontent.com/3757771/224274817-a5a8cb0c-7bda-454d-9772-5f839f360b9a.png)
2023-03-10 10:12:15 +00:00
Lukas Wirth
c03775e477 Fix is_quiescent reporting 2023-03-10 10:26:02 +01:00
Lukas Wirth
2cb60343ed Add fancy buttons to the vscode status message 2023-03-10 10:13:30 +01:00
Lukas Wirth
0d19ccb3df Make project loading errors less intrusive 2023-03-10 09:49:37 +01:00
bors
1b5bba4535 Auto merge of #14312 - HKalbasi:master, r=lnicola
Revert #14285

fix #14305
2023-03-10 08:34:27 +00:00
hkalbasi
71e1c025f8 Revert #14285 2023-03-10 11:57:30 +03:30
bors
552aea508d Auto merge of #14311 - Veykril:lib-diags, r=Veykril
internal: Don't attempt to calculate diagnostics in library crates

We already filtered these later on, but we might as well stop calculating them alltogether. This way we also show cargo diagnostics that occur outside of the workspace which can happen when something goes very wrong (and which usually then causes no check diagnostics to appear in the workspace at all)
2023-03-10 08:10:37 +00:00
Lukas Wirth
116775bc83 Don't attempt to calculate diagnostics in library crates 2023-03-10 09:08:20 +01:00
bors
14b9d182d5 Auto merge of #14306 - HKalbasi:master, r=HKalbasi
fix block with no termination in or patterns

fix #14298
2023-03-09 19:03:47 +00:00
hkalbasi
8593132a43 fix block with no termination in or patterns 2023-03-09 22:32:12 +03:30