Skip to content

Commit 1236d8d

Browse files
Fix parameter documentation on R >=4.3.1 (#771)
* Fix parameter documentation on R >=4.3.1 * Update crates/ark/src/lsp/help.rs Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 4074f51 commit 1236d8d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/ark/src/lsp/help.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl RHtmlHelp {
170170
/// <h3>Arguments</h3>
171171
///
172172
/// <table>
173-
/// <tr style="vertical-align: top;"><td><code>parameter</code></td>
173+
/// <tr><td><code>parameter</code></td>
174174
/// <td>
175175
/// Parameter documentation.
176176
/// </td></tr>
@@ -212,7 +212,7 @@ impl RHtmlHelp {
212212

213213
// Get the cells in this table.
214214
// I really wish R included classes on these table elements...
215-
let selector = Selector::parse(r#"tr[style="vertical-align: top;"] > td"#).unwrap();
215+
let selector = Selector::parse(r#"tr > td"#).unwrap();
216216
let mut cells = elt.select(&selector);
217217

218218
// Start iterating through pairs of cells.
@@ -371,6 +371,8 @@ fn for_each_section(doc: &Html, mut callback: impl FnMut(ElementRef, Vec<Element
371371

372372
#[cfg(test)]
373373
mod tests {
374+
use tower_lsp::lsp_types::MarkupKind;
375+
374376
use crate::lsp::help::RHtmlHelp;
375377
use crate::lsp::help::Status;
376378
use crate::r_task;
@@ -406,6 +408,12 @@ mod tests {
406408

407409
let markdown = help.markdown().unwrap();
408410
markdown.contains("### Usage");
411+
412+
let markdown = help.parameter("x").unwrap().unwrap();
413+
assert_eq!(markdown.kind, MarkupKind::Markdown);
414+
assert!(markdown.value.contains("vector or `NULL`"));
415+
416+
assert!(help.parameter("not_a_parameter").unwrap().is_none());
409417
});
410418
}
411419

0 commit comments

Comments
 (0)