re-ovo / unocss-intellij

Unocss support on Intellij Idea/WebStorm
https://plugins.jetbrains.com/plugin/22204-unocss
MIT License
173 stars 12 forks source link

自定义背景颜色、字体颜色、边框颜色没有代码提示 #81

Closed songpeng154 closed 2 months ago

songpeng154 commented 2 months ago

背景颜色、字体颜色、边框颜色都没有代码提示,只有colors有代码提示 image

image

// uno.config.ts
import { defineConfig, presetUno, transformerDirectives } from 'unocss'
import { Theme } from '@unocss/preset-uno'

export default defineConfig<Theme>({
    content: {
        pipeline: {
            exclude: [ 'node_modules', 'dist' ],
        }
    },
    transformers: [
        transformerDirectives()
    ],
    presets: [
        presetUno(),
    ],
    theme: {
        colors: {
            'primary': 'red',
        },
        textColor: {
            'main': 'red',
        },
        backgroundColor: {
            'main': '#445cdc',
        },
        borderColor: {
            'main': 'red',
        },
    },
})
songpeng154 commented 2 months ago

webstorm 版本2024.2.0.1 vite 5.4.1

re-ovo commented 2 months ago

输入flex有提示吗

songpeng154 commented 2 months ago

image 有了

songpeng154 commented 2 months ago

咋关了?

re-ovo commented 2 months ago

这不是好了吗?有什么问题

songpeng154 commented 2 months ago

image 我uno.config.ts中自定义的字体颜色、背景颜色、边框没有代码提示

re-ovo commented 2 months ago

你这配置就是错的吧,看看官方的文档 https://unocss.dev/config/theme

songpeng154 commented 2 months ago

就算改成extendTheme的方式,也不行啊,官方也没说只能自定义colors

// uno.config.ts
import { defineConfig, presetUno, transformerDirectives } from 'unocss'
import { Theme } from '@unocss/preset-uno'

export default defineConfig<Theme>({
    content: {
        pipeline: {
            exclude: [ 'node_modules', 'dist' ],
        }
    },
    transformers: [
        transformerDirectives()
    ],
    presets: [
        presetUno(),
    ],
    extendTheme: (theme)=>{
        return {
            ...theme,
            colors: {
                ...theme.colors,
                'primary': 'red',
            },
            textColor: {
                ...theme.textColor,
                'main': 'red',
            },
            backgroundColor: {
                ...theme.backgroundColor,
                'main': '#445cdc',
            },
            borderColor: {
                ...theme.borderColor,
                'main': 'red',
            },
        }
    },
})

image

songpeng154 commented 2 months ago

这是手动输入的bg-main,没有代码提示,有颜色提示 image

songpeng154 commented 2 months ago

你可以自己试试

re-ovo commented 2 months ago

我也不清楚,上游unocss服务没返回