Skip to content

matchUtilities breaks intellisense #953

@federicocappellotto97

Description

@federicocappellotto97

What version of VS Code are you using?
1.88.0

What version of Tailwind CSS IntelliSense are you using?

v0.10.5

What version of Tailwind CSS are you using?

^3.4.1

What package manager are you using?

yarn

What operating system are you using?

macOs

Tailwind config

import defaultTheme from 'tailwindcss/defaultTheme'
import { parseColor } from 'tailwindcss/lib/util/color'
import flattenColorPalette from 'tailwindcss/lib/util/flattenColorPalette'
import plugin from 'tailwindcss/plugin'
import { Config } from 'tailwindcss/types/config'

import { easingsCubicBezierCss } from './src/constants/easings'
import { COLORS } from './src/styles/theme/colors'
import { Z_INDEX } from './src/styles/theme/zIndex'
import { generateSpacings, makeTailwindScreens, rem } from './src/styles/utils'

const config = {
    content: [
        './app/**/*.{js,ts,jsx,tsx}',
        './src/pages/**/*.{js,ts,jsx,tsx}',
        './src/components/**/*.{js,ts,jsx,tsx}',
        './src/lib/**/*.{js,ts,jsx,tsx}',
        './src/core/**/*.{js,ts,jsx,tsx}',
        './src/styles/**/*.{js,ts,jsx,tsx}',
    ],
    theme: {
        extend: {
            zIndex: Z_INDEX,
            colors: COLORS,
            fontWeight: {
                retina: '350',
                regular: '400',
            },
            minHeight: {
                screen: 'calc(var(--vh, 1vh) * 100)',
            },
            height: {
                screen: 'calc(var(--vh, 1vh) * 100)',
            },
            transitionTimingFunction: easingsCubicBezierCss,
            borderRadius: {
                4: rem(4),
                5: rem(5),
                15: rem(15),
                16: rem(16),
                24: rem(24),
                32: rem(32),
                40: rem(40),
                80: rem(80),
            },
        },
        screens: makeTailwindScreens(),
        spacing: {
            ...generateSpacings({ vw: false }),
            ...generateSpacings({ vw: true }),
        },
        fontFamily: {
            sans: ['var(--font-hauss)', ...defaultTheme.fontFamily.sans],
        },
        fontSize: {
            'size-160': [rem(160), { lineHeight: '1' }],
            'size-96': [rem(96), { lineHeight: '1.1' }],
            'size-80': [rem(80), { lineHeight: '1.1' }],
            'size-64': [rem(64), { lineHeight: '1.1' }],
            'size-48': [rem(48), { lineHeight: '1.1' }],
            'size-40': [rem(40), { lineHeight: '1.2' }],
            'size-32': [rem(32), { lineHeight: '1.2' }],
            'size-33': [rem(33), { lineHeight: '1.2' }],
            'size-24': [rem(24), { lineHeight: '1.5' }],
            'size-22': [rem(22), { lineHeight: '1.5' }],
            'size-20': [rem(20), { lineHeight: '1.5' }],
            'size-16': [rem(16), { lineHeight: '1.5' }],
            'size-14': [rem(14), { lineHeight: '1.5' }],
            'size-12': [rem(12), { lineHeight: '1.5' }],
            'size-10': [rem(10), { lineHeight: '1.5' }],
        },
        aspectRatio: {
            listing: '294 / 165',
            video: '16 / 9',
            square: '1 / 1',
        },
    },
    plugins: [
        plugin(function ({ addUtilities }) {
            addUtilities({
                '.center': {
                    display: 'flex',
                    alignItems: 'center',
                    justifyContent: 'center',
                },
            })
        }),
        require('tailwindcss-react-aria-components'),
        plugin(({ matchUtilities, theme }) => {
            matchUtilities(
                {
                    'text-stroke': (value) => {
                        const { color } = parseColor(value)

                        return {
                            '-webkit-text-stroke': `1px rgb(${color[0]} ${color[1]} ${color[2]})`,
                        }
                    },
                },
                { values: flattenColorPalette(theme('colors')), type: 'color' }
            )
        }),
        plugin(function ({ addVariant }) {
            addVariant('variant-dark', ['.dark &', '.dark&'])
            addVariant('variant-blue', ['.blue &', '.blue&'])
        }),
    ],
} satisfies Config

export default config

The problem is here

matchUtilities(
                {
                    'text-stroke': (value) => {
                        const { color } = parseColor(value)

                        return {
                            '-webkit-text-stroke': `1px rgb(${color[0]} ${color[1]} ${color[2]})`,
                        }
                    },
                },
                { values: flattenColorPalette(theme('colors')), type: 'color' }
            )

If i remove const { color } = parseColor(value) the extension works again

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions