Skip to content

typescript: Fix type import highlighting when alias is not present#47190

Merged
KyleBarton merged 1 commit intozed-industries:mainfrom
purepear:fix/typescript-type-import-highlights
Jan 29, 2026
Merged

typescript: Fix type import highlighting when alias is not present#47190
KyleBarton merged 1 commit intozed-industries:mainfrom
purepear:fix/typescript-type-import-highlights

Conversation

@purepear
Copy link
Contributor

@purepear purepear commented Jan 20, 2026

Problem

The existing tree-sitter queries for type imports required both name and alias fields to match. This caused import type { Foo } and import { type Foo } to fall back to the generic identifier/variable highlighting instead of being colored as types.

  • import type { Foo }NOT matched (no alias)
  • import { type Foo }NOT matched (no alias)
  • import type { Foo as Bar } → Matched ✓
  • import { type Foo as Bar } → Matched ✓

Solution

Split the patterns to handle name and alias captures independently.

## Disclaimer
DEBUGGING AND IMPLEMENTATION WAS DONE WITH AI ASSISTANCE.
THE FIX HAS NOT BEEN TESTED - I HAVE NOT COMPILED FROM SOURCE

Release Notes:

  • Fixed typescript type import highlighting

… not present

The existing tree-sitter queries for type imports required both name and
alias fields to match. This caused `import type { Foo }` and
`import { type Foo }` to fall back to the generic identifier/variable
highlighting instead of being colored as types.

Split the patterns to handle name and alias captures independently.
@cla-bot
Copy link

cla-bot bot commented Jan 20, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @purepear on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jan 20, 2026
@purepear
Copy link
Contributor Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Jan 20, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @purepear on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Jan 20, 2026

The cla-bot has been summoned, and re-checked this pull request!

@purepear
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 20, 2026
@cla-bot
Copy link

cla-bot bot commented Jan 20, 2026

The cla-bot has been summoned, and re-checked this pull request!

@MrSubidubi MrSubidubi changed the title fix(languages/typescript): fix type import highlighting when alias is not present typescript: Fix type import highlighting when alias is not present Jan 20, 2026
@KyleBarton
Copy link
Collaborator

@purepear thanks, looks good!

@KyleBarton KyleBarton merged commit 04d878e into zed-industries:main Jan 29, 2026
37 checks passed
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 first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants