Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Only insert semicolons inside of CSS #375

Merged

Conversation

RJWadley
Copy link
Contributor

@RJWadley RJWadley commented Aug 16, 2022

Should fix #299 and #351

Uses the patterns from syntaxes/styled-components.json and regex to determine if the cursor is within CSS and enable or disable semicolon insertion accordingly.

  • changes rootDir from src to . in tsconfig to allow importing grammars
  • semicolon insertion doesn't work (i.e. is disabled) on components using attrs or withConfig (that regex seems to work a bit differently and would probably take a bit of extra work to fix)
  • doesn't check nested patterns (for example, javascript nested within styled css may sometimes insert a semicolon)

@RJWadley RJWadley changed the title Only insert colons inside of CSS Only insert semicolons inside of CSS Aug 16, 2022
@RJWadley RJWadley marked this pull request as draft August 16, 2022 22:40
Copy link
Collaborator

@jasonwilliams jasonwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Thanks @RJWadley

src/insertColonCommand.ts Outdated Show resolved Hide resolved
src/patterns.ts Outdated Show resolved Hide resolved
@RJWadley RJWadley marked this pull request as ready for review August 25, 2022 18:10
@anduong96
Copy link

Related to #334?

Any idea when we can merge this?

@jasonwilliams
Copy link
Collaborator

Hey @anduong96 thanks for reminding me I’ll try to take a look at this later on today

@jasonwilliams jasonwilliams merged commit 350dd28 into styled-components:master Sep 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-completion affects non-styled syntax which resulting in semicolon suffix in Object.
3 participants