Skip to content

Switch default comment to # #6470

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions helix-core/src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn find_line_comment(
pub fn toggle_line_comments(doc: &Rope, selection: &Selection, token: Option<&str>) -> Transaction {
let text = doc.slice(..);

let token = token.unwrap_or("//");
let token = token.unwrap_or("#");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it should be configurable. And then change the default in the configuration.

let comment = Tendril::from(format!("{} ", token));

let mut lines: Vec<usize> = Vec::with_capacity(selection.len());
Expand Down Expand Up @@ -116,7 +116,7 @@ mod test {
transaction.apply(&mut doc);
selection = selection.map(transaction.changes());

assert_eq!(doc, " // 1\n\n // 2\n // 3");
assert_eq!(doc, " # 1\n\n # 2\n # 3");

// uncomment
let transaction = toggle_line_comments(&doc, &selection, None);
Expand All @@ -126,7 +126,7 @@ mod test {
assert!(selection.len() == 1); // to ignore the selection unused warning

// 0 margin comments
doc = Rope::from(" //1\n\n //2\n //3");
doc = Rope::from(" #1\n\n #2\n #3");
// reset the selection.
selection = Selection::single(0, doc.len_chars() - 1);

Expand All @@ -137,7 +137,7 @@ mod test {
assert!(selection.len() == 1); // to ignore the selection unused warning

// 0 margin comments, with no space
doc = Rope::from("//");
doc = Rope::from("#");
// reset the selection.
selection = Selection::single(0, doc.len_chars() - 1);

Expand Down