Skip to content
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

Presing Tab key after a word in markdown file creates XML tags #16569

Closed
jaywick opened this issue Dec 6, 2016 · 7 comments · Fixed by #17094
Closed

Presing Tab key after a word in markdown file creates XML tags #16569

jaywick opened this issue Dec 6, 2016 · 7 comments · Fixed by #17094
Assignees
Labels
emmet Emmet related issues markdown Markdown support issues
Milestone

Comments

@jaywick
Copy link

jaywick commented Dec 6, 2016

  • VSCode Version: 1.7.2 (7ba55c5)
  • OS Version: Windows 10.0.14393

Steps to Reproduce:

  1. Create a test.md file

  2. Add a sentence of text such as

     Lorem ipsum sit dolar amet.
    
  3. Put your keyboard cursor after Lorem

  4. Press Tab

Expected: Spaces or tabs to be added between Lorem and ipsum
Result: Lorem word gets converted into an XML tag and auto closed, leaving us with

    <Lorem></Lorem> ipsum sit dolar amet.

In Action

in action

@jaywick jaywick changed the title Presing Tab key after a word in markdown file creates xml tags Presing Tab key after a word in markdown file creates XML tags Dec 6, 2016
@jaywick jaywick changed the title Presing Tab key after a word in markdown file creates XML tags Presing <kbd>Tab</kbd> key after a word in markdown file creates XML tags Dec 6, 2016
@jaywick jaywick changed the title Presing <kbd>Tab</kbd> key after a word in markdown file creates XML tags Presing Tab key after a word in markdown file creates XML tags Dec 6, 2016
@jaywick jaywick changed the title Presing Tab key after a word in markdown file creates XML tags Presing Tab key after a word in markdown file creates XML tags Dec 6, 2016
@mjbvz mjbvz added markdown Markdown support issues emmet Emmet related issues labels Dec 7, 2016
@mjbvz mjbvz added the *as-designed Described behavior is as designed label Dec 7, 2016
@mjbvz
Copy link
Collaborator

mjbvz commented Dec 7, 2016

This is coming from Emmet. To disable this, add:

    "emmet.excludeLanguages": ["markdown"],

to your settings.

Although this is currently the expected behavior, I think we should probably disable emmet expansions in markdown by default because this behavior can be annoying during normal writing. @ramya-rao-a Any thoughts?

@egamma
Copy link
Member

egamma commented Dec 8, 2016

@ramya-rao-a this behaviour is a consequence of #9500, which has as the goal to not hard code in which language modes emmet is enabled for. As a heuristic #9500 uses the grammar's scope name hierarchy as a hint. This heuristic has worked pretty well.

The scope of the markdown grammar is text.html.markdown. This means Markdown is treated as a specialization of html and since emmets supports html, emmet is enabled in Markdown as well.

According the emmet doc there is no special syntax profile available for Markdown #9500 (comment).

So a quick fix would be to:

  • hard code an exclusion for markdown in #isEmmetEnableMode
  • change the scope name of the markdown grammar, so that it doesn't inherit from html, not sure what the consequences of this are.

@mrmlnc do you have other ideas how to improve the support for emmet in Markdown and avoid the surprise described in this issue?

@ramya-rao-a ramya-rao-a removed the *as-designed Described behavior is as designed label Dec 8, 2016
@ramya-rao-a ramya-rao-a added this to the January 2017 milestone Dec 8, 2016
@mrmlnc
Copy link
Contributor

mrmlnc commented Dec 8, 2016

Hello, @egamma,

I see the same way as you suggested above. But, perhaps, we can also disable Markdown in the settings, as it was for files.exclude.

If you decide to disable Emmet inside Markdown, it is better to first option.

But my 2 cents:

Markdown is a lightweight markup language and it presupposes the existence of HTML constructs within yourself. Thus, it seems to me, to disable Emmet inside Markdown is not correct.

P.S. Small news: the creator of Emmet had already started work on the second version aka 2.0.0 🐼

@egamma
Copy link
Member

egamma commented Dec 9, 2016

@mrmlnc thanks for the feedback. I agree with your point that disabling emmet without some way to re-enable it, if someone really wants emmet is better than to totally disable it.

Glad to hear about Emmet 2.0.

@mjbvz
Copy link
Collaborator

mjbvz commented Dec 9, 2016

@egamma Could "markdown" just be in the default setting for emmet.excludeLanguages? That would stop most users from triggering emmet unexpectedly in markdown files, while still allowing users to opt back in to emmet for markdown if they wish

@egamma
Copy link
Member

egamma commented Dec 12, 2016

@mjbvz the idea is good. It has a small drawback. If someone defines emmet.excludedLanguages in the settings, then they will not profit from this fix.

However, if someone if familiar with this setting and then they know how to disable emmet in markdown, if they are annoyed by it. Bottom line I'm fine with this fix.

@mjbvz
Copy link
Collaborator

mjbvz commented Dec 13, 2016

Ok, I've merged in #17094 which adds "markdown" to the default list of excluded languages. Not a perfect solution, but it should stop many users from hitting this behavior unexpectedly

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
emmet Emmet related issues markdown Markdown support issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants