aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r--crates/ra_lsp_server/Cargo.toml1
-rw-r--r--crates/ra_lsp_server/src/world.rs8
-rw-r--r--crates/ra_lsp_server/tests/heavy_tests/main.rs8
3 files changed, 14 insertions, 3 deletions
diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml
index 677d81835..aedc55a95 100644
--- a/crates/ra_lsp_server/Cargo.toml
+++ b/crates/ra_lsp_server/Cargo.toml
@@ -19,6 +19,7 @@ jod-thread = "0.1.0"
19ra_vfs = "0.4.0" 19ra_vfs = "0.4.0"
20ra_syntax = { path = "../ra_syntax" } 20ra_syntax = { path = "../ra_syntax" }
21ra_db = { path = "../ra_db" } 21ra_db = { path = "../ra_db" }
22ra_cfg = { path = "../ra_cfg" }
22ra_text_edit = { path = "../ra_text_edit" } 23ra_text_edit = { path = "../ra_text_edit" }
23ra_ide_api = { path = "../ra_ide_api" } 24ra_ide_api = { path = "../ra_ide_api" }
24lsp-server = "0.2.0" 25lsp-server = "0.2.0"
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs
index b55046ec9..27da751ab 100644
--- a/crates/ra_lsp_server/src/world.rs
+++ b/crates/ra_lsp_server/src/world.rs
@@ -13,7 +13,7 @@ use ra_ide_api::{
13 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FeatureFlags, FileId, LibraryData, 13 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FeatureFlags, FileId, LibraryData,
14 SourceRootId, 14 SourceRootId,
15}; 15};
16use ra_project_model::ProjectWorkspace; 16use ra_project_model::{get_rustc_cfg_options, ProjectWorkspace};
17use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot, VfsTask, Watch}; 17use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot, VfsTask, Watch};
18use ra_vfs_glob::{Glob, RustPackageFilterBuilder}; 18use ra_vfs_glob::{Glob, RustPackageFilterBuilder};
19use relative_path::RelativePathBuf; 19use relative_path::RelativePathBuf;
@@ -97,6 +97,10 @@ impl WorldState {
97 change.set_debug_root_path(SourceRootId(r.0), vfs_root_path.display().to_string()); 97 change.set_debug_root_path(SourceRootId(r.0), vfs_root_path.display().to_string());
98 } 98 }
99 99
100 // FIXME: Read default cfgs from config
101 let default_cfg_options =
102 get_rustc_cfg_options().atom("test".into()).atom("debug_assertion".into());
103
100 // Create crate graph from all the workspaces 104 // Create crate graph from all the workspaces
101 let mut crate_graph = CrateGraph::default(); 105 let mut crate_graph = CrateGraph::default();
102 let mut load = |path: &std::path::Path| { 106 let mut load = |path: &std::path::Path| {
@@ -104,7 +108,7 @@ impl WorldState {
104 vfs_file.map(|f| FileId(f.0)) 108 vfs_file.map(|f| FileId(f.0))
105 }; 109 };
106 for ws in workspaces.iter() { 110 for ws in workspaces.iter() {
107 let (graph, crate_names) = ws.to_crate_graph(&mut load); 111 let (graph, crate_names) = ws.to_crate_graph(&default_cfg_options, &mut load);
108 let shift = crate_graph.extend(graph); 112 let shift = crate_graph.extend(graph);
109 for (crate_id, name) in crate_names { 113 for (crate_id, name) in crate_names {
110 change.set_debug_crate_name(crate_id.shift(shift), name) 114 change.set_debug_crate_name(crate_id.shift(shift), name)
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs
index 152681062..2ba82ab05 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/main.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs
@@ -286,7 +286,13 @@ fn test_missing_module_code_action_in_json_project() {
286 286
287 let project = json!({ 287 let project = json!({
288 "roots": [path], 288 "roots": [path],
289 "crates": [ { "root_module": path.join("src/lib.rs"), "deps": [], "edition": "2015" } ] 289 "crates": [ {
290 "root_module": path.join("src/lib.rs"),
291 "deps": [],
292 "edition": "2015",
293 "atom_cfgs": [],
294 "key_value_cfgs": {}
295 } ]
290 }); 296 });
291 297
292 let code = format!( 298 let code = format!(