aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorCor Peters2021-07-18 16:33:38 +0000
committerGitHub2021-07-18 16:33:38 +0000
commitcd65a48635d49ccc2aed55a315c3a33875e13f88 (patch)
tree0197d8f8fc68d29517e3ac564e4f9b2a2bf881b0 /helix-term
parent0aa43902cab5dbcddb72ddf5d3b825ef874dc620 (diff)
Made toggle_comments language dependent (#463)
* Made toggle_comments language dependent * Fixed Test Cases * Added clippy suggestion * Small Fixes * Clippy Suggestion Co-authored-by: Cor <prive@corpeters.nl>
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 7e769f4e..5fc96cd9 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3399,7 +3399,11 @@ fn hover(cx: &mut Context) {
// comments
fn toggle_comments(cx: &mut Context) {
let (view, doc) = current!(cx.editor);
- let transaction = comment::toggle_line_comments(doc.text(), doc.selection(view.id));
+ let token = doc
+ .language_config()
+ .and_then(|lc| lc.comment_token.as_ref())
+ .map(|tc| tc.as_ref());
+ let transaction = comment::toggle_line_comments(doc.text(), doc.selection(view.id), token);
doc.apply(&transaction, view.id);
doc.append_changes_to_history(view.id);