ocaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

URI completion should not omit content-addresses

References: https://todo.sr.ht/~jonsterling/forester/156

+27 -23
+27 -23
lib/language_server/Completion.ml
··· 313 313 () 314 314 315 315 let addr_completions ~(forest : State.t) : L.CompletionItem.t list = 316 - List.of_seq @@ 317 - let@ uri, tree = Seq.map @~ URI.Tbl.to_seq forest.index in 318 - let frontmatter = Tree.get_frontmatter tree in 319 - let title = Option.map (State.get_expanded_title @~ forest) frontmatter in 320 - let render = Plain_text_client.string_of_content ~forest in 321 - let documentation = 322 - let taxon = Option.bind frontmatter (fun fm -> fm.taxon) in 323 - let content = 324 - Format.asprintf 325 - {|%s\n %s\n |} 326 - (Option.fold ~none: "" ~some: (fun s -> Format.asprintf "# %s" (render s)) title) 327 - (Option.fold ~none: "" ~some: (fun s -> Format.asprintf "taxon: %s" (render s)) taxon) 328 - in 329 - Some (`String content) 316 + let articles = List.of_seq @@ State.get_all_articles forest in 317 + let@ article = List.filter_map @~ articles in 318 + let frontmatter = article.frontmatter in 319 + let@ _ = Option.bind frontmatter.title in 320 + let title = State.get_expanded_title frontmatter forest in 321 + let render = Plain_text_client.string_of_content ~forest in 322 + let documentation = 323 + let taxon = frontmatter.taxon in 324 + let content = 325 + Format.asprintf 326 + "# %s\n %s\n " 327 + (render title) 328 + (Option.fold ~none: "" ~some: (fun s -> Format.asprintf "taxon: %s" (render s)) taxon) 330 329 in 331 - let insertText = URI_scheme.name uri in 332 - let title_text = Option.map render title in 333 - let filterText = Option.fold ~none: insertText ~some: (fun s -> insertText ^ " " ^ s) title_text in 334 - L.CompletionItem.create 335 - ?documentation 336 - ~label: (Format.(asprintf "%a (%s)" (pp_print_option pp_print_string) title_text (URI_scheme.name uri))) 337 - ~insertText 338 - ~filterText 339 - () 330 + Some (`String content) 331 + in 332 + let@ uri = Option.bind @@ frontmatter.uri in 333 + let@ title = Option.bind @@ frontmatter.title in 334 + let insertText = URI_scheme.name uri in 335 + let title_text = render title in 336 + let filterText = insertText ^ " " ^ title_text in 337 + Option.some @@ 338 + L.CompletionItem.create 339 + ?documentation 340 + ~label: (Format.(asprintf "%a (%s)" pp_print_string title_text (URI_scheme.name uri))) 341 + ~insertText 342 + ~filterText 343 + () 340 344 341 345 let new_addr_completions ~(forest : State.t) : L.CompletionItem.t list = 342 346 let next mode = URI_util.next_uri ~prefix: None ~mode ~forest in