Backtick autoformating

Is it possible to reach an effect that being between backticks on enter it would create a new line without 4 spaces at the beginning? This rule should only work for "backtickts" area.

1
3 comments

Please can you provide a full code sample? I don't have an indent created when hitting Enter within backticks in the following code:

const test = ``

resultant formatting is

const test = `
`
0
Avatar
Permanently deleted user

This syntax is heavily used with the styled components library. Backticks indicate the beginning of a CSS block, which means it is far more pleasant to treat backticks as if they were braces in terms of formatting.

before:

const MyStyledDiv = styled('div')``;

after new line:

const MyStyledDiv = styled('div')`
[indent]
`

fully composed styled component:

const MyStyledDiv = styled('div')`
  position: relative;
  margin: 10px 20px;
   padding: 10px;
   background-color: #000000;
`;


Edit: I'm under the impression the original poster meant to say "with", not "without".

0

Please sign in to leave a comment.