about summary refs log tree commit diff
path: root/crates/rust-analyzer/src/cli
AgeCommit message (Collapse)AuthorLines
2021-03-07Make group imports configurableasv-1/+5
2021-03-02Switch from pico-args to xflagsAleksey Kladov-0/+1
2021-03-02Fix ProcMacroClient dropped too early in cliEdwin Cheng-9/+11
2021-02-237526: Renamed create ssr to ide_ssr.Chetan Khilosiya-1/+1
2021-02-16Merge #7690bors[bot]-40/+49
7690: Extract `fn load_workspace(…)` from `fn load_cargo(…)` r=matklad a=regexident Unfortunately in https://github.com/rust-analyzer/rust-analyzer/pull/7595 I forgot to `pub use` (rather than just `use`) the newly introduced `LoadCargoConfig`. So this PR fixes this now. It also: - splits up `fn load_cargo` into a "workspace loading" and a "project loading" phase - adds a `progress: &dyn Fn(String)` to allow third-parties to provide CLI progress updates, too The motivation behind both of these is the fact that rust-analyzer currently does not support caching. As such any third-party making use of `ra_ap_…` needs to providing a caching layer itself. Unlike for rust-analyzer itself however a common use-pattern of third-parties is to analyze a specific target (`--lib`/`--bin <BIN>`/…) from a specific package (`--package`). The targets/packages of a crate can be obtained via `ProjectWorkspace::load(…)`, which currently is performed inside of `fn load_cargo`, effectively making the returned `ProjectWorkspace` inaccessible to the outer caller. With this information one can then provide early error handling via CLI (in case of ambiguities or invalid arguments, etc), instead of `fn load_cargo` failing with a possibly obscure error message. It also allows for annotating the persisted caches with its specific associated package/target selector and short-circuit quickly if a matching cache is found on disk, significantly cutting load times. Before: ```rust pub struct LoadCargoConfig { pub cargo_config: &CargoConfig, pub load_out_dirs_from_check: bool, pub with_proc_macro: bool, } pub fn load_cargo( root: &Path, config: &LoadCargoConfig ) -> Result<(AnalysisHost, vfs::Vfs)> { // ... } ``` After: ```rust pub fn load_workspace( root: &Path, config: &CargoConfig, progress: &dyn Fn(String), ) -> Result<ProjectWorkspace> { // ... } pub struct LoadCargoConfig { pub load_out_dirs_from_check: bool, pub with_proc_macro: bool, } pub fn load_cargo( ws: ProjectWorkspace, config: &LoadCargoConfig, progress: &dyn Fn(String), ) -> Result<(AnalysisHost, vfs::Vfs)> { // ... } ``` Co-authored-by: Vincent Esche <regexident@gmail.com>
2021-02-16Make utf8 default, implement utf16 in terms of itAleksey Kladov-2/+2
2021-02-16Prepare for utf-8 offsetsAleksey Kladov-6/+6
2021-02-16Split `pub fn cargo_load` into `pub fn load_workspace_at` and `pub fn ↵Vincent Esche-40/+49
load_workspace`
2021-02-12Fix slow tests sometimes failingFlorian Diebold-2/+6
In some situations we reloaded the workspace in the tests after having reported to be ready. There's two fixes here: 1. Add a version to the VFS config and include that version in progress reports, so that we don't think we're done prematurely; 2. Delay status transitions until after changes are applied. Otherwise the last change during loading can potentially trigger a workspace reload, if it contains interesting changes.
2021-02-08Consolidate `fn load_cargo(…)` parameters into `struct LoadCargoConfig ↵Vincent Esche-31/+70
{ … }`
2021-02-08Add `config: &CargoConfig` parameter to `fn load_cargo(…)`Vincent Esche-7/+18
2021-01-29Async Loading outdir and proc-macroEdwin Cheng-13/+23
2021-01-26Add config option to ignore directoriesAleksey Kladov-1/+1
2021-01-21Include `countme` crate to count important data structures.Aleksey Kladov-0/+5
2021-01-18Merge #7297 #7338bors[bot]-1/+1
7297: Propose trait associated items and autoimport traits on completion r=matklad a=SomeoneToIgnore ![trait_imports](https://user-images.githubusercontent.com/2690773/104819998-6faeb480-583a-11eb-8b45-b7351b51b90e.gif) Closes #7248 7338: Parse `impl const Trait` r=Veykril a=Veykril Closes #7313 bors r+ Co-authored-by: Kirill Bulatov <mail4score@gmail.com> Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18Avoid blocking the main loop when editing Cargo.tomlAleksey Kladov-1/+1
I've noticed a bunch of "main loop too long" warnings in console when typing in Cargo.toml. Profiling showed that the culprit is `rustc --print cfg` call. I moved it to the background project loading phase, where it belongs. This highlighted a problem: we generally use single `cfg`, while it really should be per crate.
2021-01-16Add flyimport completion for trait assoc itemsKirill Bulatov-1/+1
2021-01-16Share import_assets and related entitiesKirill Bulatov-2/+3
2021-01-14Phase out SourceFileEdits in favour of a plain HashMapLukas Wirth-1/+1
2021-01-14Group file source edits by FileIdLukas Wirth-4/+4
2021-01-11Improve analysis stats legibilityAleksey Kladov-20/+17
2021-01-10Make default memory stats less verboseAleksey Kladov-1/+1
2021-01-08Report progress for cargo metadata and output-dirEdwin Cheng-0/+1
2021-01-06Align config's API with usageAleksey Kladov-4/+14
The config now is mostly immutable, optimize for that.
2021-01-02Only log path and syntax range when processing function if source existsNick Spain-6/+6
2021-01-02Mark HasSource::source_old as deprecated but allow at all call sitesNick Spain-0/+1
2021-01-02HasSource::source -> HasSource::source_oldNick Spain-1/+1
To start migrating HasSource::source to return an Option.
2020-12-24Flush stdout when clearing the progress barLaurențiu Nicola-3/+5
2020-12-11Move print_memory_usage to cli.rsJonas Schievink-9/+4
2020-12-09Fix "no value set for FileTextQuery(FileId(..))"Jonas Schievink-1/+1
2020-12-08Make `original_range` a method on `InFile<&SyntaxNode>`Jonas Schievink-2/+2
2020-12-07Remove dummy ProcMacroClient in favor of OptionJonas Schievink-3/+3
2020-12-04Fix `diagnostics` subcommand, look at all modulesJonas Schievink-11/+18
2020-11-13Cleanup workspace loading a tiny bitAleksey Kladov-1/+0
2020-11-02Remove more unreachable pubsAleksey Kladov-8/+8
2020-10-24Re-export base_db from ide_dbIgor Aleksanov-12/+12
2020-10-20Rename declaration_name -> display_nameAleksey Kladov-6/+2
Declaration names sounds like a name of declaration -- something you can use for analysis. It empathically isn't, and is just a label displayed in various UI. It's important not to confuse the two, least we accidentally mix semantics with UI (I believe, there's already a case of this in the FamousDefs at least).
2020-10-02Properly name the fieldKirill Bulatov-5/+6
2020-10-02Move ide::AnalysisChange -> base_db::ChangeAleksey Kladov-6/+5
This seems like a better factoring logically; ideally, clients shouldn't touch `set_` methods of the database directly. Additionally, I think this should remove the unfortunate duplication in fixture code.
2020-08-26Simplify helpAleksey Kladov-6/+1
2020-08-18Align diagnostics config with the rest of rust-analyzerAleksey Kladov-4/+8
2020-08-18Make disabled diagnostics an argument of corresponding functionIgor Aleksanov-2/+2
2020-08-13Rename ra_ide -> ideAleksey Kladov-3/+3
2020-08-13Rename ra_ssr -> ssrAleksey Kladov-1/+1
2020-08-13Rename ra_ide_db -> ide_dbAleksey Kladov-1/+1
2020-08-13Rename ra_db -> base_dbAleksey Kladov-9/+9
2020-08-13Rename ra_project_model -> project_modelPavan Kumar Sunkara-1/+1
2020-08-12Rename ra_syntax -> syntaxAleksey Kladov-1/+1
2020-08-12Rename ra_prof -> profileAleksey Kladov-2/+2
2020-08-09Remove Option<...> from result of Crate::root_modulePaul Daniel Faria-2/+2
There doesn't seem to be any need for it, and removing it simplies several paths of code that depend on it.