Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

ruby: Fix solargraph completion highlighting (#11825)

Vitaly Slobodin43be375c7682
diff --git a/extensions/ruby/src/language_servers/solargraph.rs b/extensions/ruby/src/language_servers/solargraph.rs
index a1207b70b20..32e9f6b173a 100644
--- a/extensions/ruby/src/language_servers/solargraph.rs
+++ b/extensions/ruby/src/language_servers/solargraph.rs
@@ -20,49 +20,43 @@ impl Solargraph {
}
pub fn label_for_completion(&self, completion: Completion) -> Option<CodeLabel> {
- match completion.kind? {
- CompletionKind::Method => {
- let highlight_name = match completion.kind? {
- CompletionKind::Class | CompletionKind::Module => "type",
- CompletionKind::Constant => "constant",
- CompletionKind::Method => "function.method",
- CompletionKind::Keyword => {
- if completion.label.starts_with(':') {
- "string.special.symbol"
- } else {
- "keyword"
- }
- }
- CompletionKind::Variable => {
- if completion.label.starts_with('@') {
- "property"
- } else {
- return None;
- }
- }
- _ => return None,
- };
-
- let len = completion.label.len();
- let name_span =
- CodeLabelSpan::literal(completion.label, Some(highlight_name.to_string()));
-
- Some(CodeLabel {
- code: Default::default(),
- spans: if let Some(detail) = completion.detail {
- vec![
- name_span,
- CodeLabelSpan::literal(" ", None),
- CodeLabelSpan::literal(detail, None),
- ]
- } else {
- vec![name_span]
- },
- filter_range: (0..len).into(),
- })
+ let highlight_name = match completion.kind? {
+ CompletionKind::Class | CompletionKind::Module => "type",
+ CompletionKind::Constant => "constant",
+ CompletionKind::Method => "function.method",
+ CompletionKind::Keyword => {
+ if completion.label.starts_with(':') {
+ "string.special.symbol"
+ } else {
+ "keyword"
+ }
}
- _ => None,
- }
+ CompletionKind::Variable => {
+ if completion.label.starts_with('@') {
+ "property"
+ } else {
+ return None;
+ }
+ }
+ _ => return None,
+ };
+
+ let len = completion.label.len();
+ let name_span = CodeLabelSpan::literal(completion.label, Some(highlight_name.to_string()));
+
+ Some(CodeLabel {
+ code: Default::default(),
+ spans: if let Some(detail) = completion.detail {
+ vec![
+ name_span,
+ CodeLabelSpan::literal(" ", None),
+ CodeLabelSpan::literal(detail, None),
+ ]
+ } else {
+ vec![name_span]
+ },
+ filter_range: (0..len).into(),
+ })
}
pub fn label_for_symbol(&self, symbol: Symbol) -> Option<CodeLabel> {