diff options
18 files changed, 40 insertions, 43 deletions
diff --git a/Cargo.lock b/Cargo.lock index 18c979b39..f72d9e022 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -939,6 +939,25 @@ dependencies = [ | |||
939 | ] | 939 | ] |
940 | 940 | ||
941 | [[package]] | 941 | [[package]] |
942 | name = "project_model" | ||
943 | version = "0.0.0" | ||
944 | dependencies = [ | ||
945 | "anyhow", | ||
946 | "arena", | ||
947 | "cargo_metadata", | ||
948 | "cfg", | ||
949 | "log", | ||
950 | "paths", | ||
951 | "ra_db", | ||
952 | "ra_proc_macro", | ||
953 | "rustc-hash", | ||
954 | "serde", | ||
955 | "serde_json", | ||
956 | "stdx", | ||
957 | "toolchain", | ||
958 | ] | ||
959 | |||
960 | [[package]] | ||
942 | name = "quote" | 961 | name = "quote" |
943 | version = "1.0.7" | 962 | version = "1.0.7" |
944 | source = "registry+https://github.com/rust-lang/crates.io-index" | 963 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1135,25 +1154,6 @@ dependencies = [ | |||
1135 | ] | 1154 | ] |
1136 | 1155 | ||
1137 | [[package]] | 1156 | [[package]] |
1138 | name = "ra_project_model" | ||
1139 | version = "0.1.0" | ||
1140 | dependencies = [ | ||
1141 | "anyhow", | ||
1142 | "arena", | ||
1143 | "cargo_metadata", | ||
1144 | "cfg", | ||
1145 | "log", | ||
1146 | "paths", | ||
1147 | "ra_db", | ||
1148 | "ra_proc_macro", | ||
1149 | "rustc-hash", | ||
1150 | "serde", | ||
1151 | "serde_json", | ||
1152 | "stdx", | ||
1153 | "toolchain", | ||
1154 | ] | ||
1155 | |||
1156 | [[package]] | ||
1157 | name = "ra_ssr" | 1157 | name = "ra_ssr" |
1158 | version = "0.1.0" | 1158 | version = "0.1.0" |
1159 | dependencies = [ | 1159 | dependencies = [ |
@@ -1257,13 +1257,13 @@ dependencies = [ | |||
1257 | "pico-args", | 1257 | "pico-args", |
1258 | "proc_macro_srv", | 1258 | "proc_macro_srv", |
1259 | "profile", | 1259 | "profile", |
1260 | "project_model", | ||
1260 | "ra_db", | 1261 | "ra_db", |
1261 | "ra_hir", | 1262 | "ra_hir", |
1262 | "ra_hir_def", | 1263 | "ra_hir_def", |
1263 | "ra_hir_ty", | 1264 | "ra_hir_ty", |
1264 | "ra_ide", | 1265 | "ra_ide", |
1265 | "ra_ide_db", | 1266 | "ra_ide_db", |
1266 | "ra_project_model", | ||
1267 | "ra_ssr", | 1267 | "ra_ssr", |
1268 | "rayon", | 1268 | "rayon", |
1269 | "rustc-hash", | 1269 | "rustc-hash", |
diff --git a/crates/ra_project_model/Cargo.toml b/crates/project_model/Cargo.toml index 52f2d57b3..8d8d09387 100644 --- a/crates/ra_project_model/Cargo.toml +++ b/crates/project_model/Cargo.toml | |||
@@ -1,9 +1,9 @@ | |||
1 | [package] | 1 | [package] |
2 | edition = "2018" | 2 | name = "project_model" |
3 | name = "ra_project_model" | 3 | version = "0.0.0" |
4 | version = "0.1.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | license = "MIT OR Apache-2.0" | 4 | license = "MIT OR Apache-2.0" |
5 | authors = ["rust-analyzer developers"] | ||
6 | edition = "2018" | ||
7 | 7 | ||
8 | [lib] | 8 | [lib] |
9 | doctest = false | 9 | doctest = false |
@@ -11,8 +11,10 @@ doctest = false | |||
11 | [dependencies] | 11 | [dependencies] |
12 | log = "0.4.8" | 12 | log = "0.4.8" |
13 | rustc-hash = "1.1.0" | 13 | rustc-hash = "1.1.0" |
14 | |||
15 | cargo_metadata = "0.11.1" | 14 | cargo_metadata = "0.11.1" |
15 | serde = { version = "1.0.106", features = ["derive"] } | ||
16 | serde_json = "1.0.48" | ||
17 | anyhow = "1.0.26" | ||
16 | 18 | ||
17 | arena = { path = "../arena" } | 19 | arena = { path = "../arena" } |
18 | cfg = { path = "../cfg" } | 20 | cfg = { path = "../cfg" } |
@@ -21,8 +23,3 @@ toolchain = { path = "../toolchain" } | |||
21 | ra_proc_macro = { path = "../ra_proc_macro" } | 23 | ra_proc_macro = { path = "../ra_proc_macro" } |
22 | paths = { path = "../paths" } | 24 | paths = { path = "../paths" } |
23 | stdx = { path = "../stdx" } | 25 | stdx = { path = "../stdx" } |
24 | |||
25 | serde = { version = "1.0.106", features = ["derive"] } | ||
26 | serde_json = "1.0.48" | ||
27 | |||
28 | anyhow = "1.0.26" | ||
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs index abf8dca96..abf8dca96 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/project_model/src/cargo_workspace.rs | |||
diff --git a/crates/ra_project_model/src/cfg_flag.rs b/crates/project_model/src/cfg_flag.rs index e92962cf6..e92962cf6 100644 --- a/crates/ra_project_model/src/cfg_flag.rs +++ b/crates/project_model/src/cfg_flag.rs | |||
diff --git a/crates/ra_project_model/src/lib.rs b/crates/project_model/src/lib.rs index ee42198f3..ee42198f3 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/project_model/src/lib.rs | |||
diff --git a/crates/ra_project_model/src/project_json.rs b/crates/project_model/src/project_json.rs index e3f3163f6..e3f3163f6 100644 --- a/crates/ra_project_model/src/project_json.rs +++ b/crates/project_model/src/project_json.rs | |||
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/project_model/src/sysroot.rs index 8239797b6..8239797b6 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/project_model/src/sysroot.rs | |||
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 440b1cd13..c6102bf27 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -37,7 +37,7 @@ lsp-server = "0.3.3" | |||
37 | flycheck = { path = "../flycheck" } | 37 | flycheck = { path = "../flycheck" } |
38 | ra_ide = { path = "../ra_ide" } | 38 | ra_ide = { path = "../ra_ide" } |
39 | profile = { path = "../profile" } | 39 | profile = { path = "../profile" } |
40 | ra_project_model = { path = "../ra_project_model" } | 40 | project_model = { path = "../project_model" } |
41 | syntax = { path = "../syntax" } | 41 | syntax = { path = "../syntax" } |
42 | text_edit = { path = "../text_edit" } | 42 | text_edit = { path = "../text_edit" } |
43 | vfs = { path = "../vfs" } | 43 | vfs = { path = "../vfs" } |
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index f177f8709..bade31ca2 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs | |||
@@ -6,7 +6,7 @@ mod args; | |||
6 | use std::{convert::TryFrom, process}; | 6 | use std::{convert::TryFrom, process}; |
7 | 7 | ||
8 | use lsp_server::Connection; | 8 | use lsp_server::Connection; |
9 | use ra_project_model::ProjectManifest; | 9 | use project_model::ProjectManifest; |
10 | use rust_analyzer::{ | 10 | use rust_analyzer::{ |
11 | cli, | 11 | cli, |
12 | config::{Config, LinkedProject}, | 12 | config::{Config, LinkedProject}, |
diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs index 9c7a9cce6..5ba30dbad 100644 --- a/crates/rust-analyzer/src/cargo_target_spec.rs +++ b/crates/rust-analyzer/src/cargo_target_spec.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | //! See `CargoTargetSpec` | 1 | //! See `CargoTargetSpec` |
2 | 2 | ||
3 | use cfg::CfgExpr; | 3 | use cfg::CfgExpr; |
4 | use project_model::{self, TargetKind}; | ||
4 | use ra_ide::{FileId, RunnableKind, TestId}; | 5 | use ra_ide::{FileId, RunnableKind, TestId}; |
5 | use ra_project_model::{self, TargetKind}; | ||
6 | use vfs::AbsPathBuf; | 6 | use vfs::AbsPathBuf; |
7 | 7 | ||
8 | use crate::{global_state::GlobalStateSnapshot, Result}; | 8 | use crate::{global_state::GlobalStateSnapshot, Result}; |
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index a43bf2244..f6cb144c6 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs | |||
@@ -4,9 +4,9 @@ use std::{path::Path, sync::Arc}; | |||
4 | 4 | ||
5 | use anyhow::Result; | 5 | use anyhow::Result; |
6 | use crossbeam_channel::{unbounded, Receiver}; | 6 | use crossbeam_channel::{unbounded, Receiver}; |
7 | use project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace}; | ||
7 | use ra_db::CrateGraph; | 8 | use ra_db::CrateGraph; |
8 | use ra_ide::{AnalysisChange, AnalysisHost}; | 9 | use ra_ide::{AnalysisChange, AnalysisHost}; |
9 | use ra_project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace}; | ||
10 | use vfs::{loader::Handle, AbsPath, AbsPathBuf}; | 10 | use vfs::{loader::Handle, AbsPath, AbsPathBuf}; |
11 | 11 | ||
12 | use crate::reload::{ProjectFolders, SourceRootConfig}; | 12 | use crate::reload::{ProjectFolders, SourceRootConfig}; |
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 70b4512d0..bfc84147c 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -11,8 +11,8 @@ use std::{ffi::OsString, path::PathBuf}; | |||
11 | 11 | ||
12 | use flycheck::FlycheckConfig; | 12 | use flycheck::FlycheckConfig; |
13 | use lsp_types::ClientCapabilities; | 13 | use lsp_types::ClientCapabilities; |
14 | use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest}; | ||
14 | use ra_ide::{AssistConfig, CompletionConfig, HoverConfig, InlayHintsConfig}; | 15 | use ra_ide::{AssistConfig, CompletionConfig, HoverConfig, InlayHintsConfig}; |
15 | use ra_project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest}; | ||
16 | use serde::Deserialize; | 16 | use serde::Deserialize; |
17 | use vfs::AbsPathBuf; | 17 | use vfs::AbsPathBuf; |
18 | 18 | ||
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 8c115c8a6..2e8b708d0 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs | |||
@@ -9,9 +9,9 @@ use crossbeam_channel::{unbounded, Receiver, Sender}; | |||
9 | use flycheck::FlycheckHandle; | 9 | use flycheck::FlycheckHandle; |
10 | use lsp_types::{SemanticTokens, Url}; | 10 | use lsp_types::{SemanticTokens, Url}; |
11 | use parking_lot::{Mutex, RwLock}; | 11 | use parking_lot::{Mutex, RwLock}; |
12 | use project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target}; | ||
12 | use ra_db::{CrateId, VfsPath}; | 13 | use ra_db::{CrateId, VfsPath}; |
13 | use ra_ide::{Analysis, AnalysisChange, AnalysisHost, FileId}; | 14 | use ra_ide::{Analysis, AnalysisChange, AnalysisHost, FileId}; |
14 | use ra_project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target}; | ||
15 | use rustc_hash::FxHashMap; | 15 | use rustc_hash::FxHashMap; |
16 | 16 | ||
17 | use crate::{ | 17 | use crate::{ |
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 86e7833f2..4b5ca7eec 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -18,11 +18,11 @@ use lsp_types::{ | |||
18 | SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, SymbolTag, | 18 | SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, SymbolTag, |
19 | TextDocumentIdentifier, Url, WorkspaceEdit, | 19 | TextDocumentIdentifier, Url, WorkspaceEdit, |
20 | }; | 20 | }; |
21 | use project_model::TargetKind; | ||
21 | use ra_ide::{ | 22 | use ra_ide::{ |
22 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, | 23 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, |
23 | RangeInfo, Runnable, RunnableKind, SearchScope, TextEdit, | 24 | RangeInfo, Runnable, RunnableKind, SearchScope, TextEdit, |
24 | }; | 25 | }; |
25 | use ra_project_model::TargetKind; | ||
26 | use serde::{Deserialize, Serialize}; | 26 | use serde::{Deserialize, Serialize}; |
27 | use serde_json::to_value; | 27 | use serde_json::to_value; |
28 | use stdx::{format_to, split_once}; | 28 | use stdx::{format_to, split_once}; |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 32962b088..9a779cb14 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -21,7 +21,7 @@ use crate::{ | |||
21 | lsp_utils::{apply_document_changes, is_canceled, notification_is, Progress}, | 21 | lsp_utils::{apply_document_changes, is_canceled, notification_is, Progress}, |
22 | Result, | 22 | Result, |
23 | }; | 23 | }; |
24 | use ra_project_model::ProjectWorkspace; | 24 | use project_model::ProjectWorkspace; |
25 | use vfs::ChangeKind; | 25 | use vfs::ChangeKind; |
26 | 26 | ||
27 | pub fn main_loop(config: Config, connection: Connection) -> Result<()> { | 27 | pub fn main_loop(config: Config, connection: Connection) -> Result<()> { |
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index 611c9a89f..640417dc6 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs | |||
@@ -2,9 +2,9 @@ | |||
2 | use std::{mem, sync::Arc}; | 2 | use std::{mem, sync::Arc}; |
3 | 3 | ||
4 | use flycheck::FlycheckHandle; | 4 | use flycheck::FlycheckHandle; |
5 | use project_model::{ProcMacroClient, ProjectWorkspace}; | ||
5 | use ra_db::{CrateGraph, SourceRoot, VfsPath}; | 6 | use ra_db::{CrateGraph, SourceRoot, VfsPath}; |
6 | use ra_ide::AnalysisChange; | 7 | use ra_ide::AnalysisChange; |
7 | use ra_project_model::{ProcMacroClient, ProjectWorkspace}; | ||
8 | use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind}; | 8 | use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind}; |
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
@@ -98,14 +98,14 @@ impl GlobalState { | |||
98 | .iter() | 98 | .iter() |
99 | .map(|project| match project { | 99 | .map(|project| match project { |
100 | LinkedProject::ProjectManifest(manifest) => { | 100 | LinkedProject::ProjectManifest(manifest) => { |
101 | ra_project_model::ProjectWorkspace::load( | 101 | project_model::ProjectWorkspace::load( |
102 | manifest.clone(), | 102 | manifest.clone(), |
103 | &cargo_config, | 103 | &cargo_config, |
104 | with_sysroot, | 104 | with_sysroot, |
105 | ) | 105 | ) |
106 | } | 106 | } |
107 | LinkedProject::InlineJsonProject(it) => { | 107 | LinkedProject::InlineJsonProject(it) => { |
108 | Ok(ra_project_model::ProjectWorkspace::Json { project: it.clone() }) | 108 | Ok(project_model::ProjectWorkspace::Json { project: it.clone() }) |
109 | } | 109 | } |
110 | }) | 110 | }) |
111 | .collect::<Vec<_>>(); | 111 | .collect::<Vec<_>>(); |
diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs index 15866fbb1..5bafeba79 100644 --- a/crates/rust-analyzer/tests/heavy_tests/support.rs +++ b/crates/rust-analyzer/tests/heavy_tests/support.rs | |||
@@ -12,7 +12,7 @@ use lsp_types::{ | |||
12 | notification::Exit, request::Shutdown, TextDocumentIdentifier, Url, WorkDoneProgress, | 12 | notification::Exit, request::Shutdown, TextDocumentIdentifier, Url, WorkDoneProgress, |
13 | }; | 13 | }; |
14 | use lsp_types::{ProgressParams, ProgressParamsValue}; | 14 | use lsp_types::{ProgressParams, ProgressParamsValue}; |
15 | use ra_project_model::ProjectManifest; | 15 | use project_model::ProjectManifest; |
16 | use rust_analyzer::{ | 16 | use rust_analyzer::{ |
17 | config::{ClientCapsConfig, Config, FilesConfig, FilesWatcher, LinkedProject}, | 17 | config::{ClientCapsConfig, Config, FilesConfig, FilesWatcher, LinkedProject}, |
18 | main_loop, | 18 | main_loop, |
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index 0188aaa2e..2e68e71db 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs | |||
@@ -198,7 +198,7 @@ impl TidyDocs { | |||
198 | "mbe", | 198 | "mbe", |
199 | "parser", | 199 | "parser", |
200 | "profile", | 200 | "profile", |
201 | "ra_project_model", | 201 | "project_model", |
202 | "syntax", | 202 | "syntax", |
203 | "tt", | 203 | "tt", |
204 | "ra_hir_ty", | 204 | "ra_hir_ty", |