-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Made toggle_comments language dependent #463
Changes from 3 commits
a2de67d
4ae8933
f6fe0b7
b3ce245
f28ed0e
28a7f74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3399,7 +3399,8 @@ 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.as_ref().and_then(|l| l.comment_token.clone()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the |
||
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); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ pub struct Document { | |
|
||
syntax: Option<Syntax>, | ||
// /// Corresponding language scope name. Usually `source.<lang>`. | ||
pub(crate) language: Option<Arc<LanguageConfiguration>>, | ||
pub language: Option<Arc<LanguageConfiguration>>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't expose this, call |
||
|
||
/// Pending changes since last history commit. | ||
changes: ChangeSet, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Make this
Option<&str>
, then you cantoken.unwrap_or("//")
without requiring thatto_owned
.