rust/crates
bors[bot] 05fc97e31b
Merge #8955
8955: feature: Support standalone Rust files r=matklad a=SomeoneToIgnore

![standalone](https://user-images.githubusercontent.com/2690773/119277037-0b579380-bc26-11eb-8d77-20d46ab4916a.gif)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/6388

Caveats: 

* I've decided to support multiple detached files in the code (anticipating the scratch files), but I found no way to open multiple files in VSCode at once: running `code *.rs` makes the plugin to register in the `vscode.workspace.textDocuments` only the first file, while code actually displays all files later.
Apparently what happens is the same as when you have VSCode open at some workplace already and then run `code some_other_file.rs`: it gets opened in the same workspace of the same VSCode with no server to support it.
If there's a way to override it, I'd appreciate the pointer.

* No way to toggle inlay hints, since the setting is updated for the workspace (which does not exist for a single file opened)
> [2021-05-24 00:22:49.100] [exthost] [error] Error: Unable to write to Workspace Settings because no workspace is opened. Please open a workspace first and try again.

* No runners/lens to run or check the code are implemented for this mode. 
In theory, we can detect `rustc`, run it on a file and run the resulting binary, but not sure if worth doing it at this stage.

Otherwise imports, hints, completion and other features work.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-05-24 12:40:25 +00:00
..
base_db Add one more profiling span to add_dep 2021-04-22 21:48:17 +03:00
cfg internal: expose cfg attrs from hir::Crate 2021-05-07 23:50:24 +03:00
flycheck Use package root as cargo check working directory 2021-05-12 19:50:52 -07:00
hir Merge #8945 2021-05-23 21:55:51 +00:00
hir_def Merge #8945 2021-05-23 21:55:51 +00:00
hir_expand Add even more docs 2021-05-22 17:20:22 +03:00
hir_ty Record method call substs and use them in call info 2021-05-23 18:24:21 +02:00
ide Correctly resolve crate name in use paths when import shadows itself 2021-05-23 19:37:01 +02:00
ide_assists Merge #8945 2021-05-23 21:55:51 +00:00
ide_completion Get rid of field_type again 2021-05-23 23:54:35 +02:00
ide_db Merge #8945 2021-05-23 21:55:51 +00:00
ide_ssr syntax: return owned string instead of leaking string 2021-03-26 18:30:59 +01:00
mbe Add even more docs 2021-05-22 17:20:22 +03:00
parser Add even more docs 2021-05-22 17:20:22 +03:00
paths Clearer naming 2021-04-06 16:22:26 +03:00
proc_macro_api Replace memmap to memmap2 in proc_macro_api 2021-05-03 20:20:47 -04:00
proc_macro_srv Fix parse u128 bug in proc-macro 2021-03-31 19:50:36 +08:00
proc_macro_test Add description for crates that will be published 2020-08-24 13:07:22 +02:00
profile Add more docs 2021-05-22 16:53:47 +03:00
project_model Add a FIXME 2021-05-24 14:52:57 +03:00
rust-analyzer Don't discover workspaces when detached files are given 2021-05-24 00:09:24 +03:00
stdx Don't compare ast::Visibility by stringifying 2021-05-20 17:45:59 +02:00
syntax Add more docs 2021-05-22 16:53:47 +03:00
test_utils internal: use API stabilized in 1.52 2021-05-06 20:12:15 +03:00
text_edit Avoid turning completion objects into builders 2020-11-16 23:16:41 +02:00
toolchain Add description for crates that will be published 2020-08-24 13:07:22 +02:00
tt Add more docs 2021-05-22 16:53:47 +03:00
vfs Avoid duplicating VfsPath in vfs::path_interner::PathInterner by using an IndexSet 2021-04-06 16:03:57 +03:00
vfs-notify Fix slow tests sometimes failing 2021-02-12 16:31:16 +01:00