Skip to content

Show warning when loading a config in v3 fails - #1191

Merged
thecrypticace merged 3 commits into
mainfrom
feat/config-loading-error-fallback
Feb 12, 2025
Merged

Show warning when loading a config in v3 fails#1191
thecrypticace merged 3 commits into
mainfrom
feat/config-loading-error-fallback

Conversation

@thecrypticace

@thecrypticace thecrypticace commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

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

@philipp-spiess philipp-spiess left a comment

Copy link
Copy Markdown
Contributor

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