You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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")defview_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)
ifnotcollection_records:
raiseHTTPException(status_code=404, detail=f"No collection_records have been created")
returnpaginate(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:
Interesting, I seem to get the behaviour where the decorators are not folded at all, which honestly has the other effect where sometimes the decorator is too many lines and I would like that folded as a seperate entity as you show in the last block.
I remember looking into it but it's hard because I think tree sitter see's it as something different from the function, i.e. it's a seperate block of code so tying them together is difficult.
I don't really have time for the next while to look into it but you can use treesitter-playground to see how the structure looks and all the folding syntax is contained here. I think the python treesitter parser is not actively maintained so I don't see it being solved on their end anytime soon either.
The folding is not working really well when you are using multiline decorators. For example, using some
fastapi
code: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:
The text was updated successfully, but these errors were encountered: