Repository navigation
Auto indentation broken when return keyword involved #141
Copy link
Copy link
Closed
Labels
area-formattingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Milestone
Description
From Josh Smeaton (@jarshwah) on July 17, 2017 2:56
Environment data
VS Code version: 1.14.0
Python Extension version: 0.6.7
Python Version: 2.7.13
OS and version: OSX 10.12.5 (16F73)
Actual behavior
Auto indentation of function arguments fails when the function is preceded by the return keyword. The closing paren is put on the first column along with the cursor. Removing the return keyword fixes the issue.
# | represents cursor
def failing():
return arg(|) # hit enter
def failing():
return arg(
|)
def works():
arg(|) # hit enter
def works():
arg(
|
)
Expected behavior
def failing():
return arg(|) # hit enter
def failing():
return arg(
|
)
Steps to reproduce:
See expected and actual behaviour above
Settings
Your settings.json:
// Place your settings in this file to overwrite the default settings
{
"extensions.autoUpdate": true,
"editor.autoIndent": true,
"editor.fontSize": 13,
"editor.fontFamily": "Source Code Pro",
"editor.minimap.enabled": false,
"editor.wordWrap": "off",
"editor.rulers": [
79, 99, 119
],
"editor.renderIndentGuides": true,
"editor.renderLineHighlight": "all",
"editor.dragAndDrop": false,
"emmet.useNewEmmet": true,
"files.insertFinalNewline": true,
"python.pythonPath": "python3",
"python.formatting.provider": "yapf",
"python.formatting.autopep8Args": ["--max-line-length=119"],
"python.linting.pylintEnabled": false,
"python.linting.flake8Args": ["--max-line-length=119"],
"python.linting.enabled": true,
"python.linting.pep8Enabled": false,
"python.linting.flake8Enabled": true,
"python.workspaceSymbols.exclusionPatterns": [
"**/site-packages/**",
".tox/**"
],
"workbench.editor.showTabs": true,
"editor.renderWhitespace": "all",
"files.trimTrailingWhitespace": true,
"window.zoomLevel": 0,
"vsicons.projectDetection.autoReload": true,
"workbench.colorTheme": "Atom One Dark",
"workbench.iconTheme": "vscode-icons",
"workbench.editor.enablePreview": true,
"workbench.editor.revealIfOpen": true,
"sync.host": "",
"sync.pathPrefix": "",
"typescript.tsserver.log": "verbose",
"search.useRipgrep": false // todo: remove once global search fixed
}
Logs
Output from Python output panel
No Relevant Logs
Output from Console window (Help->Developer Tools menu)
No Relevant Logs
I see the same behaviour by switching the "editor.autoIndent": true, to false. Only began happening with 1.14.0 from memory.
Copied from original issue: DonJayamanne/pythonVSCode#1087
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-formattingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Activity
DonJayamanne commentedon Nov 13, 2017
Auto indentation for arguments (with braces), is not supported
DonJayamanne commentedon Nov 13, 2017
From Josh Smeaton (@jarshwah) on July 17, 2017 4:53
Don Jayamanne (@DonJayamanne) hopefully this short screencast will demonstrate the issue more clearly. I don't think my bug report got the issue across properly.
https://drive.google.com/file/d/0B5cRNkuMQpuYSDl6b1d1VWFiYjA/view?usp=sharing
You'll see that auto indentation works correctly when the return keyword isn't preceding the function call. I'm fairly sure this worked correctly until version 1.14.0 of VScode.
DonJayamanne commentedon Nov 13, 2017
From Josh Smeaton (@jarshwah) on July 19, 2017 1:16
Don Jayamanne (@DonJayamanne) did you get a chance to look at the linked video showing the problem? I believe the issue is supported, but happy to hear otherwise once you've seen the issue demonstrated.
DonJayamanne commentedon Nov 13, 2017
Will look into this
DonJayamanne commentedon Dec 20, 2017
I'm sorry for not getting back to you any sooner. I can confirm this is a bug in the extension.
9 remaining items
Work around VSC issue with formatting on save #624 (#635)
Formatting on Enter (#649)
Improve tooltip display (#725)
Limit Jedi RAM consumption (#744)
Update Jedi to 0.11.1 (#762)
Jedi 0.11 parser + test fixes (#777)
Improves linting behavior per #722 (#792)
Fix backslash escape, multiple linters output, .pyenv/versions folder…
Disable pylint print statement flag + fix venv detection (#954)
Change how we offer to install/disable linters (#973)
Add missing operators in tokenizer, handle end-of-comment completion …