Title: Auto dedent `else` in an `if`..`else` block not working if user is not in experiment · Issue #20479 · microsoft/vscode-python · GitHub
Open Graph Title: Auto dedent `else` in an `if`..`else` block not working if user is not in experiment · Issue #20479 · microsoft/vscode-python
X Title: Auto dedent `else` in an `if`..`else` block not working if user is not in experiment · Issue #20479 · microsoft/vscode-python
Description: Python extension for Visual Studio Code. Contribute to microsoft/vscode-python development by creating an account on GitHub.
Open Graph Description: Python extension for Visual Studio Code. Contribute to microsoft/vscode-python development by creating an account on GitHub.
X Description: Python extension for Visual Studio Code. Contribute to microsoft/vscode-python development by creating an account on GitHub.
Opengraph URL: https://github.com/microsoft/vscode-python
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Auto dedent `else` in an `if`..`else` block not working if user is not in experiment","articleBody":"### Discussed in https://github.com/microsoft/pylance-release/discussions/3804\r\n\r\n\u003cdiv type='discussions-op-text'>\r\n\r\n\u003csup>Originally posted by **drorata** December 22, 2022\u003c/sup>\r\n\u003c!--\r\nRead the guidelines for filing an issue first.\r\n\r\nhttps://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue\r\n-->\r\n\r\nFollowing the request from https://github.com/microsoft/vscode-python/issues/481 by @brettcannon \r\n\r\n## Environment data\r\n\r\n\u003c!--\r\nTo find your version, you can either:\r\n\r\n- Open the VS Code extensions panel. Locate Pylance from the list of installed extensions. The version appears next to the name.\r\n\r\n- Select \"View: Toggle Output\" from the command palette (Ctrl+Shift+P on Windows/Linux, Command+Shift+P on macOS), then select \"Python Language Server\" in the dropdown on the right. Look for the line Pylance Language Server version X in the console.\r\n-->\r\n\r\n- Language Server version: v2022.12.20\r\n- OS and version: macos 13.1\r\n- Python version (& distribution if applicable, e.g. Anaconda): 3.11\r\n\r\n## Code Snippet\r\n\r\n\u003c!--\r\nPlease provide a minimal, self-contained code snippet that reproduces the issue. If the code snippet uses any libraries, please specify the versions used.\r\n\r\nNote: If you think a GIF of what is happening would be helpful, consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ .\r\n-->\r\n\r\n```python\r\nif __name__==\"__main__\":\r\n print(\"foo\") # 1\r\nelse: # 2\r\n pass\r\n```\r\n\r\nAfter No.1, typing else starts right below the `p`. Once `else:` is typed, the editor doesn't de-intent the line and I have to do it manually.\r\n\r\n## Repro Steps\r\n\r\n\u003c!--\r\nIf multiple steps are needed to reproduce the issue, please list the steps here. Delete this section if not needed.\r\n-->\r\n\r\n1. Create a new file and start typing.\r\n\r\n## Expected behavior\r\n\r\nThe `else:` is supposed to be de-indented one level.\r\n\r\n## Actual behavior\r\n\r\n`else:` stays below the previous line (which belongs to the `if` part)\r\n\r\n\r\n\r\n## Logs\r\n\r\n\u003c!--\r\nEnable trace logging by adding \"python.analysis.logLevel\": \"Trace\" to your settings.json configuration file.\r\n\r\nAdding this will cause a large amount of info to be printed to the Python output panel. This should not be left long term, as the performance impact of the logging is significant.\r\n-->\r\n\r\n```\r\nExperiment 'pythonaacf' is active\r\nExperiment 'pythonSurveyNotificationcf' is active\r\nLSP Notebooks experiment is enabled\r\nLSP Notebooks interactive window support is enabled\r\nPython interpreter path: ~/.poetry_envs/foo-cv-BPVTkgqj-py3.11/bin/python\r\n> poetry env list --full-path\r\ncwd: .\r\n> ~/.pyenv/versions/3.10.4/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> ~/.pyenv/versions/3.11.1/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> conda info --json\r\n> ~/.pyenv/versions/3.7.13/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> ~/.pyenv/versions/3.9.13/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> . ~/.poetry_envs/foo-cv-BPVTkgqj-py3.11/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/printEnvVariables.py\r\n> ~/.poetry_envs/username-cv-lqqRfM4F-py3.11/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> ~/.poetry_envs/fast-api-sql-example-hJw5i7sx-py3.11/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> ~/.poetry_envs/foo-cv-BPVTkgqj-py3.11/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> ~/.poetry_envs/kumsitz-lib-iVmOjJvt-py3.10/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> ~/.poetry_envs/pyspark-playground-Dg6oNfQx-py3.10/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> ~/.poetry_envs/stocks-playground-bIdRsd_o-py3.10/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> /opt/homebrew/bin/python3 ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> /opt/homebrew/bin/python3.11 ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n> ~/.local/share/virtualenvs/test-project-GV0hGqPR/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n[ERROR 2022-11-23 8:14:35.526]: [Error: Command failed: /Users/username/.local/share/virtualenvs/test-project-GV0hGqPR/bin/python /Users/username/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py /Users/username/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n/bin/sh: /Users/username/.local/share/virtualenvs/test-project-GV0hGqPR/bin/python: No such file or directory\r\n\r\n\tat ChildProcess.exithandler (node:child_process:408:12)\r\n\tat ChildProcess.emit (node:events:526:28)\r\n\tat maybeClose (node:internal/child_process:1092:16)\r\n\tat Socket.\u003canonymous> (node:internal/child_process:451:11)\r\n\tat Socket.emit (node:events:526:28)\r\n\tat Pipe.\u003canonymous> (node:net:687:12)] {\r\n killed: false,\r\n code: 127,\r\n signal: null,\r\n cmd: '/Users/username/.local/share/virtualenvs/test-project-GV0hGqPR/bin/python /Users/username/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py /Users/username/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py'\r\n}\r\nStarting Pylance language server.\r\nExtension search path: /Users/username/.vscode/extensions\r\n> ~/.poetry_envs/foo-cv-BPVTkgqj-py3.11/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/linter.py -p flake8 /opt/homebrew/bin/flake8 --max-line-length=120 ./foo_cv/__init__.py\r\ncwd: .\r\n##########Linting Output - flake8##########\r\n\r\n\r\n> ~/.local/share/virtualenvs/test-project-GV0hGqPR/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n[ERROR 2022-11-23 8:14:37.540]: [Error: Command failed: /Users/username/.local/share/virtualenvs/test-project-GV0hGqPR/bin/python /Users/username/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py /Users/username/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py\r\n/bin/sh: /Users/username/.local/share/virtualenvs/test-project-GV0hGqPR/bin/python: No such file or directory\r\n\r\n\tat ChildProcess.exithandler (node:child_process:408:12)\r\n\tat ChildProcess.emit (node:events:526:28)\r\n\tat maybeClose (node:internal/child_process:1092:16)\r\n\tat ChildProcess._handle.onexit (node:internal/child_process:302:5)] {\r\n killed: false,\r\n code: 127,\r\n signal: null,\r\n cmd: '/Users/username/.local/share/virtualenvs/test-project-GV0hGqPR/bin/python /Users/username/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/get_output_via_markers.py /Users/username/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/interpreterInfo.py'\r\n}\r\n> /opt/homebrew/bin/black --diff --quiet ./foo_cv/__init__.py.fcaa6f612d7121d453663cbc59080266.tmp\r\ncwd: .\r\nExtension search path: /Users/username/.vscode/extensions\r\n> ~/.poetry_envs/foo-cv-BPVTkgqj-py3.11/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/linter.py -p flake8 /opt/homebrew/bin/flake8 --max-line-length=120 ./foo_cv/__init__.py\r\ncwd: .\r\n##########Linting Output - flake8##########\r\n\r\n\r\n> ~/.poetry_envs/foo-cv-BPVTkgqj-py3.11/bin/python ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests\r\ncwd: .\r\n```\r\n\r\nI don't really know what is `test-project-GV0hGqPR` nor where is it coming from. Maybe that's a hint for the problem.\r\n\u003c/div>","author":{"url":"https://github.com/rchiodo","@type":"Person","name":"rchiodo"},"datePublished":"2023-01-04T19:49:00Z","url":"https://github.com/microsoft/vscode-python/issues/20479"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:900480b6-e530-18b3-b09b-56fe5da5c5b1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 92A0:3952B3:D70883:1231347:6AFE77A5 |
| html-safe-nonce | 6f26c00577a3b717e5fca4dd5909ab3184fdc9625573c86c8876da81f76f1c3e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkEwOjM5NTJCMzpENzA4ODM6MTIzMTM0Nzo2QUZFNzdBNSIsInZpc2l0b3JfaWQiOiI2Mzg0NzM5MjM4MzEwNDc1Njg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5a43831cc5798ad49e0ffc30ab97a931b19799f875fd3ceda74b3db15c9b1dc9 |
| hovercard-subject-tag | repository:106462765 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/microsoft/vscode-python/issues/20479 |
| twitter:image | https://opengraph.githubassets.com/48efad0c38070deea3d6f38a685ebf94a173f4f5abc9710ec891796156a6fda5/microsoft/vscode-python |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/48efad0c38070deea3d6f38a685ebf94a173f4f5abc9710ec891796156a6fda5/microsoft/vscode-python |
| og:image:alt | Python extension for Visual Studio Code. Contribute to microsoft/vscode-python development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-cache |
| go-import | github.com/microsoft/vscode-python git https://github.com/microsoft/vscode-python.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 106462765 |
| octolytics-dimension-repository_nwo | microsoft/vscode-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 49946255 |
| octolytics-dimension-repository_parent_nwo | DonJayamanne/pythonVSCode |
| octolytics-dimension-repository_network_root_id | 49946255 |
| octolytics-dimension-repository_network_root_nwo | DonJayamanne/pythonVSCode |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width