Skip to content

Show warning when loading a config in v3 fails #1191

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

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Feb 11, 2025

Closes #1124

When IntelliSense loads a config file in v3, if that loading fails, it won't work at all even if your project is an otherwise valid project. There's also no indication to the user that this is the cause of IntelliSense not working.

This PR does two things:

  • Uses the default config if loading the user's config does not work so you're likely to get IntelliSense for at least some utilities.
  • Detects an issue when loading the config file and surfaces a warning to the user

Now, when given this config file:

import plugin from "i-do-not-exist";

/** @type {import('tailwindcss').Config} */
export default {
  content: ["index.html", "./src/**/*.{js,ts,jsx,tsx}"],
  theme: {
    extend: {
      colors: {
        primary: "orange",
      },
    },
  },
  plugins: [plugin],
};

You'll see a warning like this:

Screenshot 2025-02-11 at 15 24 03

And IntelliSense will work for any default values (note how text-primary doesn't show a color swatch):
Screenshot 2025-02-11 at 15 28 12

@thecrypticace thecrypticace marked this pull request as ready for review February 11, 2025 20:28
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.

Nice!

@thecrypticace thecrypticace merged commit c2660e4 into main Feb 12, 2025
@thecrypticace thecrypticace deleted the feat/config-loading-error-fallback branch February 12, 2025 12:16
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.

Plugin installed from JSR using Deno causes intellisense to fail
2 participants