Skip to content
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

Ctrl + M + O Shortcut Not Working as Expected in Python #7897

Open
vsfeedback opened this issue May 8, 2024 · 6 comments
Open

Ctrl + M + O Shortcut Not Working as Expected in Python #7897

vsfeedback opened this issue May 8, 2024 · 6 comments
Assignees

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work] [regression]
Pressing Ctrl + M + O in the Python editor, instead of collapsing functions and methods, expands everything, including methods that were manually collapsed. In other words, the key combination functions, but incorrectly. It may not recognize what def means.

Additional Information:

  • Pressing Ctrl + M + O in the C# editor works perfectly - it collapses all functions and methods.
  • Pressing Ctrl + M + L works perfectly in both C# and Python.
  • Edit.CollapsetoDefinitions: Ctrl + M, Ctrl + O (Global)

Original Comments

Feedback Bot on 5/2/2024, 06:23 PM:

(private comment, text removed)

Vitaliy on 5/7/2024, 06:55 AM:

(private comment, text removed)


Original Solutions

(no solutions)

@StellaHuang95
Copy link
Contributor

Looks like the bug is that the shortcut is mapped to the wrong command.

@Viamo
Copy link

Viamo commented May 8, 2024

Now it is Edit.CollapsetoDefinitions: Ctrl + M, Ctrl + O (Global).
What command should the shortcut be mapped to?

@Viamo
Copy link

Viamo commented Jun 10, 2024

Hello! Any news?

@Viamo
Copy link

Viamo commented Jun 20, 2024

This menu item not working too!

2024-06-20_161708

@ErwinKomen
Copy link

ErwinKomen commented Jul 9, 2024

Oleg Tkachenko [MSFT] posted at the developer community (in 10082430 ) that the bug had been fixed in VS2022 version 10.7. I tried out version 10.7.2, but found that 'Collapse to definitions' (shortcut + menu entry) still does exactly the opposite. Instead of collapsing, it folds out everything.

This should be a tiny little thing to solve, I hope.
Thanks in advance!

@debonte
Copy link
Contributor

debonte commented Jul 11, 2024

This isn't a bug, it's a feature request. Currently Pylance's folding implementation only supports the range kinds defined by the LSP spec -- comment, imports, and region. The "Collapse To Defintions" feature relies on a VS-specific implementation range kind, as you can see in the PR where Roslyn added their support. Here's a direct link to the range kind declaration in Roslyn --https://github.com/dotnet/roslyn/blob/main/src/LanguageServer/Protocol/Protocol/Internal/VSFoldingRangeKind.cs

For internal folks, here is the PR where VS added the implementation range kind in their LSP library -- https://devdiv.visualstudio.com/DevDiv/_git/VSLanguageServerClient/pullrequest/505507

@debonte debonte added enhancement and removed bug labels Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants