Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support for source(…) feature in v4 #1083

Merged
merged 43 commits into from
Nov 15, 2024
Merged

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Nov 7, 2024

This PR mades a fair number of changes to improve the developer experience in v4. Most of it is related to @source and source(…) but there are some additional tweaks:

  • Make sure @import "…" source(…) does not issue syntax warnings
  • Make sure @import "…" theme(…) does not issue syntax warnings
  • Make sure @import "…" prefix(…) does not issue syntax warnings
  • Make sure @tailwind utilities source(…) isn't diagnosed as invalid
  • Add suggestions for @theme options
  • Add suggestions for @import "…" theme(…) options
  • Directory auto-completion for source(…)
  • Directory auto-completion for @source "…"
  • Don’t suggest TypeScript declaration files for @config, @plugin, and @source
  • In a new workspace creating/editing a CSS file should check if it's the language server needs to start.
  • Show brace expansion when hovering @source
  • Highlight @import "…" source(…) properly
  • Highlight @import "…" theme(…) properly
  • Highlight @import "…" prefix(…) properly
  • Highlight @tailwind utilities source(…) properly
  • Highlight uses of source(none) explicitly
  • Link paths in valid uses of source("…")
  • Don't link Windows-style paths in @source, @config, and @plugin
  • Warn that @source none is invalid
  • Highlight @source none as invalid (theme-dependent)
  • Warn when source(…) is not passed anything
  • Warn when source(none) is mispelled
  • Warn when a v4 project uses @tailwind base or @tailwind components
  • Warn when non-POSIX paths are passed to @source and source(…)
  • Warn when @tailwind base is used in a v4 project
  • Warn when @tailwind preflight is used in a v4 project
  • Warn when @tailwind components is used in a v4 project
  • Warn when @tailwind screens is used in a v4 project
  • Warn when @tailwind variants is used in a v4 project

I had some stretch goals but I don't think I'll get to them in this PR unless we think they're important enough to hold up the PR:

  • Warn when braces surround a single item in @source globs
  • Warn when unsupported glob syntax is used in @source
  • Warn when a v4 project uses @import "tailwindcss/tailwind"
  • Warn when a v4 project uses @import "tailwindcss/tailwind.css"
  • Highlight glob parts in @source "…" strings
  • Auto-complete source(none) when typing source(…)

Base automatically changed from fix/v4-missed-conflicts to main November 8, 2024 14:06
@thecrypticace
Copy link
Contributor Author

@philipp-spiess @RobinMalfait I still want to do another pass on this for spelling / punctuation / etc… (can still point them out if you see them) but this should otherwise be ready for review.

@@ -609,7 +609,7 @@ export async function activate(context: ExtensionContext) {
return
}

if (!anyFolderNeedsLanguageServer(Workspace.workspaceFolders ?? [])) {
if (!await anyFolderNeedsLanguageServer(Workspace.workspaceFolders ?? [])) {
Copy link
Member

Choose a reason for hiding this comment

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

🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know 🤦‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to rework the typescript configs across the whole project to catch these things, turn on strict mode, etc…

Copy link
Member

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

Awesome work!

@thecrypticace thecrypticace merged commit 20e1448 into main Nov 15, 2024
@thecrypticace thecrypticace deleted the feat/v4-tweaks branch November 15, 2024 19:10
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.

3 participants