pylance-release
pylance-release copied to clipboard
Folding functions with multiline returns leaves closing bracket
Environment data
- Language Server version: v2022.4.3
- OS and version: Windows_NT x64 6.1.7601
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.10
Expected behavior
Function where the return statements span multiple lines should fold into a single line.
def test():
return (
"asd"
.upper()
)
# should fold into
# def test()
Actual behavior
Function where the return statements span multiple lines will leave the closing bracket unfolded when folding. e.g.
def test():
return (
"asd"
.upper()
)
# folds into
# def test(
# )
Code Snippet / Additional information
Note that this way of formatting multiline returns (is that even the correct name for this code?) is the default of black for long chained function calls. If this function is part of a class, folding the class will also leave this bracket remaining. Might be related (or even the same problem) as https://github.com/microsoft/pylance-release/issues/2333