Skip to content

Add canonical class fix-all actions for files and workspaces#1571

Open
TurtIeSocks wants to merge 3 commits into
tailwindlabs:mainfrom
TurtIeSocks:fix-all-code-action
Open

Add canonical class fix-all actions for files and workspaces#1571
TurtIeSocks wants to merge 3 commits into
tailwindlabs:mainfrom
TurtIeSocks:fix-all-code-action

Conversation

@TurtIeSocks
Copy link
Copy Markdown

Summary

Adds bulk-fix support for Tailwind canonical class suggestions in two places:

  1. a standard LSP fix-all code action for the current file
  2. a VS Code command to apply canonical class suggestions across the current workspace folder

What changed

File-level fix all

Before:

  • users only saw one warning fix at a time, like Replace with 'print:flex'

After:

  • users still get the single-instance quick fixes
  • users also get a standard Tailwind fix-all code action for the current file:
    • Fix all Tailwind CSS canonical class suggestions

Workspace-level fix all

Before:

  • there was no built-in way to apply canonical class suggestions across multiple files in the workspace

After:

  • there is a new command:
    • Tailwind CSS: Fix Canonical Class Suggestions in Workspace
  • it scans the current workspace folder and applies canonical class suggestions across all matching files
  • it skips Git-ignored files

Implementation details

  • added source.fixAll.tailwindcss support to the language server code actions
  • kept the existing per-warning quick fixes intact
  • advertised Tailwind fix-all support through server capabilities
  • added a VS Code command that requests per-file Tailwind fix-all actions from the language server and merges them into one workspace edit
  • filtered workspace scans to ignore Git-ignored files

Examples

Before:

<div class="[@media_print]:flex [color:red]/50 mt-[16px]"></div>

After:

<div class="print:flex text-[red]/50 mt-4"></div>

In a single file:

  • the new fix-all action applies all canonical replacements in that document

Across a workspace:

  • the new command applies the same kind of fixes across all non-gitignored files in the current workspace folder

Testing

  • added language-server tests covering the new file-level fix-all action
  • added capability coverage for advertised Tailwind fix-all support
  • rebuilt @tailwindcss/language-service
  • rebuilt @tailwindcss/language-server
  • rebuilt vscode-tailwindcss

Notes

  • the file-level behavior follows the review feedback on the earlier PR by using a standard LSP fix-all action instead of a custom command
  • workspace-wide fixing is implemented as a separate VS Code command because LSP textDocument/codeAction is document-scoped

Supersedes #1508

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4f993a115d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode-tailwindcss/src/extension.ts
@TurtIeSocks TurtIeSocks force-pushed the fix-all-code-action branch from dc93209 to 978ee2f Compare May 10, 2026 09:55
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.

1 participant