Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplicate command names in generated LSP support doc #10563

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
@@ -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 | ✓ | | | |
Expand Down
29 changes: 20 additions & 9 deletions xtask/src/docgen.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::helpers;
use crate::path;
use crate::DynError;

timothyhutz marked this conversation as resolved.
Show resolved Hide resolved
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";
Expand Down Expand Up @@ -95,14 +95,25 @@ pub fn lang_features() -> Result<String, DynError> {
.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::<Vec<_>>()
.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();
Expand Down