Pycharm 2016.1 New Copy+Paste Indention Rule
I have the following code:
class ApiClient(object):
ASSET_ID = '12345'
def __init__(self):
pass
If I select the entire line containing "ASSET_ID" with "Shift + Down Arrow" (including the spaces before it). Then paste the result in the line directly under "ASSET_ID". I get the following:
class ApiClient(object):
ASSET_ID = '12345'
ASSET_ID = '12345'
def __init__(self, username):
pass
I would expect:
class ApiClient(object):
ASSET_ID = '12345'
ASSET_ID = '12345'
def __init__(self, username):
pass
Is there an option I can turn off so it doesn't try to do this formatting for me? I verified this does not happen in Pycharm 5.0.4.
Please advise.
请先登录再写评论。
Seems to be
https://youtrack.jetbrains.com/issue/PY-18932
and
https://youtrack.jetbrains.com/issue/PY-18522
This is incredibly disruptive to workflow.
Instead of Shift-Down Arrow, Copy, then Paste, you can just do Cmd-D (Ctrl-D on Windows) to trigger "Duplicate Line". Shorter, and it preserves indentation.
To address the commend of using Ctrl-D:
The example I posted above was using a single line. In that case, yes Ctrl-D would work. The general problem here is that this happens for multi-line pastes. It's good to see there is an open issue with Jet Brains.
I agree that this is incredibly disruptive to workflow.