Skip to content

fix: Enable Tailwind CSS autocomplete in Angular template files#78

Open
LucasPC-hub wants to merge 1 commit intonathansbradshaw:mainfrom
LucasPC-hub:fix/tailwind-css-support
Open

fix: Enable Tailwind CSS autocomplete in Angular template files#78
LucasPC-hub wants to merge 1 commit intonathansbradshaw:mainfrom
LucasPC-hub:fix/tailwind-css-support

Conversation

@LucasPC-hub
Copy link

Problem

Tailwind CSS autocomplete wasn't working in Angular .component.html files - it only worked in inline templates within .ts files.

Previously, the only workaround was to manually change the file language from "Angular" to "HTML", but this caused the loss of TypeScript variable references from the component, making the Angular IntelliSense much worse.

Solution

This PR makes two changes that together fix the issue:

  1. Change language_id mapping in extension.toml:

    • Changed "Angular" = "angular" to "Angular" = "html"
  2. Remove scope_opt_in_language_servers line from languages/angular/config.toml

    • Removed: scope_opt_in_language_servers = ["tailwindcss-language-server"]

Both changes are needed - the language_id mapping alone doesn't solve it, and removing the scope_opt_in line alone doesn't solve it either. Together, they enable Tailwind autocomplete while keeping the file detected as "Angular" language, preserving all Angular IntelliSense features.

Configuration Required

Users need to add this to their Zed settings.json:
```json
{
"languages": {
"Angular": {
"language_servers": ["angular", "tailwindcss-language-server", "..."]
}
}
}
```

Result

Now Tailwind CSS autocomplete works in .component.html files while keeping them as "Angular" language type, maintaining full Angular IntelliSense with TypeScript variable references.

Related to zed-industries/zed#39507

This commit fixes the issue where Tailwind CSS autocomplete was not working
in Angular component HTML files, only in inline templates.

Changes:
- Map Angular language_id to "html" instead of "angular" for LSP compatibility
- Remove invalid scope_opt_in_language_servers configuration
- Update README with Tailwind CSS configuration instructions

The Tailwind CSS Language Server only recognizes "html" and "typescript"
language IDs. By mapping Angular to "html", we enable Tailwind autocomplete
in .component.html files while maintaining all Angular Language Server features.

Fixes: Tailwind CSS IntelliSense in Angular template files
Related: zed-industries/zed#39507
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants