1use anyhow::{anyhow, Context as _, Result};
2use async_trait::async_trait;
3use collections::HashMap;
4use futures::StreamExt;
5use gpui::{App, AsyncApp, Task};
6use http_client::github::latest_github_release;
7pub use language::*;
8use lsp::{LanguageServerBinary, LanguageServerName};
9use project::Fs;
10use regex::Regex;
11use serde_json::json;
12use smol::fs;
13use std::{
14 any::Any,
15 borrow::Cow,
16 ffi::{OsStr, OsString},
17 ops::Range,
18 path::PathBuf,
19 process::Output,
20 str,
21 sync::{
22 atomic::{AtomicBool, Ordering::SeqCst},
23 Arc, LazyLock,
24 },
25};
26use task::{TaskTemplate, TaskTemplates, TaskVariables, VariableName};
27use util::{fs::remove_matching, maybe, ResultExt};
28
29fn server_binary_arguments() -> Vec<OsString> {
30 vec!["-mode=stdio".into()]
31}
32
33#[derive(Copy, Clone)]
34pub struct GoLspAdapter;
35
36impl GoLspAdapter {
37 const SERVER_NAME: LanguageServerName = LanguageServerName::new_static("gopls");
38}
39
40static VERSION_REGEX: LazyLock<Regex> =
41 LazyLock::new(|| Regex::new(r"\d+\.\d+\.\d+").expect("Failed to create VERSION_REGEX"));
42
43static GO_ESCAPE_SUBTEST_NAME_REGEX: LazyLock<Regex> = LazyLock::new(|| {
44 Regex::new(r#"[.*+?^${}()|\[\]\\]"#).expect("Failed to create GO_ESCAPE_SUBTEST_NAME_REGEX")
45});
46
47const BINARY: &str = if cfg!(target_os = "windows") {
48 "gopls.exe"
49} else {
50 "gopls"
51};
52
53#[async_trait(?Send)]
54impl super::LspAdapter for GoLspAdapter {
55 fn name(&self) -> LanguageServerName {
56 Self::SERVER_NAME.clone()
57 }
58
59 async fn fetch_latest_server_version(
60 &self,
61 delegate: &dyn LspAdapterDelegate,
62 ) -> Result<Box<dyn 'static + Send + Any>> {
63 let release =
64 latest_github_release("golang/tools", false, false, delegate.http_client()).await?;
65 let version: Option<String> = release.tag_name.strip_prefix("gopls/v").map(str::to_string);
66 if version.is_none() {
67 log::warn!(
68 "couldn't infer gopls version from GitHub release tag name '{}'",
69 release.tag_name
70 );
71 }
72 Ok(Box::new(version) as Box<_>)
73 }
74
75 async fn check_if_user_installed(
76 &self,
77 delegate: &dyn LspAdapterDelegate,
78 _: Arc<dyn LanguageToolchainStore>,
79 _: &AsyncApp,
80 ) -> Option<LanguageServerBinary> {
81 let path = delegate.which(Self::SERVER_NAME.as_ref()).await?;
82 Some(LanguageServerBinary {
83 path,
84 arguments: server_binary_arguments(),
85 env: None,
86 })
87 }
88
89 fn will_fetch_server(
90 &self,
91 delegate: &Arc<dyn LspAdapterDelegate>,
92 cx: &mut AsyncApp,
93 ) -> Option<Task<Result<()>>> {
94 static DID_SHOW_NOTIFICATION: AtomicBool = AtomicBool::new(false);
95
96 const NOTIFICATION_MESSAGE: &str =
97 "Could not install the Go language server `gopls`, because `go` was not found.";
98
99 let delegate = delegate.clone();
100 Some(cx.spawn(async move |cx| {
101 if delegate.which("go".as_ref()).await.is_none() {
102 if DID_SHOW_NOTIFICATION
103 .compare_exchange(false, true, SeqCst, SeqCst)
104 .is_ok()
105 {
106 cx.update(|cx| {
107 delegate.show_notification(NOTIFICATION_MESSAGE, cx);
108 })?
109 }
110 return Err(anyhow!("cannot install gopls"));
111 }
112 Ok(())
113 }))
114 }
115
116 async fn fetch_server_binary(
117 &self,
118 version: Box<dyn 'static + Send + Any>,
119 container_dir: PathBuf,
120 delegate: &dyn LspAdapterDelegate,
121 ) -> Result<LanguageServerBinary> {
122 let go = delegate.which("go".as_ref()).await.unwrap_or("go".into());
123 let go_version_output = util::command::new_smol_command(&go)
124 .args(["version"])
125 .output()
126 .await
127 .context("failed to get go version via `go version` command`")?;
128 let go_version = parse_version_output(&go_version_output)?;
129 let version = version.downcast::<Option<String>>().unwrap();
130 let this = *self;
131
132 if let Some(version) = *version {
133 let binary_path = container_dir.join(format!("gopls_{version}_go_{go_version}"));
134 if let Ok(metadata) = fs::metadata(&binary_path).await {
135 if metadata.is_file() {
136 remove_matching(&container_dir, |entry| {
137 entry != binary_path && entry.file_name() != Some(OsStr::new("gobin"))
138 })
139 .await;
140
141 return Ok(LanguageServerBinary {
142 path: binary_path.to_path_buf(),
143 arguments: server_binary_arguments(),
144 env: None,
145 });
146 }
147 }
148 } else if let Some(path) = this
149 .cached_server_binary(container_dir.clone(), delegate)
150 .await
151 {
152 return Ok(path);
153 }
154
155 let gobin_dir = container_dir.join("gobin");
156 fs::create_dir_all(&gobin_dir).await?;
157 let install_output = util::command::new_smol_command(go)
158 .env("GO111MODULE", "on")
159 .env("GOBIN", &gobin_dir)
160 .args(["install", "golang.org/x/tools/gopls@latest"])
161 .output()
162 .await?;
163
164 if !install_output.status.success() {
165 log::error!(
166 "failed to install gopls via `go install`. stdout: {:?}, stderr: {:?}",
167 String::from_utf8_lossy(&install_output.stdout),
168 String::from_utf8_lossy(&install_output.stderr)
169 );
170
171 return Err(anyhow!("failed to install gopls with `go install`. Is `go` installed and in the PATH? Check logs for more information."));
172 }
173
174 let installed_binary_path = gobin_dir.join(BINARY);
175 let version_output = util::command::new_smol_command(&installed_binary_path)
176 .arg("version")
177 .output()
178 .await
179 .context("failed to run installed gopls binary")?;
180 let gopls_version = parse_version_output(&version_output)?;
181 let binary_path = container_dir.join(format!("gopls_{gopls_version}_go_{go_version}"));
182 fs::rename(&installed_binary_path, &binary_path).await?;
183
184 Ok(LanguageServerBinary {
185 path: binary_path.to_path_buf(),
186 arguments: server_binary_arguments(),
187 env: None,
188 })
189 }
190
191 async fn cached_server_binary(
192 &self,
193 container_dir: PathBuf,
194 _: &dyn LspAdapterDelegate,
195 ) -> Option<LanguageServerBinary> {
196 get_cached_server_binary(container_dir).await
197 }
198
199 async fn initialization_options(
200 self: Arc<Self>,
201 _: &dyn Fs,
202 _: &Arc<dyn LspAdapterDelegate>,
203 ) -> Result<Option<serde_json::Value>> {
204 Ok(Some(json!({
205 "usePlaceholders": true,
206 "hints": {
207 "assignVariableTypes": true,
208 "compositeLiteralFields": true,
209 "compositeLiteralTypes": true,
210 "constantValues": true,
211 "functionTypeParameters": true,
212 "parameterNames": true,
213 "rangeVariableTypes": true
214 }
215 })))
216 }
217
218 async fn label_for_completion(
219 &self,
220 completion: &lsp::CompletionItem,
221 language: &Arc<Language>,
222 ) -> Option<CodeLabel> {
223 let label = &completion.label;
224
225 // Gopls returns nested fields and methods as completions.
226 // To syntax highlight these, combine their final component
227 // with their detail.
228 let name_offset = label.rfind('.').unwrap_or(0);
229
230 match completion.kind.zip(completion.detail.as_ref()) {
231 Some((lsp::CompletionItemKind::MODULE, detail)) => {
232 let text = format!("{label} {detail}");
233 let source = Rope::from(format!("import {text}").as_str());
234 let runs = language.highlight_text(&source, 7..7 + text.len());
235 return Some(CodeLabel {
236 text,
237 runs,
238 filter_range: 0..label.len(),
239 });
240 }
241 Some((
242 lsp::CompletionItemKind::CONSTANT | lsp::CompletionItemKind::VARIABLE,
243 detail,
244 )) => {
245 let text = format!("{label} {detail}");
246 let source =
247 Rope::from(format!("var {} {}", &text[name_offset..], detail).as_str());
248 let runs = adjust_runs(
249 name_offset,
250 language.highlight_text(&source, 4..4 + text.len()),
251 );
252 return Some(CodeLabel {
253 text,
254 runs,
255 filter_range: 0..label.len(),
256 });
257 }
258 Some((lsp::CompletionItemKind::STRUCT, _)) => {
259 let text = format!("{label} struct {{}}");
260 let source = Rope::from(format!("type {}", &text[name_offset..]).as_str());
261 let runs = adjust_runs(
262 name_offset,
263 language.highlight_text(&source, 5..5 + text.len()),
264 );
265 return Some(CodeLabel {
266 text,
267 runs,
268 filter_range: 0..label.len(),
269 });
270 }
271 Some((lsp::CompletionItemKind::INTERFACE, _)) => {
272 let text = format!("{label} interface {{}}");
273 let source = Rope::from(format!("type {}", &text[name_offset..]).as_str());
274 let runs = adjust_runs(
275 name_offset,
276 language.highlight_text(&source, 5..5 + text.len()),
277 );
278 return Some(CodeLabel {
279 text,
280 runs,
281 filter_range: 0..label.len(),
282 });
283 }
284 Some((lsp::CompletionItemKind::FIELD, detail)) => {
285 let text = format!("{label} {detail}");
286 let source =
287 Rope::from(format!("type T struct {{ {} }}", &text[name_offset..]).as_str());
288 let runs = adjust_runs(
289 name_offset,
290 language.highlight_text(&source, 16..16 + text.len()),
291 );
292 return Some(CodeLabel {
293 text,
294 runs,
295 filter_range: 0..label.len(),
296 });
297 }
298 Some((lsp::CompletionItemKind::FUNCTION | lsp::CompletionItemKind::METHOD, detail)) => {
299 if let Some(signature) = detail.strip_prefix("func") {
300 let text = format!("{label}{signature}");
301 let source = Rope::from(format!("func {} {{}}", &text[name_offset..]).as_str());
302 let runs = adjust_runs(
303 name_offset,
304 language.highlight_text(&source, 5..5 + text.len()),
305 );
306 return Some(CodeLabel {
307 filter_range: 0..label.len(),
308 text,
309 runs,
310 });
311 }
312 }
313 _ => {}
314 }
315 None
316 }
317
318 async fn label_for_symbol(
319 &self,
320 name: &str,
321 kind: lsp::SymbolKind,
322 language: &Arc<Language>,
323 ) -> Option<CodeLabel> {
324 let (text, filter_range, display_range) = match kind {
325 lsp::SymbolKind::METHOD | lsp::SymbolKind::FUNCTION => {
326 let text = format!("func {} () {{}}", name);
327 let filter_range = 5..5 + name.len();
328 let display_range = 0..filter_range.end;
329 (text, filter_range, display_range)
330 }
331 lsp::SymbolKind::STRUCT => {
332 let text = format!("type {} struct {{}}", name);
333 let filter_range = 5..5 + name.len();
334 let display_range = 0..text.len();
335 (text, filter_range, display_range)
336 }
337 lsp::SymbolKind::INTERFACE => {
338 let text = format!("type {} interface {{}}", name);
339 let filter_range = 5..5 + name.len();
340 let display_range = 0..text.len();
341 (text, filter_range, display_range)
342 }
343 lsp::SymbolKind::CLASS => {
344 let text = format!("type {} T", name);
345 let filter_range = 5..5 + name.len();
346 let display_range = 0..filter_range.end;
347 (text, filter_range, display_range)
348 }
349 lsp::SymbolKind::CONSTANT => {
350 let text = format!("const {} = nil", name);
351 let filter_range = 6..6 + name.len();
352 let display_range = 0..filter_range.end;
353 (text, filter_range, display_range)
354 }
355 lsp::SymbolKind::VARIABLE => {
356 let text = format!("var {} = nil", name);
357 let filter_range = 4..4 + name.len();
358 let display_range = 0..filter_range.end;
359 (text, filter_range, display_range)
360 }
361 lsp::SymbolKind::MODULE => {
362 let text = format!("package {}", name);
363 let filter_range = 8..8 + name.len();
364 let display_range = 0..filter_range.end;
365 (text, filter_range, display_range)
366 }
367 _ => return None,
368 };
369
370 Some(CodeLabel {
371 runs: language.highlight_text(&text.as_str().into(), display_range.clone()),
372 text: text[display_range].to_string(),
373 filter_range,
374 })
375 }
376}
377
378fn parse_version_output(output: &Output) -> Result<&str> {
379 let version_stdout =
380 str::from_utf8(&output.stdout).context("version command produced invalid utf8 output")?;
381
382 let version = VERSION_REGEX
383 .find(version_stdout)
384 .with_context(|| format!("failed to parse version output '{version_stdout}'"))?
385 .as_str();
386
387 Ok(version)
388}
389
390async fn get_cached_server_binary(container_dir: PathBuf) -> Option<LanguageServerBinary> {
391 maybe!(async {
392 let mut last_binary_path = None;
393 let mut entries = fs::read_dir(&container_dir).await?;
394 while let Some(entry) = entries.next().await {
395 let entry = entry?;
396 if entry.file_type().await?.is_file()
397 && entry
398 .file_name()
399 .to_str()
400 .map_or(false, |name| name.starts_with("gopls_"))
401 {
402 last_binary_path = Some(entry.path());
403 }
404 }
405
406 if let Some(path) = last_binary_path {
407 Ok(LanguageServerBinary {
408 path,
409 arguments: server_binary_arguments(),
410 env: None,
411 })
412 } else {
413 Err(anyhow!("no cached binary"))
414 }
415 })
416 .await
417 .log_err()
418}
419
420fn adjust_runs(
421 delta: usize,
422 mut runs: Vec<(Range<usize>, HighlightId)>,
423) -> Vec<(Range<usize>, HighlightId)> {
424 for (range, _) in &mut runs {
425 range.start += delta;
426 range.end += delta;
427 }
428 runs
429}
430
431pub(crate) struct GoContextProvider;
432
433const GO_PACKAGE_TASK_VARIABLE: VariableName = VariableName::Custom(Cow::Borrowed("GO_PACKAGE"));
434const GO_MODULE_ROOT_TASK_VARIABLE: VariableName =
435 VariableName::Custom(Cow::Borrowed("GO_MODULE_ROOT"));
436const GO_SUBTEST_NAME_TASK_VARIABLE: VariableName =
437 VariableName::Custom(Cow::Borrowed("GO_SUBTEST_NAME"));
438
439impl ContextProvider for GoContextProvider {
440 fn build_context(
441 &self,
442 variables: &TaskVariables,
443 location: &Location,
444 _: Option<HashMap<String, String>>,
445 _: Arc<dyn LanguageToolchainStore>,
446 cx: &mut gpui::App,
447 ) -> Task<Result<TaskVariables>> {
448 let local_abs_path = location
449 .buffer
450 .read(cx)
451 .file()
452 .and_then(|file| Some(file.as_local()?.abs_path(cx)));
453
454 let go_package_variable = local_abs_path
455 .as_deref()
456 .and_then(|local_abs_path| local_abs_path.parent())
457 .map(|buffer_dir| {
458 // Prefer the relative form `./my-nested-package/is-here` over
459 // absolute path, because it's more readable in the modal, but
460 // the absolute path also works.
461 let package_name = variables
462 .get(&VariableName::WorktreeRoot)
463 .and_then(|worktree_abs_path| buffer_dir.strip_prefix(worktree_abs_path).ok())
464 .map(|relative_pkg_dir| {
465 if relative_pkg_dir.as_os_str().is_empty() {
466 ".".into()
467 } else {
468 format!("./{}", relative_pkg_dir.to_string_lossy())
469 }
470 })
471 .unwrap_or_else(|| format!("{}", buffer_dir.to_string_lossy()));
472
473 (GO_PACKAGE_TASK_VARIABLE.clone(), package_name.to_string())
474 });
475
476 let go_module_root_variable = local_abs_path
477 .as_deref()
478 .and_then(|local_abs_path| local_abs_path.parent())
479 .map(|buffer_dir| {
480 // Walk dirtree up until getting the first go.mod file
481 let module_dir = buffer_dir
482 .ancestors()
483 .find(|dir| dir.join("go.mod").is_file())
484 .map(|dir| dir.to_string_lossy().to_string())
485 .unwrap_or_else(|| ".".to_string());
486
487 (GO_MODULE_ROOT_TASK_VARIABLE.clone(), module_dir)
488 });
489
490 let _subtest_name = variables.get(&VariableName::Custom(Cow::Borrowed("_subtest_name")));
491
492 let go_subtest_variable = extract_subtest_name(_subtest_name.unwrap_or(""))
493 .map(|subtest_name| (GO_SUBTEST_NAME_TASK_VARIABLE.clone(), subtest_name));
494
495 Task::ready(Ok(TaskVariables::from_iter(
496 [
497 go_package_variable,
498 go_subtest_variable,
499 go_module_root_variable,
500 ]
501 .into_iter()
502 .flatten(),
503 )))
504 }
505
506 fn associated_tasks(
507 &self,
508 _: Option<Arc<dyn language::File>>,
509 _: &App,
510 ) -> Option<TaskTemplates> {
511 let package_cwd = if GO_PACKAGE_TASK_VARIABLE.template_value() == "." {
512 None
513 } else {
514 Some("$ZED_DIRNAME".to_string())
515 };
516 let module_cwd = Some(GO_MODULE_ROOT_TASK_VARIABLE.template_value());
517
518 Some(TaskTemplates(vec![
519 TaskTemplate {
520 label: format!(
521 "go test {} -run {}",
522 GO_PACKAGE_TASK_VARIABLE.template_value(),
523 VariableName::Symbol.template_value(),
524 ),
525 command: "go".into(),
526 args: vec![
527 "test".into(),
528 "-run".into(),
529 format!("^{}\\$", VariableName::Symbol.template_value(),),
530 ],
531 tags: vec!["go-test".to_owned()],
532 cwd: package_cwd.clone(),
533 ..TaskTemplate::default()
534 },
535 TaskTemplate {
536 label: format!("go test {}", GO_PACKAGE_TASK_VARIABLE.template_value()),
537 command: "go".into(),
538 args: vec!["test".into()],
539 cwd: package_cwd.clone(),
540 ..TaskTemplate::default()
541 },
542 TaskTemplate {
543 label: "go test ./...".into(),
544 command: "go".into(),
545 args: vec!["test".into(), "./...".into()],
546 cwd: module_cwd.clone(),
547 ..TaskTemplate::default()
548 },
549 TaskTemplate {
550 label: format!(
551 "go test {} -v -run {}/{}",
552 GO_PACKAGE_TASK_VARIABLE.template_value(),
553 VariableName::Symbol.template_value(),
554 GO_SUBTEST_NAME_TASK_VARIABLE.template_value(),
555 ),
556 command: "go".into(),
557 args: vec![
558 "test".into(),
559 "-v".into(),
560 "-run".into(),
561 format!(
562 "^{}\\$/^{}\\$",
563 VariableName::Symbol.template_value(),
564 GO_SUBTEST_NAME_TASK_VARIABLE.template_value(),
565 ),
566 ],
567 cwd: package_cwd.clone(),
568 tags: vec!["go-subtest".to_owned()],
569 ..TaskTemplate::default()
570 },
571 TaskTemplate {
572 label: format!(
573 "go test {} -bench {}",
574 GO_PACKAGE_TASK_VARIABLE.template_value(),
575 VariableName::Symbol.template_value()
576 ),
577 command: "go".into(),
578 args: vec![
579 "test".into(),
580 "-benchmem".into(),
581 "-run=^$".into(),
582 "-bench".into(),
583 format!("^{}\\$", VariableName::Symbol.template_value()),
584 ],
585 cwd: package_cwd.clone(),
586 tags: vec!["go-benchmark".to_owned()],
587 ..TaskTemplate::default()
588 },
589 TaskTemplate {
590 label: format!(
591 "go test {} -fuzz=Fuzz -run {}",
592 GO_PACKAGE_TASK_VARIABLE.template_value(),
593 VariableName::Symbol.template_value(),
594 ),
595 command: "go".into(),
596 args: vec![
597 "test".into(),
598 "-fuzz=Fuzz".into(),
599 "-run".into(),
600 format!("^{}\\$", VariableName::Symbol.template_value(),),
601 ],
602 tags: vec!["go-fuzz".to_owned()],
603 cwd: package_cwd.clone(),
604 ..TaskTemplate::default()
605 },
606 TaskTemplate {
607 label: format!("go run {}", GO_PACKAGE_TASK_VARIABLE.template_value(),),
608 command: "go".into(),
609 args: vec!["run".into(), ".".into()],
610 cwd: package_cwd.clone(),
611 tags: vec!["go-main".to_owned()],
612 ..TaskTemplate::default()
613 },
614 TaskTemplate {
615 label: format!("go generate {}", GO_PACKAGE_TASK_VARIABLE.template_value()),
616 command: "go".into(),
617 args: vec!["generate".into()],
618 cwd: package_cwd.clone(),
619 tags: vec!["go-generate".to_owned()],
620 ..TaskTemplate::default()
621 },
622 TaskTemplate {
623 label: "go generate ./...".into(),
624 command: "go".into(),
625 args: vec!["generate".into(), "./...".into()],
626 cwd: module_cwd.clone(),
627 ..TaskTemplate::default()
628 },
629 ]))
630 }
631}
632
633fn extract_subtest_name(input: &str) -> Option<String> {
634 let replaced_spaces = input.trim_matches('"').replace(' ', "_");
635
636 Some(
637 GO_ESCAPE_SUBTEST_NAME_REGEX
638 .replace_all(&replaced_spaces, |caps: ®ex::Captures| {
639 format!("\\{}", &caps[0])
640 })
641 .to_string(),
642 )
643}
644
645#[cfg(test)]
646mod tests {
647 use super::*;
648 use crate::language;
649 use gpui::Hsla;
650 use theme::SyntaxTheme;
651
652 #[gpui::test]
653 async fn test_go_label_for_completion() {
654 let adapter = Arc::new(GoLspAdapter);
655 let language = language("go", tree_sitter_go::LANGUAGE.into());
656
657 let theme = SyntaxTheme::new_test([
658 ("type", Hsla::default()),
659 ("keyword", Hsla::default()),
660 ("function", Hsla::default()),
661 ("number", Hsla::default()),
662 ("property", Hsla::default()),
663 ]);
664 language.set_theme(&theme);
665
666 let grammar = language.grammar().unwrap();
667 let highlight_function = grammar.highlight_id_for_name("function").unwrap();
668 let highlight_type = grammar.highlight_id_for_name("type").unwrap();
669 let highlight_keyword = grammar.highlight_id_for_name("keyword").unwrap();
670 let highlight_number = grammar.highlight_id_for_name("number").unwrap();
671
672 assert_eq!(
673 adapter
674 .label_for_completion(
675 &lsp::CompletionItem {
676 kind: Some(lsp::CompletionItemKind::FUNCTION),
677 label: "Hello".to_string(),
678 detail: Some("func(a B) c.D".to_string()),
679 ..Default::default()
680 },
681 &language
682 )
683 .await,
684 Some(CodeLabel {
685 text: "Hello(a B) c.D".to_string(),
686 filter_range: 0..5,
687 runs: vec![
688 (0..5, highlight_function),
689 (8..9, highlight_type),
690 (13..14, highlight_type),
691 ],
692 })
693 );
694
695 // Nested methods
696 assert_eq!(
697 adapter
698 .label_for_completion(
699 &lsp::CompletionItem {
700 kind: Some(lsp::CompletionItemKind::METHOD),
701 label: "one.two.Three".to_string(),
702 detail: Some("func() [3]interface{}".to_string()),
703 ..Default::default()
704 },
705 &language
706 )
707 .await,
708 Some(CodeLabel {
709 text: "one.two.Three() [3]interface{}".to_string(),
710 filter_range: 0..13,
711 runs: vec![
712 (8..13, highlight_function),
713 (17..18, highlight_number),
714 (19..28, highlight_keyword),
715 ],
716 })
717 );
718
719 // Nested fields
720 assert_eq!(
721 adapter
722 .label_for_completion(
723 &lsp::CompletionItem {
724 kind: Some(lsp::CompletionItemKind::FIELD),
725 label: "two.Three".to_string(),
726 detail: Some("a.Bcd".to_string()),
727 ..Default::default()
728 },
729 &language
730 )
731 .await,
732 Some(CodeLabel {
733 text: "two.Three a.Bcd".to_string(),
734 filter_range: 0..9,
735 runs: vec![(12..15, highlight_type)],
736 })
737 );
738 }
739}