From bb43a90b86de3c663222c8ebfb045fd14b3d5d7a Mon Sep 17 00:00:00 2001 From: Timothy Hutz Date: Fri, 9 Aug 2024 11:36:47 -0400 Subject: [PATCH] removed duplicate in lang-support MD file with vector dedup. (#10563) --- book/src/generated/lang-support.md | 2 +- xtask/src/docgen.rs | 29 ++++++++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index f0d63ab1f..4b0bca38c 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -1,6 +1,6 @@ | Language | Syntax Highlighting | Treesitter Textobjects | Auto Indent | Default LSP | | --- | --- | --- | --- | --- | -| ada | ✓ | ✓ | | `ada_language_server`, `ada_language_server` | +| ada | ✓ | ✓ | | `ada_language_server` | | adl | ✓ | ✓ | ✓ | | | agda | ✓ | | | | | astro | ✓ | | | | diff --git a/xtask/src/docgen.rs b/xtask/src/docgen.rs index 034d9918e..18c145d50 100644 --- a/xtask/src/docgen.rs +++ b/xtask/src/docgen.rs @@ -1,9 +1,9 @@ use crate::helpers; use crate::path; use crate::DynError; - use helix_term::commands::TYPABLE_COMMAND_LIST; use helix_term::health::TsFeature; +use std::collections::HashSet; use std::fs; pub const TYPABLE_COMMANDS_MD_OUTPUT: &str = "typable-cmd.md"; @@ -95,14 +95,25 @@ pub fn lang_features() -> Result { .to_owned(), ); } - row.push( - lc.language_servers - .iter() - .filter_map(|ls| config.language_server.get(&ls.name)) - .map(|s| md_mono(&s.command.clone())) - .collect::>() - .join(", "), - ); + let mut seen_commands = HashSet::new(); + let mut commands = String::new(); + for ls_config in lc + .language_servers + .iter() + .filter_map(|ls| config.language_server.get(&ls.name)) + { + let command = &ls_config.command; + if !seen_commands.insert(command) { + continue; + } + + if !commands.is_empty() { + commands.push_str(", "); + } + + commands.push_str(&md_mono(command)); + } + row.push(commands); md.push_str(&md_table_row(&row)); row.clear();