Skip to content

folding multiline decorators #6

@pmav99

Description

@pmav99

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
image

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:

image

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions