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

Emmet 2.0: Show custom snippet along with default snippet if match #33579

Closed
vvs opened this issue Aug 31, 2017 · 3 comments
Closed

Emmet 2.0: Show custom snippet along with default snippet if match #33579

vvs opened this issue Aug 31, 2017 · 3 comments
Assignees
Labels
emmet Emmet related issues verified Verification succeeded
Milestone

Comments

@vvs
Copy link

vvs commented Aug 31, 2017

  • VSCode Version: Code - Insiders 1.16.0-insider (8b942fa, 2017-08-31T07:27:43.804Z)
  • OS Version: Windows_NT x64 10.0.15063
  • Extensions:
Extension Author (truncated) Version
Bookmarks ale 0.16.0
project-manager ale 0.20.0
vscode-eslint dba 1.2.11
gitlens eam 4.4.3
EditorConfig Edi 0.9.4
prettier-vscode esb 0.23.1
beautify Hoo 1.1.1
vscode-stylefmt mrm 2.5.0
atom-keybindings ms- 3.0.1
vetur oct 0.9.5
stylelint shi 0.28.0
vscode-todo-highlight way 0.5.9
vscode-jumpy wma 0.3.1

Steps to Reproduce:

This is a weird one. I have defined the following custom snippet for Emmet:

"mrgstart": "@include margin-start(${1:value});",

When I type mrg, the snippet is not shown. It appears only when I type mrgs.

If I rename the snippet to abcstart, then it is properly shown when I type abc.

😵

Reproduces without extensions: Yes

@vscodebot vscodebot bot added the insiders label Aug 31, 2017
@vscodebot vscodebot bot added the emmet Emmet related issues label Aug 31, 2017
@vvs
Copy link
Author

vvs commented Aug 31, 2017

Found multiple other cases when custom emmet snippets are not shown when their names partially entered.

It looks like it has something to do with the amount of the suggestions for the currently entered text. If the amount of suggestions is not big, then the custom snippet is shown among the suggestions. If the amount is big, the custom snippet is not shown until more text is entered and the amount of suggestions is reduced.

That way, entering ps won't show pstart, too many suggestions. But entering px will show pxtart, since there are not many suggestions.

My expectation is that my custom Emmet snippets should always be in the suggestion list, esp. when I entered a proper prefix of the entire snippet name.

@ramya-rao-a
Copy link
Contributor

It looks like it has something to do with the amount of the suggestions for the currently entered text

No. We show only the best match for the abbreviation/snippet that has been typed for Emmet

So in your case mrg fuzzy matches best with mr (See https://github.com/emmetio/snippets/blob/master/css.json#L137) than with mrgstart, and so you get margin-right which is the value for the snippet mr. This fuzzy matching occurs inside the emmet module called css-snippets-resolver

Similarly ps matches best with pos than pstart.

To learn more about fuzzy matching in Emmet for css, see https://github.com/emmetio/css-snippets-resolver/blob/master/index.js#L154

custom Emmet snippets should always be in the suggestion list, esp. when I entered a proper prefix of the entire snippet name.

That sounds reasonable. I can look into it

@ramya-rao-a ramya-rao-a changed the title Emmet 2.0: 'mrgstart' custom snippet is not shown in suggestions Emmet 2.0: Show custom snippet along with default snippet if match Aug 31, 2017
@ramya-rao-a ramya-rao-a added this to the August 2017 milestone Aug 31, 2017
@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Aug 31, 2017

this will be fixed in tonight's Insiders (Sept 1)

Custom Emmet snippets(css) will always show up as long as what was typed is the prefix of the snippet name

@ramya-rao-a ramya-rao-a added the verification-needed Verification of issue is requested label Aug 31, 2017
@aeschli aeschli added verified Verification succeeded and removed verification-needed Verification of issue is requested labels Sep 1, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
emmet Emmet related issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants