publish gen_lsp_server 0.2

This commit is contained in:
Aleksey Kladov 2019-05-21 18:57:33 +03:00
parent 9f03c07812
commit 26463f189f
3 changed files with 20 additions and 19 deletions

4
Cargo.lock generated
View file

@ -487,7 +487,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "gen_lsp_server" name = "gen_lsp_server"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1165,7 +1165,7 @@ dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"flexi_logger 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", "flexi_logger 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gen_lsp_server 0.1.0", "gen_lsp_server 0.2.0",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lsp-types 0.57.1 (registry+https://github.com/rust-lang/crates.io-index)", "lsp-types 0.57.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -1,7 +1,7 @@
[package] [package]
edition = "2018" edition = "2018"
name = "gen_lsp_server" name = "gen_lsp_server"
version = "0.1.0" version = "0.2.0"
authors = ["rust-analyzer developers"] authors = ["rust-analyzer developers"]
repository = "https://github.com/rust-analyzer/rust-analyzer" repository = "https://github.com/rust-analyzer/rust-analyzer"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"

View file

@ -78,23 +78,24 @@ pub enum Obligation {
/// Check using Chalk whether trait is implemented for given parameters including `Self` type. /// Check using Chalk whether trait is implemented for given parameters including `Self` type.
pub(crate) fn implements_query( pub(crate) fn implements_query(
db: &impl HirDatabase, _db: &impl HirDatabase,
krate: Crate, _krate: Crate,
trait_ref: Canonical<TraitRef>, _trait_ref: Canonical<TraitRef>,
) -> Option<Solution> { ) -> Option<Solution> {
let _p = profile("implements_query"); return None;
let goal: chalk_ir::Goal = trait_ref.value.to_chalk(db).cast(); // let _p = profile("implements_query");
debug!("goal: {:?}", goal); // let goal: chalk_ir::Goal = trait_ref.value.to_chalk(db).cast();
let env = chalk_ir::Environment::new(); // debug!("goal: {:?}", goal);
let in_env = chalk_ir::InEnvironment::new(&env, goal); // let env = chalk_ir::Environment::new();
let parameter = chalk_ir::ParameterKind::Ty(chalk_ir::UniverseIndex::ROOT); // let in_env = chalk_ir::InEnvironment::new(&env, goal);
let canonical = // let parameter = chalk_ir::ParameterKind::Ty(chalk_ir::UniverseIndex::ROOT);
chalk_ir::Canonical { value: in_env, binders: vec![parameter; trait_ref.num_vars] }; // let canonical =
// We currently don't deal with universes (I think / hope they're not yet // chalk_ir::Canonical { value: in_env, binders: vec![parameter; trait_ref.num_vars] };
// relevant for our use cases?) // // We currently don't deal with universes (I think / hope they're not yet
let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 }; // // relevant for our use cases?)
let solution = solve(db, krate, &u_canonical); // let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 };
solution.map(|solution| solution_from_chalk(db, solution)) // let solution = solve(db, krate, &u_canonical);
// solution.map(|solution| solution_from_chalk(db, solution))
} }
fn solution_from_chalk(db: &impl HirDatabase, solution: chalk_solve::Solution) -> Solution { fn solution_from_chalk(db: &impl HirDatabase, solution: chalk_solve::Solution) -> Solution {