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

Emmet: Support for CSS modules in jsx/tsx (bump @emmetio/abbreviations to >2.4.0) #180689

Closed
stefan-enveritas opened this issue Apr 24, 2023 · 7 comments · Fixed by #185607
Closed
Assignees
Labels
emmet Emmet related issues feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@stefan-enveritas
Copy link

A new emmet release supports abbreviations, such that dev.foo resolves to <div className={styles.foo} instead of <div className="foo">.

The change was released with Emmet v2.4.0 — See also: emmetio/emmet#589

It would be great if vscode could support this new feature as well.

@rzhao271 rzhao271 added feature-request Request for new features or functionality emmet Emmet related issues labels Apr 24, 2023
@rzhao271 rzhao271 added this to the May 2023 milestone Apr 24, 2023
@rzhao271
Copy link
Contributor

We are on Emmet 2.4.x now.

@rzhao271 rzhao271 added verification-needed Verification of issue is requested author-verification-requested Issues potentially verifiable by issue author and removed author-verification-requested Issues potentially verifiable by issue author labels May 25, 2023
@roblourens
Copy link
Member

How do you configure this?

@roblourens roblourens added the verification-steps-needed Steps to verify are needed for verification label May 30, 2023
@rzhao271
Copy link
Contributor

rzhao271 commented May 31, 2023

We can test the new default behaviour for now.

  1. Open a JSX file.
  2. Type div..test or just ..test and expand the abbreviation.
  3. Confirm that <div styleName={styles.test}></div> shows up. This behaviour aligns with Support for css modules in jsx/tsx emmetio/emmet#589 (comment)

@andreamah andreamah added the verified Verification succeeded label May 31, 2023
@danmiles
Copy link

danmiles commented Jun 13, 2023

I would appreciate help on how to change
styleName to className?

When I write ..test it gives

<div styleName={styles.test}></div>

@rzhao271
Copy link
Contributor

Hi @danmiles, thanks for asking!
I tried adding some steps, but then noticed that @vscode/emmet-helper didn't actually support the new properties. I'll re-open this issue due to lack of proper support of the upstream feature.

@rzhao271 rzhao271 reopened this Jun 19, 2023
@rzhao271 rzhao271 modified the milestones: May 2023, June 2023 Jun 19, 2023
@rzhao271 rzhao271 removed author-verification-requested Issues potentially verifiable by issue author verified Verification succeeded verification-steps-needed Steps to verify are needed for verification labels Jun 19, 2023
@rzhao271
Copy link
Contributor

Moving this issue to the next month. There seems to be an issue with the way emmet merges some configs that I'll either have to work around or fix upstream.

@rzhao271 rzhao271 modified the milestones: June 2023, July 2023 Jun 20, 2023
@rzhao271 rzhao271 removed the verification-needed Verification of issue is requested label Jun 20, 2023
@VSCodeTriageBot VSCodeTriageBot added the unreleased Patch has not yet been released in VS Code Insiders label Jun 23, 2023
@rzhao271 rzhao271 modified the milestones: July 2023, June 2023 Jun 23, 2023
@rzhao271 rzhao271 added the verification-needed Verification of issue is requested label Jun 23, 2023
@rzhao271
Copy link
Contributor

The fix has not been released yet. It should be available on Insiders starting on Monday.

  1. Configure the emmet.syntaxProfiles setting as follows
"emmet.syntaxProfiles": {
	"jsx": {
		"markup.attributes": {
			"class*": "className",
		},
		"markup.valuePrefix": {
			"class*": "styles"
		}
	}
}
  1. In a JSX file, expand the abbreviations .test and ..test.
  2. .test should expand to <div className="test"></div> and ..test should expand to <div className={styles.test}></div>.

CC @danmiles

@VSCodeTriageBot VSCodeTriageBot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jun 26, 2023
@andreamah andreamah added the verified Verification succeeded label Jun 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
emmet Emmet related issues feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants