-
Notifications
You must be signed in to change notification settings - Fork 279
Pluggable project model #910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
r? @kngwyu :) |
Great! But, I think it's better to merge this PR after implementing |
src/racer/project_model.rs
Outdated
@@ -0,0 +1,216 @@ | |||
use std::path::{Path, PathBuf}; | |||
|
|||
pub trait RacerProjectModelProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need Racer
prefix here?
From other crates it looks racer::RacerProjectModelProvider
src/racer/project_model.rs
Outdated
if self.get_deps(manifest).is_none() { | ||
// cache doesn't exist | ||
// calculating depedencies can be bottleneck we use info! here(kngwyu) | ||
info!("[get_outer_crates] cache doesn't exist"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change function name here?
src/racer/project_model.rs
Outdated
self.cache_deps(manifest, deps_map); | ||
} | ||
let deps = self.get_deps(manifest).unwrap(); | ||
debug!("[get_outer_crates] cache exists for manifest",); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, please change function name in debug!.
src/racer/project_model.rs
Outdated
let deps_map = self.resolve_dependencies(&manifest)?; | ||
self.cache_deps(manifest, deps_map); | ||
} | ||
let deps = self.get_deps(manifest).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why call self.get_deps
twice here
I left some comments, but for the whole code, it looks good to me. |
The RLS sideof things is rust-lang/rls#956. It's super ugly atm, but at least it works! Will look into clean-up of the racer implementation next! Thanks for the review. |
This is mainly for RLS which would love to be a single source of truth for project info, and which would rather link to a single copy of Cargo. However, it might also be possible to use other things as sources of project information, for example, `cargo metadata` or Bazel/Buck build rules.
Rebased and cleaned-up. The RLS side is super incomplete and ugly, but it works, and indeed get's rid of one Cargo :-) |
Now looks good enough to merge 👍 |
This is a WIP at abstracting the project model, as proposed in #855 (comment).
I hope that it'll solve rust-lang/rls#956, but I haven't implemented the RLS side of things yet, so there's a chance that this whole approach breaks down.
Nevertheless, I figured I'd just toss it over the fence for now to see what the folks think :)