Skip to content

Commit 6148578

Browse files
committed
preserve the := operator
1 parent 2c184a1 commit 6148578

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: formatR
22
Type: Package
33
Title: Format R Code Automatically
4-
Version: 1.13
4+
Version: 1.13.1
55
Authors@R: c(
66
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
77
person("Ed", "Lee", role = "ctb"),

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# CHANGES IN formatR VERSION 1.14
2+
3+
- `tidy_source()` supports the `:=` operator now (which is widely used in **data.table**).
4+
15
# CHANGES IN formatR VERSION 1.13
26

37
- `tidy_source()` supports anonymous functions of the form `\(args) expr` for R >= 4.1.0 now (thanks, @notPlancha, #98).

R/utils.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ mask_comments = function(x, comment, blank.line, wrap, arrow, pipe, args.newline
6565
d.text[d.text == '|>'] = paste0('%', '\b|>', spaces, '%')
6666
# preserve the assignment operator ->
6767
d.text[d.text == '->'] = '%\b->%'
68+
# preserve := for data.table
69+
d.text[d.text == ':='] = '%\b:=%'
6870
# R 4.1.0 anonymous functions
6971
if (length(i <- which(d.token == "'\\\\'"))) {
7072
d.text[i] = '`\\\\`'

0 commit comments

Comments
 (0)