Is it possible to use emmet's lorem in javascript's strings?
Asked Answered
K

2

5

I'd like emmet to help me with this:

const str = 'lorem5|TAB'; --> const str = 'Lorem ipsum dolor sit amet.';

| cursor position

TAB hitting tab

Is it possible in VSCode? It works for me only with jsx and html.

Kokanee answered 14/11, 2019 at 15:14 Comment(0)
I
7

You can but there are probably better ways to do this (such as dedicated extensions)


To use emmet, just enable emmet in *.js files by setting:

"emmet.includeLanguages": {
    "javascript": "javascriptreact"
}

Now the lorem abbreivation will work:

The lorem abbreivation

And if you have "emmet.triggerExpansionOnTab": true set, then you can hit tab to expand the text.

However Emmet completions will not show up for the case you showed: the string "lorem5". The reason is that emmet sees the closing " immediately after the abbreviation so it decides not to return any completions. Instead, you have to use the Emmet: Expand Abbreviation command (which is bound to tab by default) to force emmet to expand lorem5:

enter image description here

enter image description here

Idolatrous answered 14/11, 2019 at 18:9 Comment(0)
P
0

In new VsCode Verison you need to following step:

Go to vs code setting enter image description here

then find emmet in search setting

then add javascript in Item and javascriptreact in Value

Here are some screenshots that will help you

enter image description here

Preceptor answered 19/7, 2023 at 8:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.