-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Auto dedent else
in an if
..else
block not working if user is not in experiment
#20479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@drorata what are your user settings? They should have these: "[python]": {
"editor.formatOnType": true
},
"python.languageServer": "Pylance", |
I have just added in a workspace the settings suggested by @rchiodo and restarted VScode. Then I recorded the following: Screen.Recording.2023-01-05.at.08.42.55.movSo, it doesn't seem to do the trick... |
I wonder if something else is taking over formatting. What other extensions do you have installed? |
Is there a way to exctarct a full list of installed extensions? |
From the command line:
It'd probably be better to just disable everything, then reenable python and pylance and see if it works. Because I'm not going to be able to tell that something else has a format on type provider just by looking at the list. |
I tried to disable all extensions and then enable "Python" + "Pylence". Note that a few other extensions were enabled as well by doing so (e.g. Jupyter related). In any case, this didn't solve the problem. The installed extensions are:
|
@rchido curious, is this behind an experiment or available to all users? |
We discussed this yesterday in standup and it might be affected by an experiment. It isn't listed here: But @luabud thought it might be enabled with just a flag somewhere else. I don't see it in any of our package.jsons though. @drorata can you try setting this flag and see if it has any effect? "python.experiments.optInto": [
"All"
] That should turn on whatever experiment may be making this not work. At least if I do the opposite, it stops working for me: "python.experiments.optOutFrom": [
"All"
] |
Thanks @luabud, it looks like this code here is the culprit:
This only works if the user is in the experiment too. Switching this to the python repository, That code should be checking if it gets the default value or if the user supplied it and only using the experiment value if the user didn't supply it. |
@drorata That means my workaround should fix your issue: "python.experiments.optInto": [
"All"
] |
else
in an if
..else
blockelse
in an if
..else
block not working if user is not in experiment
I added "python.experiments.optInto": [
"All"
] to my users FWIW, I still can see the strange virtual environment as discussed in microsoft/vscode-jupyter#12501. |
This should be fixed on our pre-release version, so it should work without the "python.experiments.optInto" setting as well! |
For #20479 Another fix for recovery release. Co-authored-by: Luciana Abud <[email protected]>
Discussed in https://github.com/microsoft/pylance-release/discussions/3804
Originally posted by drorata December 22, 2022
Following the request from #481 by @brettcannon
Environment data
Code Snippet
After No.1, typing else starts right below the
p
. Onceelse:
is typed, the editor doesn't de-intent the line and I have to do it manually.Repro Steps
Expected behavior
The
else:
is supposed to be de-indented one level.Actual behavior
else:
stays below the previous line (which belongs to theif
part)Logs
I don't really know what is
test-project-GV0hGqPR
nor where is it coming from. Maybe that's a hint for the problem.The text was updated successfully, but these errors were encountered: