aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ide/src/syntax_highlighting/highlight.rs20
-rw-r--r--crates/ide/src/syntax_highlighting/tags.rs6
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlighting.html10
-rw-r--r--crates/rust-analyzer/src/semantic_tokens.rs2
-rw-r--r--crates/rust-analyzer/src/to_proto.rs2
5 files changed, 20 insertions, 20 deletions
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs
index 141536dcc..f070601fd 100644
--- a/crates/ide/src/syntax_highlighting/highlight.rs
+++ b/crates/ide/src/syntax_highlighting/highlight.rs
@@ -288,7 +288,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
288 let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Macro)); 288 let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Macro));
289 289
290 if m.module(db).map(hir::Module::krate) != krate { 290 if m.module(db).map(hir::Module::krate) != krate {
291 h |= HlMod::Foreign; 291 h |= HlMod::Library;
292 } 292 }
293 293
294 return h; 294 return h;
@@ -297,7 +297,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
297 let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Field)); 297 let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Field));
298 298
299 if Some(field.parent_def(db).module(db).krate()) != krate { 299 if Some(field.parent_def(db).module(db).krate()) != krate {
300 h |= HlMod::Foreign; 300 h |= HlMod::Library;
301 } 301 }
302 302
303 return h; 303 return h;
@@ -307,7 +307,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
307 let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Module)); 307 let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Module));
308 308
309 if Some(module.krate()) != krate { 309 if Some(module.krate()) != krate {
310 h |= HlMod::Foreign; 310 h |= HlMod::Library;
311 } 311 }
312 312
313 return h; 313 return h;
@@ -344,7 +344,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
344 h |= HlMod::Async; 344 h |= HlMod::Async;
345 } 345 }
346 if Some(func.module(db).krate()) != krate { 346 if Some(func.module(db).krate()) != krate {
347 h |= HlMod::Foreign; 347 h |= HlMod::Library;
348 } 348 }
349 return h; 349 return h;
350 } 350 }
@@ -357,7 +357,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
357 let mut h = Highlight::new(h); 357 let mut h = Highlight::new(h);
358 358
359 if Some(adt.module(db).krate()) != krate { 359 if Some(adt.module(db).krate()) != krate {
360 h |= HlMod::Foreign; 360 h |= HlMod::Library;
361 } 361 }
362 362
363 return h; 363 return h;
@@ -366,7 +366,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
366 let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Variant)); 366 let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Variant));
367 367
368 if Some(variant.module(db).krate()) != krate { 368 if Some(variant.module(db).krate()) != krate {
369 h |= HlMod::Foreign; 369 h |= HlMod::Library;
370 } 370 }
371 371
372 return h; 372 return h;
@@ -389,7 +389,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
389 } 389 }
390 390
391 if Some(konst.module(db).krate()) != krate { 391 if Some(konst.module(db).krate()) != krate {
392 h |= HlMod::Foreign; 392 h |= HlMod::Library;
393 } 393 }
394 394
395 return h; 395 return h;
@@ -402,7 +402,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
402 } 402 }
403 403
404 if Some(trait_.module(db).krate()) != krate { 404 if Some(trait_.module(db).krate()) != krate {
405 h |= HlMod::Foreign; 405 h |= HlMod::Library;
406 } 406 }
407 407
408 return h; 408 return h;
@@ -425,7 +425,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
425 } 425 }
426 426
427 if Some(type_.module(db).krate()) != krate { 427 if Some(type_.module(db).krate()) != krate {
428 h |= HlMod::Foreign; 428 h |= HlMod::Library;
429 } 429 }
430 430
431 return h; 431 return h;
@@ -440,7 +440,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
440 } 440 }
441 441
442 if Some(s.module(db).krate()) != krate { 442 if Some(s.module(db).krate()) != krate {
443 h |= HlMod::Foreign; 443 h |= HlMod::Library;
444 } 444 }
445 445
446 return h; 446 return h;
diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs
index 755599cba..e94f17cd9 100644
--- a/crates/ide/src/syntax_highlighting/tags.rs
+++ b/crates/ide/src/syntax_highlighting/tags.rs
@@ -68,7 +68,7 @@ pub enum HlMod {
68 /// Used with keywords like `async` and `await`. 68 /// Used with keywords like `async` and `await`.
69 Async, 69 Async,
70 /// Used for items from other crates. 70 /// Used for items from other crates.
71 Foreign, 71 Library,
72 // Keep this last! 72 // Keep this last!
73 /// Used for unsafe functions, unsafe traits, mutable statics, union accesses and unsafe operations. 73 /// Used for unsafe functions, unsafe traits, mutable statics, union accesses and unsafe operations.
74 Unsafe, 74 Unsafe,
@@ -191,7 +191,7 @@ impl HlMod {
191 HlMod::Static, 191 HlMod::Static,
192 HlMod::Trait, 192 HlMod::Trait,
193 HlMod::Async, 193 HlMod::Async,
194 HlMod::Foreign, 194 HlMod::Library,
195 HlMod::Unsafe, 195 HlMod::Unsafe,
196 ]; 196 ];
197 197
@@ -210,7 +210,7 @@ impl HlMod {
210 HlMod::Static => "static", 210 HlMod::Static => "static",
211 HlMod::Trait => "trait", 211 HlMod::Trait => "trait",
212 HlMod::Async => "async", 212 HlMod::Async => "async",
213 HlMod::Foreign => "foreign", 213 HlMod::Library => "library",
214 HlMod::Unsafe => "unsafe", 214 HlMod::Unsafe => "unsafe",
215 } 215 }
216 } 216 }
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html
index e65dd3ff9..055d21109 100644
--- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html
+++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html
@@ -251,14 +251,14 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
251<span class="keyword">impl</span> <span class="trait unsafe">Dangerous</span> <span class="keyword">for</span> <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> 251<span class="keyword">impl</span> <span class="trait unsafe">Dangerous</span> <span class="keyword">for</span> <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span>
252 252
253<span class="keyword">fn</span> <span class="function declaration">use_foo_items</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> 253<span class="keyword">fn</span> <span class="function declaration">use_foo_items</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
254 <span class="keyword">let</span> <span class="variable declaration">bob</span> <span class="operator">=</span> <span class="module foreign">foo</span><span class="operator">::</span><span class="struct foreign">Person</span> <span class="brace">{</span> 254 <span class="keyword">let</span> <span class="variable declaration">bob</span> <span class="operator">=</span> <span class="module library">foo</span><span class="operator">::</span><span class="struct library">Person</span> <span class="brace">{</span>
255 <span class="field foreign">name</span><span class="colon">:</span> <span class="string_literal">"Bob"</span><span class="comma">,</span> 255 <span class="field library">name</span><span class="colon">:</span> <span class="string_literal">"Bob"</span><span class="comma">,</span>
256 <span class="field foreign">age</span><span class="colon">:</span> <span class="module foreign">foo</span><span class="operator">::</span><span class="module foreign">consts</span><span class="operator">::</span><span class="constant foreign">NUMBER</span><span class="comma">,</span> 256 <span class="field library">age</span><span class="colon">:</span> <span class="module library">foo</span><span class="operator">::</span><span class="module library">consts</span><span class="operator">::</span><span class="constant library">NUMBER</span><span class="comma">,</span>
257 <span class="brace">}</span><span class="semicolon">;</span> 257 <span class="brace">}</span><span class="semicolon">;</span>
258 258
259 <span class="keyword">let</span> <span class="variable declaration">control_flow</span> <span class="operator">=</span> <span class="module foreign">foo</span><span class="operator">::</span><span class="function foreign">identity</span><span class="parenthesis">(</span><span class="module foreign">foo</span><span class="operator">::</span><span class="enum foreign">ControlFlow</span><span class="operator">::</span><span class="enum_variant foreign">Continue</span><span class="parenthesis">)</span><span class="semicolon">;</span> 259 <span class="keyword">let</span> <span class="variable declaration">control_flow</span> <span class="operator">=</span> <span class="module library">foo</span><span class="operator">::</span><span class="function library">identity</span><span class="parenthesis">(</span><span class="module library">foo</span><span class="operator">::</span><span class="enum library">ControlFlow</span><span class="operator">::</span><span class="enum_variant library">Continue</span><span class="parenthesis">)</span><span class="semicolon">;</span>
260 260
261 <span class="keyword control">if</span> <span class="keyword">let</span> <span class="module foreign">foo</span><span class="operator">::</span><span class="enum foreign">ControlFlow</span><span class="operator">::</span><span class="enum_variant foreign">Die</span> <span class="operator">=</span> <span class="variable">control_flow</span> <span class="brace">{</span> 261 <span class="keyword control">if</span> <span class="keyword">let</span> <span class="module library">foo</span><span class="operator">::</span><span class="enum library">ControlFlow</span><span class="operator">::</span><span class="enum_variant library">Die</span> <span class="operator">=</span> <span class="variable">control_flow</span> <span class="brace">{</span>
262 foo::<span class="macro">die!</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> 262 foo::<span class="macro">die!</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
263 <span class="brace">}</span> 263 <span class="brace">}</span>
264<span class="brace">}</span> 264<span class="brace">}</span>
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs
index 9ebe000b5..6129af95f 100644
--- a/crates/rust-analyzer/src/semantic_tokens.rs
+++ b/crates/rust-analyzer/src/semantic_tokens.rs
@@ -92,7 +92,7 @@ define_semantic_token_modifiers![
92 (MUTABLE, "mutable"), 92 (MUTABLE, "mutable"),
93 (CONSUMING, "consuming"), 93 (CONSUMING, "consuming"),
94 (ASYNC, "async"), 94 (ASYNC, "async"),
95 (FOREIGN, "foreign"), 95 (LIBRARY, "library"),
96 (UNSAFE, "unsafe"), 96 (UNSAFE, "unsafe"),
97 (ATTRIBUTE_MODIFIER, "attribute"), 97 (ATTRIBUTE_MODIFIER, "attribute"),
98 (TRAIT_MODIFIER, "trait"), 98 (TRAIT_MODIFIER, "trait"),
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 6368ba413..af5152b9c 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -504,7 +504,7 @@ fn semantic_token_type_and_modifiers(
504 HlMod::Mutable => semantic_tokens::MUTABLE, 504 HlMod::Mutable => semantic_tokens::MUTABLE,
505 HlMod::Consuming => semantic_tokens::CONSUMING, 505 HlMod::Consuming => semantic_tokens::CONSUMING,
506 HlMod::Async => semantic_tokens::ASYNC, 506 HlMod::Async => semantic_tokens::ASYNC,
507 HlMod::Foreign => semantic_tokens::FOREIGN, 507 HlMod::Library => semantic_tokens::LIBRARY,
508 HlMod::Unsafe => semantic_tokens::UNSAFE, 508 HlMod::Unsafe => semantic_tokens::UNSAFE,
509 HlMod::Callable => semantic_tokens::CALLABLE, 509 HlMod::Callable => semantic_tokens::CALLABLE,
510 HlMod::Static => lsp_types::SemanticTokenModifier::STATIC, 510 HlMod::Static => lsp_types::SemanticTokenModifier::STATIC,