Skip to content

xhtml is a profile not syntax in emmet - #18625

Merged
Ramya Rao (ramya-rao-a) merged 1 commit into
masterfrom
ramyar/emmet-xhtml
Jan 20, 2017
Merged

Ramya Rao (ramya-rao-a) merged 1 commit into
masterfrom
ramyar/emmet-xhtml

Conversation

@ramya-rao-a

@ramya-rao-a Ramya Rao (ramya-rao-a) commented Jan 17, 2017 •

Copy link
Copy Markdown
Contributor

@egamma Erich Gamma (egamma) left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing xhtml from the list of emmetSupportedModes makes sense. Since in VS Code we have no language mode for xhtml but only html.

I'm now confused by this code that uses a profile to override the editors syntax. It was introduced as a partial fix for #9500 67bbb46.

		// user can overwrite the syntax using the emmet syntaxProfiles setting
		let profile = this.getSyntaxProfile(syntax);
		if (profile) {
			return profile;
		}

We are configuring emmet with the user defined profiles and preferences here. Therefore we should let emmet handle the profiles. I'm therefore thinking we should remove the above code alltogether. It causes the issue in #18434 and this PR works around this code for xhtml.

Denis Malinochkin (@mrmlnc) what am I missing 😄

@ramya-rao-a

Copy link
Copy Markdown
Contributor Author

Erich Gamma (@egamma) That is the part that enables emmet support for languages other than the "known" modes.

What you linked loads profiles, yes, but here profile means the way html is output (like self closing tags, single quote for attributes etc.).

@mrmlnc

Copy link
Copy Markdown
Contributor

Sorry, i'll see all issues with Denis Malinochkin (@mrmlnc) tomorrow 👍 (now I have a lot of work on a new place of work 🔮)

@egamma

Copy link
Copy Markdown
Member

Ramya Rao (@ramya-rao-a)

That is the part that enables emmet support for languages other than the "known" modes.

Then isn't the root cause of the issue that we overload the setting emmet.syntaxProfiles as you describe in #18434 (comment).

Isn't a better fix is to eliminate this overloading and introduce a separate setting, e.g., emmet.mapLanguage. This settings supports to map a VS Code language to an emmet supported mode.

"emmet.mapLanguage": {
    "java": "html"
}

Denis Malinochkin (@mrmlnc) what do you think?

@ramya-rao-a

Copy link
Copy Markdown
Contributor Author

Erich Gamma (@egamma)

Isn't a better fix is to eliminate this overloading and introduce a separate setting, e.g., emmet.mapLanguage

That was my first thought as well. But, that would break the experience for people who have already started using emmet.syntaxProfile to map their language to a known mode

@mrmlnc

Copy link
Copy Markdown
Contributor

Hm, i don't fully understand your thoughts.

"html": "xhtml" should works fine, because this is example from http://docs.emmet.io/customization/syntax-profiles/. Now I don't understand why this is not work.

Works for me inside emmet.syntaxProfiles:

"html": "jade",
"html": {
  "tag_case": "upper"
}

I'll look at this task in more detail soon.

@ramya-rao-a

Copy link
Copy Markdown
Contributor Author

Denis Malinochkin (@mrmlnc)
"html":"xhtml" used to work exactly like the example in http://docs.emmet.io/customization/syntax-profiles/ before we made the change to use emmet.syntaxProfile to also map new languages to known syntax.

Now, when we set "html":"xhtml" in emmet.syntaxProfiles, "xhtml" gets passed as a syntax (via the getSyntax), and then emmet provides only tag completion because it is not aware of any "xhtml" syntax. See https://github.com/emmetio/emmet/blob/master/lib/snippets.json, there is no "xhtml" syntax. And therefore all the html abbreviations that the user expects is missing.

@ramya-rao-a

Copy link
Copy Markdown
Contributor Author

Erich Gamma (@egamma) I have updated the PR with a slightly better fix.

  • "xhtml" as before is removed from list of supported modes
  • the overriding of syntax using profile will be done only if the profile is one of the supported modes
// user can overwrite the syntax using the emmet syntaxProfiles setting
		let profile = this.getSyntaxProfile(syntax);
		if (profile && this.emmetSupportedModes.indexOf(profile) !== -1) {
			return profile;
		}

I believe this is a good solution for the current iteration.

But looking at the big picture, we should ideally have a separate setting for mapping languages to known syntax.

@egamma

Copy link
Copy Markdown
Member

Ramya Rao (@ramya-rao-a) 👍 This is a good fix and we can still look into adding a separate setting.

@ramya-rao-a
Ramya Rao (ramya-rao-a) merged commit 6ae3ffa into master Jan 20, 2017
@ramya-rao-a

Copy link
Copy Markdown
Contributor Author

Thanks Erich Gamma (@egamma) PR is merged.
Denis Malinochkin (@mrmlnc) Please add your thoughts here when you get some time.

@ramya-rao-a
Ramya Rao (ramya-rao-a) deleted the ramyar/emmet-xhtml branch April 25, 2017 02:53
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants