diff options
Diffstat (limited to 'crates/rust-analyzer/src')
-rw-r--r-- | crates/rust-analyzer/src/bin/args.rs | 40 | ||||
-rw-r--r-- | crates/rust-analyzer/src/bin/main.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cargo_target_spec.rs | 5 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/analysis_stats.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/load_cargo.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 19 | ||||
-rw-r--r-- | crates/rust-analyzer/src/conv.rs | 18 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/semantic_tokens.rs | 3 | ||||
-rw-r--r-- | crates/rust-analyzer/src/world.rs | 25 |
10 files changed, 81 insertions, 45 deletions
diff --git a/crates/rust-analyzer/src/bin/args.rs b/crates/rust-analyzer/src/bin/args.rs index 5e19253a6..8e3ca9343 100644 --- a/crates/rust-analyzer/src/bin/args.rs +++ b/crates/rust-analyzer/src/bin/args.rs | |||
@@ -75,6 +75,10 @@ impl Args { | |||
75 | let subcommand = match matches.subcommand()? { | 75 | let subcommand = match matches.subcommand()? { |
76 | Some(it) => it, | 76 | Some(it) => it, |
77 | None => { | 77 | None => { |
78 | if matches.contains(["-h", "--help"]) { | ||
79 | print_subcommands(); | ||
80 | return Ok(Err(HelpPrinted)); | ||
81 | } | ||
78 | matches.finish().or_else(handle_extra_flags)?; | 82 | matches.finish().or_else(handle_extra_flags)?; |
79 | return Ok(Ok(Args { verbosity, command: Command::RunServer })); | 83 | return Ok(Ok(Args { verbosity, command: Command::RunServer })); |
80 | } | 84 | } |
@@ -84,7 +88,7 @@ impl Args { | |||
84 | if matches.contains(["-h", "--help"]) { | 88 | if matches.contains(["-h", "--help"]) { |
85 | eprintln!( | 89 | eprintln!( |
86 | "\ | 90 | "\ |
87 | ra-cli-parse | 91 | rust-analyzer parse |
88 | 92 | ||
89 | USAGE: | 93 | USAGE: |
90 | rust-analyzer parse [FLAGS] | 94 | rust-analyzer parse [FLAGS] |
@@ -104,7 +108,7 @@ FLAGS: | |||
104 | if matches.contains(["-h", "--help"]) { | 108 | if matches.contains(["-h", "--help"]) { |
105 | eprintln!( | 109 | eprintln!( |
106 | "\ | 110 | "\ |
107 | ra-cli-symbols | 111 | rust-analyzer symbols |
108 | 112 | ||
109 | USAGE: | 113 | USAGE: |
110 | rust-analyzer highlight [FLAGS] | 114 | rust-analyzer highlight [FLAGS] |
@@ -123,7 +127,7 @@ FLAGS: | |||
123 | if matches.contains(["-h", "--help"]) { | 127 | if matches.contains(["-h", "--help"]) { |
124 | eprintln!( | 128 | eprintln!( |
125 | "\ | 129 | "\ |
126 | ra-cli-highlight | 130 | rust-analyzer highlight |
127 | 131 | ||
128 | USAGE: | 132 | USAGE: |
129 | rust-analyzer highlight [FLAGS] | 133 | rust-analyzer highlight [FLAGS] |
@@ -143,7 +147,7 @@ FLAGS: | |||
143 | if matches.contains(["-h", "--help"]) { | 147 | if matches.contains(["-h", "--help"]) { |
144 | eprintln!( | 148 | eprintln!( |
145 | "\ | 149 | "\ |
146 | ra-cli-analysis-stats | 150 | rust-analyzer analysis-stats |
147 | 151 | ||
148 | USAGE: | 152 | USAGE: |
149 | rust-analyzer analysis-stats [FLAGS] [OPTIONS] [PATH] | 153 | rust-analyzer analysis-stats [FLAGS] [OPTIONS] [PATH] |
@@ -193,7 +197,7 @@ ARGS: | |||
193 | if matches.contains(["-h", "--help"]) { | 197 | if matches.contains(["-h", "--help"]) { |
194 | eprintln!( | 198 | eprintln!( |
195 | "\ | 199 | "\ |
196 | rust-analyzer-analysis-bench | 200 | rust-analyzer analysis-bench |
197 | 201 | ||
198 | USAGE: | 202 | USAGE: |
199 | rust-analyzer analysis-bench [FLAGS] [OPTIONS] | 203 | rust-analyzer analysis-bench [FLAGS] [OPTIONS] |
@@ -236,7 +240,7 @@ ARGS: | |||
236 | if matches.contains(["-h", "--help"]) { | 240 | if matches.contains(["-h", "--help"]) { |
237 | eprintln!( | 241 | eprintln!( |
238 | "\ | 242 | "\ |
239 | ra-cli-diagnostics | 243 | rust-analyzer diagnostics |
240 | 244 | ||
241 | USAGE: | 245 | USAGE: |
242 | rust-analyzer diagnostics [FLAGS] [PATH] | 246 | rust-analyzer diagnostics [FLAGS] [PATH] |
@@ -267,9 +271,18 @@ ARGS: | |||
267 | } | 271 | } |
268 | "proc-macro" => Command::ProcMacro, | 272 | "proc-macro" => Command::ProcMacro, |
269 | _ => { | 273 | _ => { |
270 | eprintln!( | 274 | print_subcommands(); |
271 | "\ | 275 | return Ok(Err(HelpPrinted)); |
272 | ra-cli | 276 | } |
277 | }; | ||
278 | Ok(Ok(Args { verbosity, command })) | ||
279 | } | ||
280 | } | ||
281 | |||
282 | fn print_subcommands() { | ||
283 | eprintln!( | ||
284 | "\ | ||
285 | rust-analyzer | ||
273 | 286 | ||
274 | USAGE: | 287 | USAGE: |
275 | rust-analyzer <SUBCOMMAND> | 288 | rust-analyzer <SUBCOMMAND> |
@@ -281,14 +294,11 @@ SUBCOMMANDS: | |||
281 | analysis-bench | 294 | analysis-bench |
282 | analysis-stats | 295 | analysis-stats |
283 | highlight | 296 | highlight |
297 | diagnostics | ||
298 | proc-macro | ||
284 | parse | 299 | parse |
285 | symbols" | 300 | symbols" |
286 | ); | 301 | ) |
287 | return Ok(Err(HelpPrinted)); | ||
288 | } | ||
289 | }; | ||
290 | Ok(Ok(Args { verbosity, command })) | ||
291 | } | ||
292 | } | 302 | } |
293 | 303 | ||
294 | pub(crate) struct HelpPrinted; | 304 | pub(crate) struct HelpPrinted; |
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index 28b67cfe2..22a84b50c 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs | |||
@@ -51,7 +51,7 @@ fn main() -> Result<()> { | |||
51 | cli::diagnostics(path.as_ref(), load_output_dirs, with_proc_macro, all)? | 51 | cli::diagnostics(path.as_ref(), load_output_dirs, with_proc_macro, all)? |
52 | } | 52 | } |
53 | 53 | ||
54 | args::Command::ProcMacro => run_proc_macro_sv()?, | 54 | args::Command::ProcMacro => run_proc_macro_srv()?, |
55 | args::Command::RunServer => run_server()?, | 55 | args::Command::RunServer => run_server()?, |
56 | args::Command::Version => println!("rust-analyzer {}", env!("REV")), | 56 | args::Command::Version => println!("rust-analyzer {}", env!("REV")), |
57 | } | 57 | } |
@@ -65,8 +65,8 @@ fn setup_logging() -> Result<()> { | |||
65 | Ok(()) | 65 | Ok(()) |
66 | } | 66 | } |
67 | 67 | ||
68 | fn run_proc_macro_sv() -> Result<()> { | 68 | fn run_proc_macro_srv() -> Result<()> { |
69 | ra_proc_macro_srv::cli::run(); | 69 | ra_proc_macro_srv::cli::run()?; |
70 | Ok(()) | 70 | Ok(()) |
71 | } | 71 | } |
72 | 72 | ||
diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs index 942c30328..c2ece49f4 100644 --- a/crates/rust-analyzer/src/cargo_target_spec.rs +++ b/crates/rust-analyzer/src/cargo_target_spec.rs | |||
@@ -23,7 +23,7 @@ impl CargoTargetSpec { | |||
23 | let mut args = Vec::new(); | 23 | let mut args = Vec::new(); |
24 | let mut extra_args = Vec::new(); | 24 | let mut extra_args = Vec::new(); |
25 | match kind { | 25 | match kind { |
26 | RunnableKind::Test { test_id } => { | 26 | RunnableKind::Test { test_id, attr } => { |
27 | args.push("test".to_string()); | 27 | args.push("test".to_string()); |
28 | if let Some(spec) = spec { | 28 | if let Some(spec) = spec { |
29 | spec.push_to(&mut args); | 29 | spec.push_to(&mut args); |
@@ -33,6 +33,9 @@ impl CargoTargetSpec { | |||
33 | extra_args.push("--exact".to_string()); | 33 | extra_args.push("--exact".to_string()); |
34 | } | 34 | } |
35 | extra_args.push("--nocapture".to_string()); | 35 | extra_args.push("--nocapture".to_string()); |
36 | if attr.ignore { | ||
37 | extra_args.push("--ignored".to_string()) | ||
38 | } | ||
36 | } | 39 | } |
37 | RunnableKind::TestMod { path } => { | 40 | RunnableKind::TestMod { path } => { |
38 | args.push("test".to_string()); | 41 | args.push("test".to_string()); |
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs index d442cbd63..9fa7dad71 100644 --- a/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/crates/rust-analyzer/src/cli/analysis_stats.rs | |||
@@ -162,9 +162,13 @@ pub fn analysis_stats( | |||
162 | let (_, sm) = db.body_with_source_map(f_id.into()); | 162 | let (_, sm) = db.body_with_source_map(f_id.into()); |
163 | let src = sm.expr_syntax(expr_id); | 163 | let src = sm.expr_syntax(expr_id); |
164 | if let Ok(src) = src { | 164 | if let Ok(src) = src { |
165 | let node = { | ||
166 | let root = db.parse_or_expand(src.file_id).unwrap(); | ||
167 | src.value.to_node(&root) | ||
168 | }; | ||
165 | let original_file = src.file_id.original_file(db); | 169 | let original_file = src.file_id.original_file(db); |
166 | let line_index = host.analysis().file_line_index(original_file).unwrap(); | 170 | let line_index = host.analysis().file_line_index(original_file).unwrap(); |
167 | let text_range = src.value.syntax_node_ptr().range(); | 171 | let text_range = node.syntax().text_range(); |
168 | let (start, end) = ( | 172 | let (start, end) = ( |
169 | line_index.line_col(text_range.start()), | 173 | line_index.line_col(text_range.start()), |
170 | line_index.line_col(text_range.end()), | 174 | line_index.line_col(text_range.end()), |
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index 762f776fe..d0a71120a 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs | |||
@@ -76,7 +76,7 @@ pub(crate) fn load_cargo( | |||
76 | ProcMacroClient::dummy() | 76 | ProcMacroClient::dummy() |
77 | } else { | 77 | } else { |
78 | let path = std::env::current_exe()?; | 78 | let path = std::env::current_exe()?; |
79 | ProcMacroClient::extern_process(&path, &["proc-macro"]).unwrap() | 79 | ProcMacroClient::extern_process(path, &["proc-macro"]).unwrap() |
80 | }; | 80 | }; |
81 | let host = load(&source_roots, ws, &mut vfs, receiver, extern_dirs, &proc_macro_client); | 81 | let host = load(&source_roots, ws, &mut vfs, receiver, extern_dirs, &proc_macro_client); |
82 | Ok((host, source_roots)) | 82 | Ok((host, source_roots)) |
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 3597a14e3..715eddadb 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 | ||
10 | use std::{ffi::OsString, path::PathBuf}; | ||
11 | |||
10 | use lsp_types::TextDocumentClientCapabilities; | 12 | use lsp_types::TextDocumentClientCapabilities; |
11 | use ra_flycheck::FlycheckConfig; | 13 | use ra_flycheck::FlycheckConfig; |
12 | use ra_ide::{CompletionConfig, InlayHintsConfig}; | 14 | use 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 | ||
@@ -102,6 +104,7 @@ impl Default for Config { | |||
102 | enable_postfix_completions: true, | 104 | enable_postfix_completions: true, |
103 | add_call_parenthesis: true, | 105 | add_call_parenthesis: true, |
104 | add_call_argument_snippets: true, | 106 | add_call_argument_snippets: true, |
107 | ..CompletionConfig::default() | ||
105 | }, | 108 | }, |
106 | call_info_full: true, | 109 | call_info_full: true, |
107 | } | 110 | } |
@@ -118,7 +121,7 @@ impl Config { | |||
118 | self.client_caps = client_caps; | 121 | self.client_caps = client_caps; |
119 | 122 | ||
120 | set(value, "/withSysroot", &mut self.with_sysroot); | 123 | set(value, "/withSysroot", &mut self.with_sysroot); |
121 | set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics); | 124 | set(value, "/diagnostics/enable", &mut self.publish_diagnostics); |
122 | set(value, "/lruCapacity", &mut self.lru_capacity); | 125 | set(value, "/lruCapacity", &mut self.lru_capacity); |
123 | self.files.watcher = match get(value, "/files/watcher") { | 126 | self.files.watcher = match get(value, "/files/watcher") { |
124 | Some("client") => FilesWatcher::Client, | 127 | Some("client") => FilesWatcher::Client, |
@@ -132,10 +135,10 @@ impl Config { | |||
132 | set(value, "/cargo/features", &mut self.cargo.features); | 135 | set(value, "/cargo/features", &mut self.cargo.features); |
133 | set(value, "/cargo/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check); | 136 | set(value, "/cargo/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check); |
134 | 137 | ||
135 | match get::<bool>(value, "/procMacro/enabled") { | 138 | match get(value, "/procMacro/enable") { |
136 | Some(true) => { | 139 | Some(true) => { |
137 | if let Ok(path) = std::env::current_exe() { | 140 | 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()])); | 141 | self.proc_macro_srv = Some((path, vec!["proc-macro".into()])); |
139 | } | 142 | } |
140 | } | 143 | } |
141 | _ => self.proc_macro_srv = None, | 144 | _ => self.proc_macro_srv = None, |
@@ -212,5 +215,13 @@ impl Config { | |||
212 | if let Some(value) = caps.folding_range.as_ref().and_then(|it| it.line_folding_only) { | 215 | if let Some(value) = caps.folding_range.as_ref().and_then(|it| it.line_folding_only) { |
213 | self.client_caps.line_folding_only = value | 216 | self.client_caps.line_folding_only = value |
214 | } | 217 | } |
218 | self.completion.allow_snippets(false); | ||
219 | if let Some(completion) = &caps.completion { | ||
220 | if let Some(completion_item) = &completion.completion_item { | ||
221 | if let Some(value) = completion_item.snippet_support { | ||
222 | self.completion.allow_snippets(value); | ||
223 | } | ||
224 | } | ||
225 | } | ||
215 | } | 226 | } |
216 | } | 227 | } |
diff --git a/crates/rust-analyzer/src/conv.rs b/crates/rust-analyzer/src/conv.rs index b2b1cb625..2285cb1d3 100644 --- a/crates/rust-analyzer/src/conv.rs +++ b/crates/rust-analyzer/src/conv.rs | |||
@@ -24,7 +24,9 @@ use crate::{ | |||
24 | world::WorldSnapshot, | 24 | world::WorldSnapshot, |
25 | Result, | 25 | Result, |
26 | }; | 26 | }; |
27 | use semantic_tokens::{ATTRIBUTE, BUILTIN_TYPE, ENUM_MEMBER, LIFETIME, TYPE_ALIAS, UNION}; | 27 | use semantic_tokens::{ |
28 | ATTRIBUTE, BUILTIN_TYPE, ENUM_MEMBER, LIFETIME, TYPE_ALIAS, UNION, UNRESOLVED_REFERENCE, | ||
29 | }; | ||
28 | 30 | ||
29 | pub trait Conv { | 31 | pub trait Conv { |
30 | type Output; | 32 | type Output; |
@@ -98,6 +100,7 @@ impl Conv for CompletionItemKind { | |||
98 | CompletionItemKind::Method => Method, | 100 | CompletionItemKind::Method => Method, |
99 | CompletionItemKind::TypeParam => TypeParameter, | 101 | CompletionItemKind::TypeParam => TypeParameter, |
100 | CompletionItemKind::Macro => Method, | 102 | CompletionItemKind::Macro => Method, |
103 | CompletionItemKind::Attribute => EnumMember, | ||
101 | } | 104 | } |
102 | } | 105 | } |
103 | } | 106 | } |
@@ -123,7 +126,7 @@ impl ConvWith<(&LineIndex, LineEndings)> for CompletionItem { | |||
123 | for atom_edit in self.text_edit().as_atoms() { | 126 | for atom_edit in self.text_edit().as_atoms() { |
124 | if self.source_range().is_subrange(&atom_edit.delete) { | 127 | if self.source_range().is_subrange(&atom_edit.delete) { |
125 | text_edit = Some(if atom_edit.delete == self.source_range() { | 128 | text_edit = Some(if atom_edit.delete == self.source_range() { |
126 | atom_edit.conv_with(ctx) | 129 | atom_edit.conv_with((ctx.0, ctx.1)) |
127 | } else { | 130 | } else { |
128 | assert!(self.source_range().end() == atom_edit.delete.end()); | 131 | assert!(self.source_range().end() == atom_edit.delete.end()); |
129 | let range1 = | 132 | let range1 = |
@@ -131,12 +134,12 @@ impl ConvWith<(&LineIndex, LineEndings)> for CompletionItem { | |||
131 | let range2 = self.source_range(); | 134 | let range2 = self.source_range(); |
132 | let edit1 = AtomTextEdit::replace(range1, String::new()); | 135 | let edit1 = AtomTextEdit::replace(range1, String::new()); |
133 | let edit2 = AtomTextEdit::replace(range2, atom_edit.insert.clone()); | 136 | let edit2 = AtomTextEdit::replace(range2, atom_edit.insert.clone()); |
134 | additional_text_edits.push(edit1.conv_with(ctx)); | 137 | additional_text_edits.push(edit1.conv_with((ctx.0, ctx.1))); |
135 | edit2.conv_with(ctx) | 138 | edit2.conv_with((ctx.0, ctx.1)) |
136 | }) | 139 | }) |
137 | } else { | 140 | } else { |
138 | assert!(self.source_range().intersection(&atom_edit.delete).is_none()); | 141 | assert!(self.source_range().intersection(&atom_edit.delete).is_none()); |
139 | additional_text_edits.push(atom_edit.conv_with(ctx)); | 142 | additional_text_edits.push(atom_edit.conv_with((ctx.0, ctx.1))); |
140 | } | 143 | } |
141 | } | 144 | } |
142 | let text_edit = text_edit.unwrap(); | 145 | let text_edit = text_edit.unwrap(); |
@@ -163,6 +166,10 @@ impl ConvWith<(&LineIndex, LineEndings)> for CompletionItem { | |||
163 | ..Default::default() | 166 | ..Default::default() |
164 | }; | 167 | }; |
165 | 168 | ||
169 | if self.score().is_some() { | ||
170 | res.preselect = Some(true) | ||
171 | } | ||
172 | |||
166 | if self.deprecated() { | 173 | if self.deprecated() { |
167 | res.tags = Some(vec![lsp_types::CompletionItemTag::Deprecated]) | 174 | res.tags = Some(vec![lsp_types::CompletionItemTag::Deprecated]) |
168 | } | 175 | } |
@@ -373,6 +380,7 @@ impl Conv for Highlight { | |||
373 | HighlightTag::Comment => SemanticTokenType::COMMENT, | 380 | HighlightTag::Comment => SemanticTokenType::COMMENT, |
374 | HighlightTag::Attribute => ATTRIBUTE, | 381 | HighlightTag::Attribute => ATTRIBUTE, |
375 | HighlightTag::Keyword => SemanticTokenType::KEYWORD, | 382 | HighlightTag::Keyword => SemanticTokenType::KEYWORD, |
383 | HighlightTag::UnresolvedReference => UNRESOLVED_REFERENCE, | ||
376 | }; | 384 | }; |
377 | 385 | ||
378 | for modifier in self.modifiers.iter() { | 386 | for modifier in self.modifiers.iter() { |
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index b207f0764..41d9fe344 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -968,7 +968,7 @@ fn to_lsp_runnable( | |||
968 | let (args, extra_args) = CargoTargetSpec::runnable_args(spec, &runnable.kind)?; | 968 | let (args, extra_args) = CargoTargetSpec::runnable_args(spec, &runnable.kind)?; |
969 | let line_index = world.analysis().file_line_index(file_id)?; | 969 | let line_index = world.analysis().file_line_index(file_id)?; |
970 | let label = match &runnable.kind { | 970 | let label = match &runnable.kind { |
971 | RunnableKind::Test { test_id } => format!("test {}", test_id), | 971 | RunnableKind::Test { test_id, .. } => format!("test {}", test_id), |
972 | RunnableKind::TestMod { path } => format!("test-mod {}", path), | 972 | RunnableKind::TestMod { path } => format!("test-mod {}", path), |
973 | RunnableKind::Bench { test_id } => format!("bench {}", test_id), | 973 | RunnableKind::Bench { test_id } => format!("bench {}", test_id), |
974 | RunnableKind::Bin => "run binary".to_string(), | 974 | RunnableKind::Bin => "run binary".to_string(), |
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs index 865fa3b1c..10fe696f6 100644 --- a/crates/rust-analyzer/src/semantic_tokens.rs +++ b/crates/rust-analyzer/src/semantic_tokens.rs | |||
@@ -10,6 +10,8 @@ pub(crate) const ENUM_MEMBER: SemanticTokenType = SemanticTokenType::new("enumMe | |||
10 | pub(crate) const LIFETIME: SemanticTokenType = SemanticTokenType::new("lifetime"); | 10 | pub(crate) const LIFETIME: SemanticTokenType = SemanticTokenType::new("lifetime"); |
11 | pub(crate) const TYPE_ALIAS: SemanticTokenType = SemanticTokenType::new("typeAlias"); | 11 | pub(crate) const TYPE_ALIAS: SemanticTokenType = SemanticTokenType::new("typeAlias"); |
12 | pub(crate) const UNION: SemanticTokenType = SemanticTokenType::new("union"); | 12 | pub(crate) const UNION: SemanticTokenType = SemanticTokenType::new("union"); |
13 | pub(crate) const UNRESOLVED_REFERENCE: SemanticTokenType = | ||
14 | SemanticTokenType::new("unresolvedReference"); | ||
13 | 15 | ||
14 | pub(crate) const CONSTANT: SemanticTokenModifier = SemanticTokenModifier::new("constant"); | 16 | pub(crate) const CONSTANT: SemanticTokenModifier = SemanticTokenModifier::new("constant"); |
15 | pub(crate) const CONTROL_FLOW: SemanticTokenModifier = SemanticTokenModifier::new("controlFlow"); | 17 | pub(crate) const CONTROL_FLOW: SemanticTokenModifier = SemanticTokenModifier::new("controlFlow"); |
@@ -43,6 +45,7 @@ pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[ | |||
43 | LIFETIME, | 45 | LIFETIME, |
44 | TYPE_ALIAS, | 46 | TYPE_ALIAS, |
45 | UNION, | 47 | UNION, |
48 | UNRESOLVED_REFERENCE, | ||
46 | ]; | 49 | ]; |
47 | 50 | ||
48 | pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[ | 51 | pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[ |
diff --git a/crates/rust-analyzer/src/world.rs b/crates/rust-analyzer/src/world.rs index f2ad453fa..34941931b 100644 --- a/crates/rust-analyzer/src/world.rs +++ b/crates/rust-analyzer/src/world.rs | |||
@@ -148,20 +148,17 @@ impl WorldState { | |||
148 | 148 | ||
149 | let proc_macro_client = match &config.proc_macro_srv { | 149 | let proc_macro_client = match &config.proc_macro_srv { |
150 | None => ProcMacroClient::dummy(), | 150 | None => ProcMacroClient::dummy(), |
151 | Some((path, args)) => { | 151 | Some((path, args)) => match ProcMacroClient::extern_process(path.into(), args) { |
152 | let path = std::path::Path::new(path); | 152 | Ok(it) => it, |
153 | match ProcMacroClient::extern_process(path, args) { | 153 | Err(err) => { |
154 | Ok(it) => it, | 154 | log::error!( |
155 | Err(err) => { | 155 | "Failed to run ra_proc_macro_srv from path {}, error: {:?}", |
156 | log::error!( | 156 | path.display(), |
157 | "Fail to run ra_proc_macro_srv from path {}, error : {}", | 157 | err |
158 | path.to_string_lossy(), | 158 | ); |
159 | err | 159 | ProcMacroClient::dummy() |
160 | ); | ||
161 | ProcMacroClient::dummy() | ||
162 | } | ||
163 | } | 160 | } |
164 | } | 161 | }, |
165 | }; | 162 | }; |
166 | 163 | ||
167 | workspaces | 164 | workspaces |
@@ -184,7 +181,7 @@ impl WorldState { | |||
184 | let mut analysis_host = AnalysisHost::new(lru_capacity); | 181 | let mut analysis_host = AnalysisHost::new(lru_capacity); |
185 | analysis_host.apply_change(change); | 182 | analysis_host.apply_change(change); |
186 | WorldState { | 183 | WorldState { |
187 | config: config, | 184 | config, |
188 | roots: folder_roots, | 185 | roots: folder_roots, |
189 | workspaces: Arc::new(workspaces), | 186 | workspaces: Arc::new(workspaces), |
190 | analysis_host, | 187 | analysis_host, |