Skip to content

Intellisense doesn't always work when configured with regex to apply to strings #832

Closed
@dorshinar

Description

@dorshinar

What version of VS Code are you using?

For example: 1.80.2 (Universal)

What version of Tailwind CSS IntelliSense are you using?

For example: v0.9.11

What version of Tailwind CSS are you using?

For example: 3.3.2

What package manager are you using?

For example: yarn 1.22.19

What operating system are you using?

For example: macOS 13.4.1

Tailwind config

const { resolve } = require('path');
const { workspaceRoot } = require('@nrwl/workspace/src/utils/app-root');

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [resolve(workspaceRoot, 'apps/**/*.{jsx,tsx,js,ts}'), resolve(workspaceRoot, 'libs/**/*.{jsx,tsx,js,ts}')],
  plugins: [
    require('@tailwindcss/typography'),
    require('@tailwindcss/forms'),
    require('tailwind-scrollbar-hide'),
    require('tailwindcss-animate'),
  ],
};

VS Code settings

{
  "[prisma]": {
    "editor.defaultFormatter": "Prisma.prisma"
  },
  "[svg]": {
    "editor.defaultFormatter": "jock.svg"
  },
  "breadcrumbs.showArrays": false,
  "breadcrumbs.showBooleans": false,
  "breadcrumbs.showClasses": false,
  "breadcrumbs.showConstants": false,
  "breadcrumbs.showConstructors": false,
  "breadcrumbs.showEnumMembers": false,
  "breadcrumbs.showEnums": false,
  "breadcrumbs.showEvents": false,
  "breadcrumbs.showFields": false,
  "breadcrumbs.showFunctions": false,
  "breadcrumbs.showInterfaces": false,
  "breadcrumbs.showKeys": false,
  "breadcrumbs.showMethods": false,
  "breadcrumbs.showModules": false,
  "breadcrumbs.showNamespaces": false,
  "breadcrumbs.showNull": false,
  "breadcrumbs.showNumbers": false,
  "breadcrumbs.showObjects": false,
  "breadcrumbs.showOperators": false,
  "breadcrumbs.showPackages": false,
  "breadcrumbs.showProperties": false,
  "breadcrumbs.showStrings": false,
  "breadcrumbs.showStructs": false,
  "breadcrumbs.showTypeParameters": false,
  "breadcrumbs.showVariables": false,
  "debug.javascript.debugByLinkOptions": "always",
  "debug.onTaskErrors": "debugAnyway",
  "diffEditor.ignoreTrimWhitespace": false,
  "editor.accessibilitySupport": "off",
  "editor.bracketPairColorization.enabled": true,
  "editor.cursorBlinking": "smooth",
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.fontFamily": "JetBrains Mono",
  "editor.fontLigatures": "true",
  "editor.fontSize": 13,
  "editor.formatOnSave": true,
  "editor.gotoLocation.multipleDeclarations": "goto",
  "editor.gotoLocation.multipleDefinitions": "goto",
  "editor.gotoLocation.multipleImplementations": "goto",
  "editor.gotoLocation.multipleReferences": "goto",
  "editor.gotoLocation.multipleTypeDefinitions": "goto",
  "editor.linkedEditing": true,
  "editor.minimap.enabled": false,
  "editor.multiCursorModifier": "ctrlCmd",
  "editor.suggestSelection": "first",
  "editor.tabCompletion": "onlySnippets",
  "emmet.showExpandedAbbreviation": "never",
  "eslint.options": {
    "extensions": [".js", ".jsx", ".md", ".mdx", ".ts", ".tsx"]
  },
  "explorer.autoReveal": false,
  "explorer.compactFolders": false,
  "explorer.confirmDelete": false,
  "explorer.confirmDragAndDrop": false,
  "explorer.sortOrder": "type",
  "extensions.ignoreRecommendations": false,
  "git.autofetch": true,
  "git.confirmSync": false,
  "git.enableSmartCommit": true,
  "git.mergeEditor": true,
  "githubPullRequests.fileListLayout": "tree",
  "githubPullRequests.pullBranch": "never",
  "gitlens.codeLens.enabled": false,
  "gitlens.hovers.currentLine.over": "line",
  "javascript.updateImportsOnFileMove.enabled": "always",
  "references.preferredLocation": "view",
  "svg.preview.mode": "svg",
  "terminal.integrated.env.osx": {
    "FIG_NEW_SESSION": "1"
  },
  "testing.automaticallyOpenPeekView": "never",
  "turboConsoleLog.includeFileNameAndLineNum": false,
  "turboConsoleLog.insertEnclosingClass": false,
  "turboConsoleLog.insertEnclosingFunction": false,
  "turboConsoleLog.quote": "'",
  "typescript.updateImportsOnFileMove.enabled": "always",
  "vsicons.dontShowNewVersionMessage": true,
  "workbench.iconTheme": "vscode-icons",
  "editor.foldingImportsByDefault": true,
  "playwright.reuseBrowser": true,
  "[rust]": {
    "editor.defaultFormatter": "rust-lang.rust-analyzer"
  },
  "eslint.useESLintClass": true,
  "[toml]": {
    "editor.defaultFormatter": "tamasfe.even-better-toml"
  },
  "[python]": {
    "editor.formatOnType": true,
    "editor.defaultFormatter": "ms-python.python"
  },
  "python.formatting.provider": "black",
  "files.exclude": {
    "**/*.lock": true,
    "**/package-lock.json": true
  },
  "tabnine.experimentalAutoImports": true,
  "yaml.schemas": {
    "file:///Users/dorshinar/.vscode/extensions/atlassian.atlascode-3.0.3/resources/schemas/pipelines-schema.json": "bitbucket-pipelines.yml"
  },
  "playwright.showTrace": false,
  "tailwindCSS.experimental.classRegex": [["[\"'`]([^\"'`]*).*?[\"'`]"]],
  "editor.quickSuggestions": {
    "strings": "on"
  }
}

Reproduction URL

A public GitHub repo that includes a minimal reproduction of the bug. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private/confidential, since we want a link to a separate, isolated reproduction anyways.

https://github.com/dorshinar/tailwind-intellisense-bug

Describe your issue

The tailwind intellisense is a little finicky when configured with a regex that matches all strings. The regex I'm using is [["[\"']([^\"'`]*).*?[\"'`]"]]`, and it sometimes works and sometimes doesn't. The video attached shows it more clearly:

Screen.Recording.2023-08-02.at.12.04.35.mov

Sometimes I can "nudge" the intellisense to work for some of the strings, for others it works every time, and for some never at all. I'm using the strings inside the buttonVariants variables in the page.tsx file.

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