Skip to content

Intellisense doesn't work if file path to repo has square brackets #691

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

Closed
ebiggz opened this issue Jan 5, 2023 · 2 comments · Fixed by #694
Closed

Intellisense doesn't work if file path to repo has square brackets #691

ebiggz opened this issue Jan 5, 2023 · 2 comments · Fixed by #694
Assignees

Comments

@ebiggz
Copy link

ebiggz commented Jan 5, 2023

What version of Tailwind CSS IntelliSense are you using?

v0.9.3

What version of Tailwind CSS are you using?

v3.2.4

What package manager are you using?

yarn

What operating system are you using?

Repro'd on both macOS & Windows

Tailwind config

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

module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],
  darkMode: false,
  theme: {
    extend: {
      colors: {
        gray: colors.gray,
        cyan: colors.cyan,
        "light-blue": colors.sky
      },
      fontFamily: {
        sans: ['Inter var', ...defaultTheme.fontFamily.sans],
      },
      width: {
        '108': '27rem',
        '120': '30rem',
        '128': '32rem',
      }
    },
  },
  variants: {
    extend: {
      textDecoration: ['focus-visible'],
    }
  },
  plugins: [
    require('@tailwindcss/forms'),
  ],
}

VS Code settings

{
  "[vue]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint"
  },
  "[javascript]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint"
  },
  "git.confirmSync": false,
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "files.associations": {
    "*.css": "tailwindcss"
  },
  "editor.quickSuggestions": {
    "strings": true
  },
  "editor.defaultFormatter": "dbaeumer.vscode-eslint",
  "editor.formatOnSave": true,
  "eslint.alwaysShowStatus": true,
  "eslint.format.enable": true,
  "redhat.telemetry.enabled": true,
  "atlascode.bitbucket.enabled": false,
  "jest.autoRun": "off",
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "githubPullRequests.fileListLayout": "tree",
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "diffEditor.ignoreTrimWhitespace": false,
  "[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "Lua.telemetry.enable": true,
  "Lua.runtime.nonstandardSymbol": ["`"],
  "cSpell.enableFiletypes": ["lua"],
  "vetur.format.defaultFormatter.js": "prettier-eslint",
  "liveshare.presence": true,
  "typescript.updateImportsOnFileMove.enabled": "always",
  "javascript.inlayHints.parameterNames.enabled": "literals",
  "typescript.inlayHints.parameterNames.enabled": "literals",
  "Lua.hint.enable": true,
  "editor.inlayHints.enabled": "onUnlessPressed",
  "git.mergeEditor": true,
  "window.commandCenter": true,
  "workbench.colorTheme": "GitHub Dark",
  "editor.inlayHints.padding": true,
  "githubPullRequests.pullBranch": "never",
  "editor.formatOnSaveMode": "modificationsIfAvailable",
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "javascript.updateImportsOnFileMove.enabled": "always",
  "editor.stickyScroll.enabled": true,
  "diffEditor.renderSideBySide": false,
  "[lua]": {
    "editor.defaultFormatter": "sumneko.lua"
  },
  "git.ignoreRebaseWarning": true
}

Describe your issue
Got a bit of a unique one for ya. I recently dusted off a repo that I hadn't touched for a few months to find that tailwind intellisense was no longer working when it previously was. After a bunch of troubleshooting, I think I've narrowed down the issue. In short, since extension version 0.9.0 onward, if the file path to the repo has a folder with opening and closing square brackets in the name, the extension never initializes.

Steps to repo:

  1. Take an existing known-good repo with tailwind (or setup a fresh one) and rename its direct parent dir by wrapping the name with square brackets (IE foo -> [foo]). file path should now look something like c:\path\to\[foo]\repoWithTailwind
  2. Open repo in VS Code with intellisense extension v0.9.3 installed
  3. Note that tailwind intellisense doesn't work and Output for the extension ends with "Adding watch patterns" (never gets to "Initializing...")
  4. Close VS Code and rename parent folder to remove square brackets ([foo] -> foo)
  5. Open repo in VS Code again and note tailwind intellisense is back to working as expected
  6. Bonus: Add brackets back to parent folder and downgrade extension to v0.8.7. Note tailwind intellisense works as expected even with square brackets in file path

I didn't include a repro repo because the specific repo/tailwind configuration appears to be irrelevant, just the square brackets in the file path leading to it. But let me know if you would like one, more than happy to set something up!

I realize having folder names with square brackets is unorthodox. For most, the fix would probably be to just rename the offending folder. However for my specific case, I cannot as I am working on UIs for FiveM scripts (Grand Theft Auto 5 modification framework) and unfortunately it requires this strange naming scheme.

I haven't had the chance to take a look at the diff between 0.8.7 and 0.9.0 to see what might be the culprit but I'm guessing it may have something to do with glob handling since square brackets are special characters.

@bradlc
Copy link
Contributor

bradlc commented Jan 5, 2023

Thanks for reporting, this should be fixed in v0.9.4 🤙

@ebiggz
Copy link
Author

ebiggz commented Jan 5, 2023

Can confirm! Thank you for the speedy turn around 🙏🏻

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 a pull request may close this issue.

2 participants