X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/b4dca26c7d93f930bbd5a7b552807370b60d4298..a69bda3b9bde208d5489eb2e37fc982b6bc1d8df:/src/black/trans.py?ds=inline diff --git a/src/black/trans.py b/src/black/trans.py index daed264..c0cc926 100644 --- a/src/black/trans.py +++ b/src/black/trans.py @@ -942,6 +942,9 @@ class StringParenStripper(StringTransformer): LL[lpar_or_rpar_idx].remove() # Remove lpar. replace_child(LL[idx], string_leaf) new_line.append(string_leaf) + # replace comments + old_comments = new_line.comments.pop(id(LL[idx]), []) + new_line.comments.setdefault(id(string_leaf), []).extend(old_comments) else: LL[lpar_or_rpar_idx].remove() # This is a rpar.