Skip to content

[ty] Exclude decorators from class/def code folding#23543

Merged
BurntSushi merged 6 commits intoastral-sh:mainfrom
iksuddle:improve-decorator-folding
Mar 3, 2026
Merged

[ty] Exclude decorators from class/def code folding#23543
BurntSushi merged 6 commits intoastral-sh:mainfrom
iksuddle:improve-decorator-folding

Conversation

@iksuddle
Copy link
Copy Markdown
Contributor

@iksuddle iksuddle commented Feb 24, 2026

Summary

This change removes decorators from the folding ranges of classes/functions.

Resolves astral-sh/ty#2861

Test Plan

Added snapshot tests to check the returned folding ranges.

@ntBre ntBre added server Related to the LSP server ty Multi-file analysis & type inference labels Feb 24, 2026
@iksuddle iksuddle marked this pull request as ready for review February 26, 2026 06:10
@sharkdp sharkdp removed their request for review February 26, 2026 07:52
@AlexWaygood AlexWaygood removed their request for review February 26, 2026 09:40
Comment thread crates/ty_ide/src/folding_range.rs
Comment thread crates/ty_ide/src/folding_range.rs Outdated
@carljm carljm removed their request for review February 26, 2026 17:52
Comment thread crates/ty_ide/src/folding_range.rs
Comment thread crates/ty_ide/src/folding_range.rs Outdated
@dhruvmanila dhruvmanila requested a review from BurntSushi March 2, 2026 09:33
@dhruvmanila
Copy link
Copy Markdown
Member

This looks good, thank you! I'm going to let @BurntSushi take a final look and give the 👍

Copy link
Copy Markdown
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@BurntSushi BurntSushi merged commit 72742e7 into astral-sh:main Mar 3, 2026
47 checks passed
@BurntSushi BurntSushi changed the title [ty] Improve folding for decorators [ty] Exclude decorators from class/def code folding Mar 3, 2026
carljm added a commit that referenced this pull request Mar 16, 2026
* main:
  [ty] Split up `types/class.rs` (#23714)
  [ty] Rework module resolution to be breadth-first instead of depth-first (#22449)
  [ty] Move tests and type-alias-related code out of `types.rs` (#23711)
  [ty] Move TypeVar-related code to a `types::typevar` submodule (#23710)
  Fail CI on new linter ecosystem panics (#23597)
  [ty] Fix handling of non-Python text documents
  [ty] Move `CallableType`, and related methods/types, to a new `types::callable` submodule (#23707)
  [ty] Avoid stack overflow with recursive typevar (#23652)
  [ty] Add a diagnostic for an unused awaitable (#23650)
  [ty] Fix union `*args` binding for optional positional parameters (#23124)
  [`refurb`] Fix `FURB101` and `FURB103` false positives when I/O variable is used later (#23542)
  [ty] Fix type checking for multi-member enums within in a function block (#23683)
  [ty] Improve folding for decorators (#23543)
  [`airflow`] Extract common utilities for use in new rules (#23630)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Related to the LSP server ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve code folding for decorators

4 participants