-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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 with JS files (JSX) is not working. #4962
Comments
this is the recommended way to do it, we do not want to enable emmet by default in JS.
this should not be the case, since the same language service/parser is used for .js and .jsx files. Can you add a snippet that illustrates the problem. |
@admmasters ping? |
Is there an option to enable emmet in JS files? The jsconfig.json doesn't seem to have an option. It's annoying to change every time the language mode to |
Put bellow line into your user settings, most probably that will work. |
|
Confirmed - great work, thank you! @egamma sorry it took so long for me to reply - I never received my notifications for this! |
Confirmed as well! - @sillero's suggestion worked for me. Visual Studio Code - v1.8.1 |
Thanks overwriting the setting page helped me thanks. |
Hey guys, this doesn´t work for tsx files. I tried with typescript, typescriptreact and javascript. "emmet.syntaxProfiles": {
"javascript": "jsx",
"typescript": "jsx",
"typescriptreact": "jsx"
} |
@johnpeele Did you set any other options to get this working properly? Typing However, typing |
for HTML code in tsx file (Inside render's return) I can't get single quote attributes by setting
this doesn't work. But If i put below in settings it works
is it expected behavior? |
@vernondegoede Here are my Emmet settings:
Here is a screencap of me using tab expansion in a I am also using the Sublime Babel grammar for my JSX files. |
@johnpeele Thank you so much! This works like a charm. |
@danfma have you managed to get emmet expansion working in tsx? |
@egamma this doesn't seem to be working with tsx. |
How can I add more ? |
Strictly speaking it is a separate issue, but I've reopened this one. |
@yogeshlonkar This issue was tracked in #16354 where you can read more about it. The fix is in the latest VS Code 1.9. Please give that a try.
@vernondegoede The HTMLDivElement is coming from autocomplete. Currently when you hit TAB, and there are suggestions in the completion items, then the selected suggestion gets expanded, emmet doesn't even get a chance to come in and play. #1952 is tracking this kind of problem. Please up vote and chime in there. As a workaround, you can press ESC to escape the suggestion and then press TAB so that emmet expansion can take place, or assign a different keybinding for emmet.
@cAstraea At the moment you cannot map more than a single language mode. Can you open a separate issue and elaborate your use case? @admmasters Emmet expansions are working fine in .tsx files. For it to work in .ts files you need to either map "typescript" to "jsx" in emmet.syntaxProfiles or change language mode to tyspescriptreact |
The feature "updateTag" is not working when language mode is JavaScript React, only HTML.. And it is so useful for adding a class, etc, in an already existing component. |
@caiolopes I can repro that. Pardon me, I am new to emmet. Is this is regression? Was it ever working before? |
@ramya-rao-a Here is a screencast.. I don't know if it was ever working before.. But actually it is working if the language mode is HTML. |
@EQuimper Did you try Tab for emmet is now available in the VS Code Insiders build. You can try it from https://code.visualstudio.com/insiders |
I just did and install insiders and remove the quicksuggestions and don't work.
|
@EQuimper Set You don't have to set |
Good work with that thank you :) |
Like is commented on this update https://code.visualstudio.com/blogs/2017/08/07/emmet-2.0
So, if you want to mantain the old behavior (for example, for autocompleting JSX components), you have to go to There you go :) After @ramya-rao-a comment realized that this is not ok, just dismiss this comment |
@goncy Mapping to tab that way in VS Code 1.15 has problems of its own as there is no fallback to the real tab (indenting) when there is no valid emmet abbreviation to expand. For example, with that setting you will never be able to just tab expecting an indent. You will end up getting warning message that says something like "Running emmet failed.. ". Here are your options
We really wanted to move away from using tab for emmet due to the problems it brings for non emmet users. But there has been feedback requesting the tab->emmet feature back, and so it is now available in the latest Insiders |
This works for me. {
"key": "tab",
"command": "editor.emmet.action.expandAbbreviation",
"when": "suggestWidgetVisible"
} |
@tuoxiansp how to setting this ? |
@tuoxiansp I wouldn't suggest to do that. You will not be able to select anything from the suggestion list using tab if you do that I believe |
@ramya-rao-a |
@ramya-rao-a the new version 1.15.1 fix it , that's great😁 |
This did the trick: "emmet.includeLanguages": { VSCode: 1.15.0 |
@rmichnik you need update new version 1.15.1 , this bug fixed |
thanks @rmichnik. Confirmed working on macOSX and VSCode 1.15.1 |
I have the config "emmet.triggerExpansionOnTab": true and I replaced the tab key in keybindings with ctrl+e (like in ST3) so I can keep my tab key to tab :) |
It's only me or the first component I can tab and get the autocomplete, but the second one who is inside this the other one never work. Before all was perfect but now ... Video about it https://drive.google.com/open?id=0B-wdzKw8lrR8MXFYSnN0RXJydjA |
@EQuimper That looks wrong but I can't repro. Can you log a new issue with repro steps? |
VScode Version 1.16 "emmet.includeLanguages": { |
@EQuimper same problem. vscode 1.15.1 |
@beholderrk Can you upgrade to 1.16 and see if you still have the issue? |
No i'm on the insiders version @ramya-rao-a v17
|
@EQuimper I copied all your settings and I still can't repro. |
@ramya-rao-a So have test with the disable extensions options and all work. Which kind of extensions can interfering with emmet ? :) |
Ok now work after disable this extensions https://marketplace.visualstudio.com/items?itemName=joshpeng.sublime-babel-vscode |
@ramya-rao-a @EQuimper wow thanks! The problem was precisely in this extention. |
@EQuimper @beholderrk Add the below in your settings and Emmet should work as expected inside the nested tag when using the babel extension
|
@ramya-rao-a thank you :) |
Steps to Reproduce:
div>
within the editor in a JS file (JSX)<div></div>
as expected.Note:
This does work if explicitly using a jsx file with "Javascript React" as a language, but then you are missing features like jump to symbol etc that you get with "Javascript".
The text was updated successfully, but these errors were encountered: