From 74c26a785ad8e8ef857b903d3639beb623077933 Mon Sep 17 00:00:00 2001 From: Aaron Wood Date: Tue, 15 Sep 2020 18:51:57 -0700 Subject: Add support for custom flycheck commands with JSON project workspaces Enable flychecks with JSON project workspaces if an override command was provided as part of the client configuration. --- crates/project_model/src/project_json.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'crates/project_model/src') diff --git a/crates/project_model/src/project_json.rs b/crates/project_model/src/project_json.rs index 979e90058..545f254aa 100644 --- a/crates/project_model/src/project_json.rs +++ b/crates/project_model/src/project_json.rs @@ -13,6 +13,7 @@ use crate::cfg_flag::CfgFlag; #[derive(Clone, Debug, Eq, PartialEq)] pub struct ProjectJson { pub(crate) sysroot_src: Option, + project_root: Option, crates: Vec, } @@ -36,6 +37,7 @@ impl ProjectJson { pub fn new(base: &AbsPath, data: ProjectJsonData) -> ProjectJson { ProjectJson { sysroot_src: data.sysroot_src.map(|it| base.join(it)), + project_root: base.parent().map(AbsPath::to_path_buf), crates: data .crates .into_iter() @@ -89,6 +91,12 @@ impl ProjectJson { pub fn crates(&self) -> impl Iterator + '_ { self.crates.iter().enumerate().map(|(idx, krate)| (CrateId(idx as u32), krate)) } + pub fn path(&self) -> Option<&AbsPath> { + match &self.project_root { + Some(p) => Some(p.as_path()), + None => None, + } + } } #[derive(Deserialize)] -- cgit v1.2.3