Skip to content
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

TailwindCSS IntelliSense shows suggestions for any string after using the experimental classRegex #1086

Open
onyedikachi23 opened this issue Nov 10, 2024 · 0 comments

Comments

@onyedikachi23
Copy link

What version of VS Code are you using?

Version: 1.95.2
OS: Linux x64 6.8.0-48-generic

What version of Tailwind CSS IntelliSense are you using?

v0.12.12

What version of Tailwind CSS are you using?

[email protected]
│ └── [email protected] deduped
└── [email protected]

What package manager are you using?

npm

What operating system are you using?

Ubuntu 24.04 LTS

Tailwind config

{
	"tailwindCSS.includeLanguages": {
		"plaintext": "html",
		"html": "html",
		"javascript": "javascript",
		"javascriptreact": "javascriptreact",
		"typescript": "typescript",
		"typescriptreact": "typescriptreact",
		"css": "css"
	},
	"tailwindCSS.classAttributes": [
		"class",
		"className",
		"ngClass",
		".*Styles.*"
	],
	"tailwindCSS.experimental.classRegex": [
		["Styles\\s*\\=\\s*([^;]*);", "'([^']*)'"],
		["Styles\\s*\\=\\s*([^;]*);", "\"([^\"]*)\""],
		["Styles\\s*\\=\\s*([^;]*);", "\\`([^\\`]*)\\`"]
	],
}

VS Code settings

{
	"workbench.tree.renderIndentGuides": "always",
	"workbench.tree.indent": 4,
	"editor.fontSize": 16,
	"security.workspace.trust.untrustedFiles": "open",
	"editor.wordWrap": "on",
	"explorer.confirmDragAndDrop": true,
	"editor.formatOnPaste": true,
	"editor.formatOnType": true,
	"editor.minimap.enabled": true,
	"prettier.endOfLine": "auto",
	"prettier.bracketSameLine": true,
	"editor.defaultFormatter": "esbenp.prettier-vscode",
	"[typescript]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
	"[typescriptreact]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
	"prettier.useTabs": true,
	"highlight-matching-tag.styles": {
		"opening": {
			"left": {
				"custom": {
					"borderWidth": "0 0 0 3px",
					"borderStyle": "solid",
					"borderColor": "yellow",
					"borderRadius": "5px",
					"overviewRulerColor": "white"
				}
			},
			"right": {
				"custom": {
					"borderWidth": "0 3px 0 0",
					"borderStyle": "solid",
					"borderColor": "yellow",
					"borderRadius": "5px",
					"overviewRulerColor": "white"
				}
			}
		}
	},
	"prettier.enableDebugLogs": true,
	"prettier.htmlWhitespaceSensitivity": "strict",
	"prettier.insertPragma": true,
	"prettier.tabWidth": 4,
	"prettier.vueIndentScriptAndStyle": true,
	"html.format.enable": true,
	"html.format.indentHandlebars": true,
	"html.format.indentInnerHtml": true,

	"explorer.confirmDelete": false,
	"editor.quickSuggestionsDelay": 0,
	"tailwindCSS.emmetCompletions": true,
	"[markdown]": {
		"editor.quickSuggestions": {
			"other": true,
			"comments": true,
			"strings": true
		},
		"editor.wordBasedSuggestions": "matchingDocuments",
		"editor.snippetSuggestions": "top",
		"editor.acceptSuggestionOnEnter": "on",
		"editor.acceptSuggestionOnCommitCharacter": true,
		"editor.parameterHints.enabled": true,
		"editor.quickSuggestionsDelay": 10,
		"editor.suggestSelection": "first"
	},
	"editor.suggestSelection": "first",
	"editor.parameterHints.enabled": true,
	"editor.acceptSuggestionOnCommitCharacter": true,
	"editor.snippetSuggestions": "top",
	"editor.quickSuggestions": {
		"other": true,
		"comments": true,
		"strings": true
	},
	"editor.acceptSuggestionOnEnter": "on",
	"tailwindCSS.includeLanguages": {
		"plaintext": "html",
		"html": "html",
		"javascript": "javascript",
		"javascriptreact": "javascriptreact",
		"typescript": "typescript",
		"typescriptreact": "typescriptreact",
		"css": "css"
	},
	"tailwindCSS.classAttributes": [
		"class",
		"className",
		"ngClass",
		".*Styles.*"
	],
	"tailwindCSS.experimental.classRegex": [
		["Styles\\s*\\=\\s*([^;]*);", "'([^']*)'"],
		["Styles\\s*\\=\\s*([^;]*);", "\"([^\"]*)\""],
		["Styles\\s*\\=\\s*([^;]*);", "\\`([^\\`]*)\\`"]
	],
	"emmet.showAbbreviationSuggestions": true,
	"emmet.includeLanguages": {
		"javascript": "javascriptreact"
	},
	"emmet.triggerExpansionOnTab": true,
	"emmet.useInlineCompletions": true,
	"emmet.showExpandedAbbreviation": "always",
	"dictCompletion.leastNumOfChars": 0,
	"dictCompletion.useExternalUserDictFile": true,
	"dictCompletion.programmingLanguage": true,
	"files.autoSave": "onFocusChange",
	"git.confirmSync": false,
	"git.enableSmartCommit": true,
	"tabnine.experimentalAutoImports": true,
	"eslint.format.enable": true,
	"eslint.codeActionsOnSave.mode": "all",
	"redhat.telemetry.enabled": true,
	"editor.autoClosingBrackets": "always",
	"liveServer.settings.donotVerifyTags": true,
	"editor.formatOnSave": true,
	"editor.codeActionsOnSave": {
		"source.fixAll": "explicit",
		"source.organizeImports": "explicit"
	},
	"workbench.preferredHighContrastColorTheme": "Default Dark Modern",
	"liveServer.settings.CustomBrowser": "firefox",
	"terminal.integrated.env.linux": {},
	"console-ninja.featureSet": "Community",
	"workbench.externalBrowser": "firefox",
	"workbench.tree.stickyScrollMaxItemCount": 10,
	"explorer.compactFolders": false,
	"javascript.updateImportsOnFileMove.enabled": "always",
	"javascript.experimental.updateImportsOnPaste": true,
	"typescript.experimental.updateImportsOnPaste": true,
	"typescript.updateImportsOnFileMove.enabled": "always",
	"markdown.updateLinksOnFileMove.enabled": "always",

	// to enable folding of long nested contents in code
	"editor.folding": true,
	"editor.foldingStrategy": "indentation",
	"editor.foldingImportsByDefault": true,
	"editor.foldLevel": 1,
	"prettier.prettierPath": "/home/onyedikachi23/.npm-global/lib/node_modules/prettier",
	"reactSnippets.settings.prettierEnabled": true,
	"markdown-preview-github-styles.colorTheme": "dark",
	"window.zoomLevel": -0.9,
	"gitlens.gitCommands.skipConfirmations": [
		"fetch:command",
		"stash-push:command",
		"switch:command"
	]
}

Reproduction URL

Can't provide at the moment, but I'm working on a Vite + React + TypeScript project with TailwindCSS for styling. See below for more info 👇

Describe your issue

I was trying to make the IntelliSense show suggestions for variable names outside the className prop. So, I got a solution from this answer on StackOverflow: How can I enable tailwind intelliSense outside of "className"?.

However, typing any string specifiers (double and single quotes and template literals) - "", '', ` ` , starts poping tailwind class names. This is a headache because it blocks suggestions I actually need to see at the moment, and it could slow down suggestions popup on larger codebase.

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

No branches or pull requests

1 participant