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

Classes duplicate in auto-complete as you save when using Tailwind JIT #316

Closed
negcx opened this issue May 9, 2021 · 10 comments
Closed

Comments

@negcx
Copy link

negcx commented May 9, 2021

I expect this is related to using JIT. It seems each time you save, JIT generates a new stylesheet perhaps, and it is then pulled into the VS Code extension. After developing for an hour or so, VS Code starts grinding to a halt when you want to type a class name as it seems to have a massive list.

image

@bradlc
Copy link
Contributor

bradlc commented May 9, 2021

Hey @negcx. Are you able to share a project repository that reproduces this? Also, which operating system, VS Code version, extension version, and package manager are you using? Thanks!

@fredericseiler
Copy link

fredericseiler commented May 10, 2021

Hi,

I can confirm this bug with JIT + file watcher.

  • macOS Big Sur 11.3.1
  • VS Code 1.56.0
  • Tailwind CSS IntelliSense 0.6.3
  • npm 7.11.1
  • Tailwind CSS 2.1.1

tailwind.config.js

const defaultTheme = require('tailwindcss/defaultTheme');

module.exports = {
    mode: 'jit',

    purge: [
        './resources/views/**/*.blade.php',
    ],

    theme: {
        extend: {
            fontFamily: {
                sans: ['Inter', ...defaultTheme.fontFamily.sans],
            },
        },
    },

    plugins: [
        require('@tailwindcss/forms'),
        require('@tailwindcss/typography')
    ],
};

image

@bradlc
Copy link
Contributor

bradlc commented May 10, 2021

Is your project public @fredericseiler?

Also when this is happening (duplicated completions) are you also seeing duplicated hover previews, diagnostics and/or color decorators?

@fredericseiler
Copy link

Some screenshots with a class conflict:

Hover preview
image

Quick action
image

Problems (this one is fine)
image

(not quite sure what you mean by "diagnostics and/or color decorators")

Unfortunately, the project I'm working on is private.

I can quickly setup a public repo (with the Laravel framework) if you want, but the main things are:

package.json

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "TAILWIND_MODE=build mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "@tailwindcss/forms": "^0.3.1",
        "@tailwindcss/typography": "^0.4.0",
        "alpinejs": "^2.7.3",
        "laravel-mix": "^6.0.6",
        "postcss": "^8.1.14",
        "tailwindcss": "^2.0.1"
    }
}

webpack.mix.js

const mix = require('laravel-mix');

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css', [
        require('tailwindcss'),
    ])
    .version();

and the tailwind.config.js mentioned earlier:

const defaultTheme = require('tailwindcss/defaultTheme');

module.exports = {
    mode: 'jit',

    purge: [
        './resources/views/**/*.blade.php',
    ],

    theme: {
        extend: {
            fontFamily: {
                sans: ['Inter', ...defaultTheme.fontFamily.sans],
            },
        },
    },

    plugins: [
        require('@tailwindcss/forms'),
        require('@tailwindcss/typography')
    ],
};

@fredericseiler
Copy link

So, I just restarted VSCode, and the bug seems to have vanished, even after several css rebuilds under watcher... 🤷‍♂️

@bradlc
Copy link
Contributor

bradlc commented May 17, 2021

I have just pushed out a potential fix for this in v0.6.4 🤞 I have not been able to reproduce the issue at all yet though. Please update the extension and let me know if the problem persists. If anybody is still seeing this a repository which reproduces the issue would be much appreciated, thanks!

@fredericseiler
Copy link

I tried everything to reproduce it, in vain. I suspect it happened while I was toggling JIT mode on/off with Laravel Mix file-watcher running, but then again, can't confirm it.

@sergio101
Copy link

hi, @bradlc .. I just installed v0.6.4 and everything seems to be working fine now. Thanks!

@bradlc
Copy link
Contributor

bradlc commented May 28, 2021

Anyone still seeing this since v0.6.4? 👀

@bradlc
Copy link
Contributor

bradlc commented Aug 13, 2021

I'm going to assume this is resolved then 🤞 If not please open a new issue, thanks!

@bradlc bradlc closed this as completed Aug 13, 2021
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

No branches or pull requests

4 participants