Skip to content

Implement output.reverseAttributes for emmet snippets #110251

Closed
@webdog

Description

@webdog

Hello!

Could you please allow for the output.ReverseAttributes to be defined as a user preference setting?

This was implemented to allow user-defined positioning of attributes and was implemented in the current emmet repo here

Why is this important?

With Bootstrap, all of the generated code samples implement class attributes at the beginning of a tag. For example, a generated navbar sample from their site (As a note, this is how I've generally seen and used bootstrap classes implemented inside a tag), might have a section that looks like this:

          <div class="dropdown-menu" aria-labelledby="navbarDropdown">
            <a class="dropdown-item" href="#">Current</a>
            <a class="dropdown-item" href="#">Next Week</a>
            <a class="dropdown-item" href="#">Something else here</a>
          </div>

to add a new anchor with the same syntax, I would want to use the follow emmet syntax:
a.dropdown-item[href=#]{Next Month}
However, the preview generated, and the implementation do not give me the style that I prefer:
image

<div class="dropdown-menu" aria-labelledby="navbarDropdown">
            <a class="dropdown-item" href="#">Current</a>
            <a class="dropdown-item" href="#">Next Week</a>
            <a href="#" class="dropdown-item">Next Month</a>
            <a class="dropdown-item" href="#">Something else here</a>
</div>

Now, I could implement a snippet for this specific anchor override, but now if I want to use this style across the codebase with all of my tags that utilize bootstrap, I now have to create a snippets.json file that grows exponentially to cover every use-case.

Since output.reverseAttributes solves this behavior, I figured I could do add this override in my code workspace settings, such as

	"settings": {
		"emmet.preferences": {
			"output.reverseAttributes": true
		}
	}

But this did not work. snippets.json also does not have a supported object for preferences based on emmet documentation. I think this might also open a bigger question of "How can VSCode support any arbitrary snippet preference? (There are many from where this specific attribute was implemented) There doesn't seem to be a method to implement this behavior via the regular preferences.json so if I want this behavior today, it seems I would need to fork emmet and vscode, and implement my own custom implementation to enable this feature toggle.

Metadata

Metadata

Assignees

Labels

author-verification-requestedIssues potentially verifiable by issue authoremmetEmmet related issuesfeature-requestRequest for new features or functionalitygood first issueIssues identified as good for first-time contributorshelp wantedIssues identified as good community contribution opportunitiesinsiders-releasedPatch has been released in VS Code Insidersverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions