aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/config.rs6
-rw-r--r--crates/rust-analyzer/src/world.rs2
-rw-r--r--crates/rust-analyzer/tests/heavy_tests/main.rs11
3 files changed, 8 insertions, 11 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index fa0b1e226..642c34574 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -7,6 +7,8 @@
7//! configure the server itself, feature flags are passed into analysis, and 7//! configure the server itself, feature flags are passed into analysis, and
8//! tweak things like automatic insertion of `()` in completions. 8//! tweak things like automatic insertion of `()` in completions.
9 9
10use std::{ffi::OsString, path::PathBuf};
11
10use lsp_types::TextDocumentClientCapabilities; 12use lsp_types::TextDocumentClientCapabilities;
11use ra_flycheck::FlycheckConfig; 13use ra_flycheck::FlycheckConfig;
12use ra_ide::{CompletionConfig, InlayHintsConfig}; 14use ra_ide::{CompletionConfig, InlayHintsConfig};
@@ -20,7 +22,7 @@ pub struct Config {
20 pub with_sysroot: bool, 22 pub with_sysroot: bool,
21 pub publish_diagnostics: bool, 23 pub publish_diagnostics: bool,
22 pub lru_capacity: Option<usize>, 24 pub lru_capacity: Option<usize>,
23 pub proc_macro_srv: Option<(String, Vec<String>)>, 25 pub proc_macro_srv: Option<(PathBuf, Vec<OsString>)>,
24 pub files: FilesConfig, 26 pub files: FilesConfig,
25 pub notifications: NotificationsConfig, 27 pub notifications: NotificationsConfig,
26 28
@@ -135,7 +137,7 @@ impl Config {
135 match get(value, "/procMacro/enable") { 137 match get(value, "/procMacro/enable") {
136 Some(true) => { 138 Some(true) => {
137 if let Ok(path) = std::env::current_exe() { 139 if let Ok(path) = std::env::current_exe() {
138 self.proc_macro_srv = Some((path.to_string_lossy().to_string(), vec!["proc-macro".to_string()])); 140 self.proc_macro_srv = Some((path, vec!["proc-macro".into()]));
139 } 141 }
140 } 142 }
141 _ => self.proc_macro_srv = None, 143 _ => self.proc_macro_srv = None,
diff --git a/crates/rust-analyzer/src/world.rs b/crates/rust-analyzer/src/world.rs
index 7c0bb42aa..34941931b 100644
--- a/crates/rust-analyzer/src/world.rs
+++ b/crates/rust-analyzer/src/world.rs
@@ -153,7 +153,7 @@ impl WorldState {
153 Err(err) => { 153 Err(err) => {
154 log::error!( 154 log::error!(
155 "Failed to run ra_proc_macro_srv from path {}, error: {:?}", 155 "Failed to run ra_proc_macro_srv from path {}, error: {:?}",
156 path, 156 path.display(),
157 err 157 err
158 ); 158 );
159 ProcMacroClient::dummy() 159 ProcMacroClient::dummy()
diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs
index 1dd2676b6..b31533e5e 100644
--- a/crates/rust-analyzer/tests/heavy_tests/main.rs
+++ b/crates/rust-analyzer/tests/heavy_tests/main.rs
@@ -1,6 +1,6 @@
1mod support; 1mod support;
2 2
3use std::{collections::HashMap, time::Instant}; 3use std::{collections::HashMap, path::PathBuf, time::Instant};
4 4
5use lsp_types::{ 5use lsp_types::{
6 CodeActionContext, DidOpenTextDocumentParams, DocumentFormattingParams, FormattingOptions, 6 CodeActionContext, DidOpenTextDocumentParams, DocumentFormattingParams, FormattingOptions,
@@ -692,15 +692,10 @@ pub fn foo(_input: TokenStream) -> TokenStream {
692"###, 692"###,
693 ) 693 )
694 .with_config(|config| { 694 .with_config(|config| {
695 // FIXME: Use env!("CARGO_BIN_EXE_ra-analyzer") instead after 695 let macro_srv_path = PathBuf::from(env!("CARGO_BIN_EXE_rust-analyzer"));
696 // https://github.com/rust-lang/cargo/pull/7697 landed
697 let macro_srv_path = std::path::Path::new(std::env!("CARGO_MANIFEST_DIR"))
698 .join("../../target/debug/rust-analyzer")
699 .to_string_lossy()
700 .to_string();
701 696
702 config.cargo.load_out_dirs_from_check = true; 697 config.cargo.load_out_dirs_from_check = true;
703 config.proc_macro_srv = Some((macro_srv_path, vec!["proc-macro".to_string()])); 698 config.proc_macro_srv = Some((macro_srv_path, vec!["proc-macro".into()]));
704 }) 699 })
705 .root("foo") 700 .root("foo")
706 .root("bar") 701 .root("bar")