From e670970dd83451ece2ef478cda60ed23959d8d4b Mon Sep 17 00:00:00 2001 From: Kieran Moy Date: Thu, 5 Dec 2024 08:11:39 +0800 Subject: [PATCH] Change default comment token to # for unrecognized files (#12080) * Change the default comment token * update test * keep the original --- helix-core/src/comment.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/helix-core/src/comment.rs b/helix-core/src/comment.rs index 5a34e7e17..d63d05fa9 100644 --- a/helix-core/src/comment.rs +++ b/helix-core/src/comment.rs @@ -9,7 +9,7 @@ use helix_stdx::rope::RopeSliceExt; use std::borrow::Cow; -pub const DEFAULT_COMMENT_TOKEN: &str = "//"; +pub const DEFAULT_COMMENT_TOKEN: &str = "#"; /// Returns the longest matching comment token of the given line (if it exists). pub fn get_comment_token<'a, S: AsRef>( @@ -373,12 +373,12 @@ fn comment() { let transaction = toggle_line_comments(&doc, &selection, None); transaction.apply(&mut doc); - assert_eq!(doc, " // 1\n\n // 2\n // 3"); + assert_eq!(doc, " # 1\n\n # 2\n # 3"); } #[test] fn uncomment() { - let mut doc = Rope::from(" // 1\n\n // 2\n // 3"); + let mut doc = Rope::from(" # 1\n\n # 2\n # 3"); let mut selection = Selection::single(0, doc.len_chars() - 1); let transaction = toggle_line_comments(&doc, &selection, None); @@ -391,7 +391,7 @@ fn uncomment() { #[test] fn uncomment_0_margin_comments() { - let mut doc = Rope::from(" //1\n\n //2\n //3"); + let mut doc = Rope::from(" #1\n\n #2\n #3"); let mut selection = Selection::single(0, doc.len_chars() - 1); let transaction = toggle_line_comments(&doc, &selection, None); @@ -404,7 +404,7 @@ fn uncomment_0_margin_comments() { #[test] fn uncomment_0_margin_comments_with_no_space() { - let mut doc = Rope::from("//"); + let mut doc = Rope::from("#"); let mut selection = Selection::single(0, doc.len_chars() - 1); let transaction = toggle_line_comments(&doc, &selection, None);