tailwindlabs / tailwindcss-intellisense

Intelligent Tailwind CSS tooling for Visual Studio Code
2.74k stars 183 forks source link

Intellisense does not activate when the directory is included in a workspace but not the first directory. #921

Closed Andrew-Forster closed 2 months ago

Andrew-Forster commented 3 months ago

Describe your issue

When using this file path for my VS workspace, I run into an issue where the extension does not recognize the config file.

"folders": [
    {
        "path": "src"
    },
    {
        "path": "../../../Components"
    },
    {
        "path": "."
    }

When trying to use . at the top path it works however my live server plugin then breaks, I've been fiddling with both extensions to no avail. Is there a better way to setup my directory so they both work or is there any setting options to make the extension to check under all the files?

ben-laird commented 3 months ago

I've been having a similar issue. Tailwind Intellisense isn't kicking in for me in a SvelteKit workspace, but it does when I open it as a single directory. I even tried moving the root folder entry to the top of the folders array, and that doesn't work either.

.code-workspace file:

{
    "folders": [
        {
            "name": "Main",
            "path": "."
        },
        {
            "name": "Source Code",
            "path": "src"
        }

    ]
}

package.json:

{
    "name": "tutorial",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "dev": "vite dev",
        "build": "vite build",
        "preview": "vite preview",
        "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
        "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
        "test": "vitest",
        "lint": "prettier --check . && eslint .",
        "format": "prettier --write ."
    },
    "devDependencies": {
        "@sveltejs/adapter-auto": "^3.0.0",
        "@sveltejs/kit": "^2.0.0",
        "@sveltejs/vite-plugin-svelte": "^3.0.0",
        "@types/eslint": "^8.56.0",
        "@typescript-eslint/eslint-plugin": "^7.0.0",
        "@typescript-eslint/parser": "^7.0.0",
        "autoprefixer": "^10.4.18",
        "eslint": "^8.56.0",
        "eslint-config-prettier": "^9.1.0",
        "eslint-plugin-svelte": "^2.35.1",
        "postcss": "^8.4.35",
        "prettier": "^3.1.1",
        "prettier-plugin-svelte": "^3.1.2",
        "svelte": "^4.2.7",
        "svelte-check": "^3.6.0",
        "tailwindcss": "^3.4.1",
        "tslib": "^2.4.1",
        "typescript": "^5.0.0",
        "vite": "^5.0.3",
        "vitest": "^1.2.0"
    },
    "type": "module"
}
thecrypticace commented 3 months ago

@Andrew-Forster @ben-laird Can either of you provide a git repo I can clone where it doesn't work?

The current pre-release version looks like it's working for me. Though this might only be incidentally due to fs path stuff. I know we don't handle the workspaceFolders initialization param right now but I'm a little surprised it appears that we're not needing to.

Screenshot 2024-03-26 at 15 56 17
ben-laird commented 3 months ago

The repo I was working on is here, although the .code-workspace file was removed in a previous commit because it got in the way of our workflow. Please be sure to clone the dev branch and not the main one.