mirror of
https://github.com/helix-editor/helix.git
synced 2024-12-18 14:01:55 +04:00
Change default comment token to # for unrecognized files (#12080)
* Change the default comment token * update test * keep the original
This commit is contained in:
parent
565bfbba25
commit
e670970dd8
@ -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<str>>(
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user