The folding is not working really well when you are using multiline decorators. For example, using some fastapi code:
@router.get(
"/all",
response_model=Page[models.CollectionRecordView],
summary="Retrieve a List of all CollectionRecords"
)
def view_collection_record_all(
db_session: Session = Depends(get_db),
params: Params = Depends(),
search: Optional[str] = None,
sort: Optional[list[str]] = Query(None, regex=SORT_STRING_REGEX),
):
collection_records = service.get_all(db_session=db_session, search=search, sort_string=sort)
if not collection_records:
raise HTTPException(status_code=404, detail=f"No collection_records have been created")
return paginate(collection_records, params)
Results in

If we force the decorator arguments to be on a single line we get this instead which is obviously much better but the linters are complaining:

So, for the multiline case, I am not sure if it is possible to achieve the following but, I think that something like this would be ideal:
@router.get( ... ) (3)
def view_collection_record_all( ... ) (8)
The folding is not working really well when you are using multiline decorators. For example, using some
fastapicode:Results in

If we force the decorator arguments to be on a single line we get this instead which is obviously much better but the linters are complaining:
So, for the multiline case, I am not sure if it is possible to achieve the following but, I think that something like this would be ideal: