Visual studio code не работает плагин emmet

Содержание
  1. Emmet not working #958
  2. Comments
  3. Lahori-Jawan commented Dec 3, 2015
  4. egamma commented Dec 3, 2015
  5. SamVerschueren commented Dec 3, 2015
  6. egamma commented Dec 3, 2015
  7. Lahori-Jawan commented Dec 4, 2015
  8. SamVerschueren commented Dec 4, 2015
  9. egamma commented Dec 4, 2015
  10. Lahori-Jawan commented Dec 4, 2015
  11. Sapunov commented Oct 6, 2016
  12. mrmlnc commented Oct 6, 2016 •
  13. skyweb331 commented Jun 18, 2017
  14. jens1o commented Jun 18, 2017
  15. ramya-rao-a commented Jun 19, 2017
  16. skyweb331 commented Jun 19, 2017
  17. ramya-rao-a commented Jun 19, 2017
  18. Boasbabs commented Jul 9, 2017 •
  19. ramya-rao-a commented Jul 10, 2017
  20. cjwd commented Jul 19, 2017
  21. ramya-rao-a commented Jul 19, 2017
  22. cjwd commented Jul 20, 2017
  23. ramya-rao-a commented Jul 20, 2017 •
  24. cjwd commented Jul 21, 2017
  25. alePanta commented Aug 4, 2017
  26. ramya-rao-a commented Aug 10, 2017
  27. iscorporacion commented Aug 25, 2017
  28. eduard-ungureanu commented Oct 3, 2017
  29. ramya-rao-a commented Oct 3, 2017
  30. DenisValcke commented Oct 12, 2017 •
  31. Visual Studio Code Emmet not working
  32. 15 Answers 15
  33. Emmet in Visual Studio Code
  34. How to expand Emmet abbreviations and snippets
  35. Using Tab for Emmet expansions
  36. Emmet when quickSuggestions are disabled
  37. Disable Emmet in suggestions
  38. Emmet suggestion ordering
  39. Emmet abbreviations in other file types
  40. Emmet with multi-cursors
  41. Using filters
  42. BEM filter (bem)
  43. Comment filter (c)
  44. Trim filter (t)
  45. Using custom Emmet snippets
  46. HTML Emmet snippets
  47. CSS Emmet snippets
  48. Tab stops and cursors in custom snippets
  49. Emmet configuration
Читайте также:  Как настроить джойстик для ил 2 штурмовик

Emmet not working #958

Comments

Lahori-Jawan commented Dec 3, 2015

I just updated visual studio code and as a result I see that emmet is not working now. in previous releases, emmet did work fine but since last 2 updates, emmet seems to be disabled or excluded altogehter from visual studio code. I searched for emmet extension on VS CODE repository but found nothing. my current version in 0.10.3. emmet also did not work in last release but before that all was good. I want emmet badly back!

The text was updated successfully, but these errors were encountered:

egamma commented Dec 3, 2015

  1. open an html file
  2. ul>li*5
    and I get an emmet expansion.

Pls try out these steps in a VS Code setup without any extensions installed.

SamVerschueren commented Dec 3, 2015

Cannot reproduce either, works fine on Mac OS X (El Capitan).

egamma commented Dec 3, 2015

closing pls reopen with with reproducable steps.

Lahori-Jawan commented Dec 4, 2015

well, removing the extensions did the trick but now I wonder if i update next time, then again I would have to remove all the extensions and then re-install them one-by-one which is very time consuming, right! BTW thanks for help!

SamVerschueren commented Dec 4, 2015

That’s abnormal behaviour. Maybe something broke during the update process.

egamma commented Dec 4, 2015

Or the extension has some side effects. What extension did you have installed when the problem occured?

Lahori-Jawan commented Dec 4, 2015

just themes. flatland, monokai, batman

Sapunov commented Oct 6, 2016

I can reproduce this behavior. Emmet doesn’t work when html file doesn’t save on a hard drive.

mrmlnc commented Oct 6, 2016 •

I cannot reproduce this problem in VS Code 1.5.3 on Windows 10. Please, provide GIF or a small code example where occurs described problem. Also, please, give me more detailed information:

  1. VS Code version
  2. List of installed extensions

skyweb331 commented Jun 18, 2017

it is only working in html extension files.
I tried it in *.php file but not working. I just changed file extension and now working fine

jens1o commented Jun 18, 2017

I tried it in *.php file but not working. I just changed file extension and now working fine

This will be fixed in next release, since @ramya-rao-a is working on it. 🙂 There is another issue where this gets explained.

ramya-rao-a commented Jun 19, 2017

@skyweb331 If you are not on Insiders, try mapping php to html using the emmet.syntaxProfiles setting

skyweb331 commented Jun 19, 2017

I did it but still not working.

ramya-rao-a commented Jun 19, 2017

@skyweb331 What is your VS Code version? Please provide a sample code or gif where you see this issue

Boasbabs commented Jul 9, 2017 •

Hi there, I am still having issues using emmet on VScode. Tab doesn’t expand shortcuts. From what i read so far, i have to remove all my extensions plugin. But that does not sound logical to me. VSCode is robust. I want to use VScode but if issues like this aren’t solved, i will stick with my old editor.

  • current version: Version 1.13.0

ramya-rao-a commented Jul 10, 2017

I want to use VScode but if issues like this aren’t solved, i will stick with my old editor.

We can only solve issues that we can understand. So please help us in that by answering the below questions.

  • Is emmet working as expected when you run the command Emmet: Expand Abbreviation ?
  • Just before you press tab, is there any auto-complete/suggestion list open?
  • In which kind of file is emmet not working for you? Eg: html, php, jsx, css, scss ?
  • You don’t need to remove all your extensions. Can you point to the place where you read that?

cjwd commented Jul 19, 2017

I’m having the same issue, emmet is not expanding with tab in php files.
To answer your above.

  • Yes it works if I use the command palette
  • There is no auto complete/ suggestion list open
  • PHP

Version 1.14.1 (1.14.1)

I have tried the
<
«emmet.syntaxProfiles»: <
«php»: «html»
>
>

ramya-rao-a commented Jul 19, 2017

@cjwd Do you have emmet.useNewEmmet set to true ?

cjwd commented Jul 20, 2017

ramya-rao-a commented Jul 20, 2017 •

  • tab is not longer the default keybinding for emmet. Use the command Emmet: Expand Abbreviation or bind a new keybinding to the command editor.emmet.action.expandAbbreviation
  • Another thing you can try is to set emmet.showExpandedAbbreviation to «always». This will show emmet expansions in the suggestion list

cjwd commented Jul 21, 2017

Thank you @ramya-rao-a I went with the second option setting emmet.showExpandedAbbreviation to «always»

alePanta commented Aug 4, 2017

I could use Emmet on CSS files setting «emmet.useNewEmmet»: true
Thanks.

ramya-rao-a commented Aug 10, 2017

In VS Code 1.15, there will be changes to how use Emmet in VS Code. Mainly

  • Emmet abbreviations will no longer expand on pressing tab, instead they will appear in the suggestion/auto-completion list. On selecting them from the suggestion list, the abbreviation will get expanded
  • Emmet: Expand Abbreviation command will continue to work and you bind any keyboard shortcut (other than tab ) to it ( editor.emmet.action.expandAbbreviation )
  • emmet.syntaxProfiles should now be used only for customizing the final output and not for mapping new file types to existing emmet supported modes. For that, use the new setting emmet.includeLanguages

iscorporacion commented Aug 25, 2017

no se si aun sirva de algo, peo emmet se a actualizado si mal no estoy date una vuelta por https://docs.emmet.io/cheat-sheet/ yo tambien pense que no estaba funcionando, cuando intentaba escribir html5 y esperar el cuerpo base pero fue cambiado a «!» signo de admiracion

eduard-ungureanu commented Oct 3, 2017

Hi, while this works as expected in a .html file:

It doesn’t work in a .php file if I want to add HTML code outside the tags:

I’m using the latest version Version 1.16.1 (1.16.1) and those are my settings:

So I guess I’m going back to Sublime Text, since those are working as it should in SB maybe you guys will consider fixing this in the future.

ramya-rao-a commented Oct 3, 2017

@eduard-ungureanu #32423 tracks the issue of emmet abbreviations with class operator ( . ) not triggering emmet suggestions unless php.suggest.basic is disabled.

Here are a few workarounds until we can solve the original issue

  • Disable php.suggest.basic if you dont use it much. OR
  • When you expect the emmet suggestions to show and they dont, do one of the below. Both will cancel the current completion list and trigger new one OR
    — press ESCAPE and then Ctrl+Space or continue typing the abbreviation if you are not done doing so.
    — delete last char and continue typing.

Note this occurs only when the only operator in the emmet abbreviation is the class operator.
Use others like + or > or # and emmet suggestions will appear as expected.

DenisValcke commented Oct 12, 2017 •

I had the same problem and then I noticed the following in my default settings:

Setting, that to true solved it for me.

Sidenote: Also important to know, I had to add a couple of things to enable emmet in Vue or Nunjucks projects:

Источник

Visual Studio Code Emmet not working

I am using VisualStudioCode 1.20.1 Version. Emmet is inbuilt according to VSC website.But when i am trying on VSC IDE and using anchor tag and referring to class dropdown-toggle the class is not auto suggested or recognized by vsc.

15 Answers 15

In your vscode user setting, add

That way you can use emmmet in your js files.

in vs code user setting add these

This following worked for me:

Open Command Palette ( Ctrl + Shift + P )

Open Settings (JSON)

I’d like to add to the others posting about emmet.includeLanguages , you can also add «vue»: «html» , so like:

Emmet does not work on js file by default. To solve that problem you have to enable emmet abbreviation in the vscode’s settings. First, open settings.json from any directory:

To be more specific, on windows, you need to go to File > Preferences > Settings > Type in «Launch» > click on «Edit in settings.json»

Now you have to declare in settings.json that you will use emmet at js files: (Its very simple just copy and paste into code setting file the code highligted)

Now just save it. Not necessary restart vscode.

For more details see that post at vscode official webite.

Источник

Emmet in Visual Studio Code

Support for Emmet snippets and expansion is built right into Visual Studio Code, no extension required. Emmet 2.0 has support for the majority of the Emmet Actions including expanding Emmet abbreviations and snippets.

How to expand Emmet abbreviations and snippets

Emmet abbreviation and snippet expansions are enabled by default in html , haml , pug , slim , jsx , xml , xsl , css , scss , sass , less and stylus files, as well as any language that inherits from any of the above like handlebars and php .

When you start typing an Emmet abbreviation, you will see the abbreviation displayed in the suggestion list. If you have the suggestion documentation fly-out open, you will see a preview of the expansion as you type. If you are in a stylesheet file, the expanded abbreviation shows up in the suggestion list sorted among the other CSS suggestions.

Using Tab for Emmet expansions

If you want to use the Tab key for expanding the Emmet abbreviations, add the following setting:

This setting allows using the Tab key for indentation when text is not an Emmet abbreviation.

Emmet when quickSuggestions are disabled

If you have disabled the editor.quickSuggestions setting, you won’t see suggestions as you type. You can still trigger suggestions manually by pressing ⌃Space (Windows, Linux Ctrl+Space ) and see the preview.

Disable Emmet in suggestions

If you don’t want to see Emmet abbreviations in suggestions at all, then use the following setting:

You can still use the command Emmet: Expand Abbreviation to expand your abbreviations. You can also bind any keyboard shortcut to the command id editor.emmet.action.expandAbbreviation as well.

Emmet suggestion ordering

To ensure Emmet suggestions are always on top in the suggestion list, add the following settings:

Emmet abbreviations in other file types

To enable the Emmet abbreviation expansion in file types where it is not available by default, use the emmet.includeLanguages setting. Make sure to use language identifiers for both sides of the mapping, with the right side being the language identifier of an Emmet supported language (see the list above).

Emmet has no knowledge of these new languages, and so there might be Emmet suggestions showing up in non HTML/CSS contexts. To avoid this, you can use the following setting.

Note: If you used emmet.syntaxProfiles previously to map new file types, from VS Code 1.15 onwards you should use the setting emmet.includeLanguages instead. emmet.syntaxProfiles is meant for customizing the final output only.

Emmet with multi-cursors

You can use most of the Emmet actions with multi-cursors as well:

Using filters

Filters are special post-processors that modify the expanded abbreviation before it is output to the editor. There are 2 ways to use filters; either globally through the emmet.syntaxProfiles setting or directly in the current abbreviation.

Below is an example of the first approach using the emmet.syntaxProfiles setting to apply the bem filter for all the abbreviations in HTML files:

To provide a filter for just the current abbreviation, append the filter to your abbreviation. For example, div#page|c will apply the comment filter to the div#page abbreviation.

BEM filter (bem)

If you use the Block Element Modifier (BEM) way of writing HTML, then bem filters are very handy for you to use. To learn more about how to use bem filters, read BEM filter in Emmet.

You can customize this filter by using the bem.elementSeparator and bem.modifierSeparator preferences as documented in Emmet Preferences.

Comment filter (c)

This filter adds comments around important tags. By default, «important tags» are those tags with id and/or class attribute.

For example div>div#page>p.title+p|c will be expanded to:

You can customize this filter by using the filter.commentTrigger , filter.commentAfter and filter.commentBefore preferences as documented in Emmet Preferences.

The format for the filter.commentAfter preference is different in VS Code Emmet 2.0.

For example, instead of:

in VS Code, you would use a simpler:

Trim filter (t)

This filter is applicable only when providing abbreviations for the Emmet: Wrap with Abbreviation command. It removes line markers from wrapped lines.

Using custom Emmet snippets

Custom Emmet snippets need to be defined in a json file named snippets.json . The emmet.extensionsPath setting should have the path to the directory containing this file.

Below is an example for the contents of this snippets.json file.

Authoring of Custom Snippets in Emmet 2.0 via the snippets.json file differs from the old way of doing the same in a few ways:

Topic Old Emmet Emmet 2.0
Snippets vs Abbreviations Supports both in 2 separate properties called snippets and abbreviations The 2 have been combined into a single property called snippets. See default HTML snippets and CSS snippets
CSS snippet names Can contain : Do not use : when defining snippet names. It is used to separate property name and value when Emmet tries to fuzzy match the given abbreviation to one of the snippets.
CSS snippet values Can end with ; Do not add ; at end of snippet value. Emmet will add the trailing ; based on the file type (css/less/scss vs sass/stylus) or the emmet preference set for css.propertyEnd , sass.propertyEnd , stylus.propertyEnd
Cursor location $ or | can be used Use only textmate syntax like $ <1>for tab stops and cursor locations

HTML Emmet snippets

HTML custom snippets are applicable to all other markup flavors like haml or pug . When snippet value is an abbreviation and not actual HTML, the appropriate transformations can be applied to get the right output as per the language type.

For example, for an unordered list with a list item, if your snippet value is ul>li , you can use the same snippet in html , haml , pug or slim , but if your snippet value is , then it will work only in html files.

If you want a snippet for plain text, then surround the text with <> .

CSS Emmet snippets

Values for CSS Emmet snippets should be a complete property name and value pair.

CSS custom snippets are applicable to all other stylesheet flavors like scss , less or sass . Therefore, don’t include a trailing ; at the end of the snippet value. Emmet will add it as needed based on whether the language requires it.

Do not use : in the snippet name. : is used to separate property name and value when Emmet tries to fuzzy match the abbreviation to one of the snippets.

Tab stops and cursors in custom snippets

The syntax for tab stops in custom Emmet snippets follows the Textmate snippets syntax.

  • Use $ <1>, $ <2>for tab stops and $ <1:placeholder>for tab stops with placeholders.
  • Previously, | or $ was used to denote the cursor location in the custom Emmet snippet. This is no longer supported. Use $ <1>instead.

Emmet configuration

Below are Emmet settings that you can use to customize your Emmet experience in VS Code.

Use this setting to add mapping between the language of your choice and one of the Emmet supported languages to enable Emmet in the former using the syntax of the latter. Make sure to use language IDs for both sides of the mapping.

If there is a language where you do not want to see Emmet expansions, add it in this setting which takes an array of language ID strings.

See Emmet Customization of output profile to learn how you can customize the output of your HTML abbreviations.

Customize variables used by Emmet snippets.

Controls the Emmet suggestions that show up in the suggestion/completion list.

Setting Value Description
never Never show Emmet abbreviations in the suggestion list for any language.
inMarkupAndStylesheetFilesOnly Show Emmet suggestions only for languages that are purely markup and stylesheet based (‘html’, ‘pug’, ‘slim’, ‘haml’, ‘xml’, ‘xsl’, ‘css’, ‘scss’, ‘sass’, ‘less’, ‘stylus’).
always Show Emmet suggestions in all Emmet supported modes as well as the languages that have a mapping in the emmet.includeLanguages setting.

Note: In the always mode, the new Emmet implementation is not context aware. For example, if you are editing a JavaScript React file, you will get Emmet suggestions not only when writing markup but also while writing JavaScript.

Shows possible emmet abbreviations as suggestions. It is true by default.

For example, when you type li , you get suggestions for all emmet snippets starting with li like link , link:css , link:favicon etc. This is helpful in learning Emmet snippets that you never knew existed unless you knew the Emmet cheatsheet by heart.

Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to never .

Provide the location of the directory that houses the snippets.json file which in turn has your custom snippets.

Set this to true to enable expanding Emmet abbreviations with Tab key. We use this setting to provide the appropriate fallback to provide indentation when there is no abbreviation to expand.

If set to true , then Emmet suggestions will be grouped along with other snippets allowing you to order them as per editor.snippetSuggestions setting. Set this to true and editor.snippetSuggestions to top , to ensure that Emmet suggestions always show up on top among other suggestions.

You can use this setting to customize Emmet as documented in Emmet Preferences. The below customizations are currently supported:

Источник

Оцените статью