Skip to content

python: Add label_for_symbol for ty adapter#51355

Merged
MrSubidubi merged 2 commits intozed-industries:mainfrom
lingyaochu:ty_extend
Mar 12, 2026
Merged

python: Add label_for_symbol for ty adapter#51355
MrSubidubi merged 2 commits intozed-industries:mainfrom
lingyaochu:ty_extend

Conversation

@lingyaochu
Copy link
Copy Markdown
Contributor

Ported label_for_symbol logic directly from the basedpyright adapter without adjustments.

Given Python's dynamic nature, the current implementation provides sufficient coverage. No further modifications are needed for now.

Before you mark this PR as ready for review, make sure that you have:

  • Added a solid test coverage and/or screenshots from doing manual testing
  • Done a self-review taking into account security and performance aspects
  • Aligned any UI changes with the UI checklist

Release Notes:

  • Fixed missing syntax highlighting in symbol search when using the ty language server.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 12, 2026
@github-actions github-actions bot added the community champion Issues filed by our amazing community champions! 🫶 label Mar 12, 2026
Copy link
Copy Markdown
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

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

Thank you!

Ported label_for_symbol logic directly from the basedpyright adapter without adjustments.

That sounds somewhat reasonable, but can we not move this into a common function then that we call for both of the adapters? Otherwise we have to keep the code in sync and that does not sound too nice

@lingyaochu
Copy link
Copy Markdown
Contributor Author

Agreed. I've noticed a few other functions besides label_for_symbol that are duplicated across adapters. I'll take this chance to refactor them into a shared location to keep the code clean.

@MrSubidubi
Copy link
Copy Markdown
Member

That sounds awesome, thank you!

@lingyaochu
Copy link
Copy Markdown
Contributor Author

I've extracted label_for_symbol, which is common to all four adapters, and label_for_completion for the two pyright-based adapters.

While I noticed some other functions with slight variations, refactoring them would require more careful manual testing to verify the details. I'll leave those for now to keep this PR focused and safe.

@lingyaochu lingyaochu requested a review from MrSubidubi March 12, 2026 11:59
Copy link
Copy Markdown
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

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

Nice find, nice cleanup and very nice PR. Thank you for submitting this and the quick follow-up!

@MrSubidubi MrSubidubi merged commit e0881e3 into zed-industries:main Mar 12, 2026
28 checks passed
@lingyaochu lingyaochu deleted the ty_extend branch March 12, 2026 12:28
tommyming pushed a commit to tommyming/zed that referenced this pull request Mar 13, 2026
Ported `label_for_symbol` logic directly from the basedpyright adapter
without adjustments.

Given Python's dynamic nature, the current implementation provides
sufficient coverage. No further modifications are needed for now.

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed missing syntax highlighting in symbol search when using the ty
language server.
@zelenenka zelenenka added the guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion Issues filed by our amazing community champions! 🫶 guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants