Skip to content

Enable language extensions to call emmet completion provider #29114

Closed

Description

See vuejs/vetur#232 (comment)

In html files, we use the html parser to figure out the cursor is inside the style tag and then use css instead of html abbr

In non html files that need html like abbreviations, the parsing is not available out of the box and so the emmet extension doesn't realize to use css instead html abbr inside the html tag

Update:
See #29114 (comment) for a proposal that could solve this issue by passing the responsibility of figuring out scope to language specific extensions

Activity

  1. added
    emmet
    feature-request
    help wanted
    on Jun 20, 2017
  2. octref commented on Jun 20, 2017

    @octref
    Contributor

    But lang is available.

    image

    If TM scope inspector can figure it out there should be a way to find the current lang.
    Previously syntaxProfiles worked with embedded lang like so:

    https://github.com/octref/vetur/blob/master/package.json#L81-L95

  3. octref commented on Jun 20, 2017

    @octref
    Contributor

    So I guess you don't need to parse the whole document for providing emmet.
    Imagine a php file where people'd ask for emmet for the html part...Can't parse PHP too, right 😅

  4. ramya-rao-a commented on Jun 20, 2017

    @ramya-rao-a
    ContributorAuthor

    Pine (@octref) that's the catch. Scope info is not available to extensions. The new emmet is an extension.

    Another way to go about this is to pass the responsibility of figuring out the right language to the language specific extension.

    A simple version of the emmet completion provider can be pulled out into a module of its own. This version need not have any parsing or validation for position. That would be done by the language extension.

    If the user has mapped the language using emmet.syntaxProfiles then the language extension would do nothing special. May be show a notification saying that Hey, you dont need emmet.syntaxProfiles for this language anymore If there is no mapping, then the language extension can call the simple emmet completion provider, pass the right syntax (html/css) and get completions.

    Thoughts?

  5. octref commented on Jun 21, 2017

    @octref
    Contributor

    A simple version of the emmet completion provider can be pulled out into a module of its own.

    Yep if you can have that I can incorporate it into Vetur.

    If the user has mapped the language using emmet.syntaxProfiles then the language extension would do nothing special. May be show a notification saying that Hey, you dont need emmet.syntaxProfiles for this language anymore If there is no mapping, then the language extension can call the simple emmet completion provider, pass the right syntax (html/css) and get completions.

    Sure.

    Think this approach could possibly allow emmet completions for JSX too for Vue/React.

  6. ramya-rao-a commented on Jun 21, 2017

    @ramya-rao-a
    ContributorAuthor
  7. changed the title [-]Css abbr don't work inside style tag in non html files when using emmet.syntaxProfiles[/-] [+]New emmet cannot resolve embedded languages[/+] on Jun 21, 2017
  8. changed the title [-]New emmet cannot resolve embedded languages[/-] [+]Enable language extensions to call emmet completion provider[/+] on Jun 22, 2017
  9. removed
    help wanted
    on Jun 22, 2017
  10. octref commented on Jun 22, 2017

    @octref
    Contributor

    Will give it a try tonight :-)

  11. ramya-rao-a commented on Jun 28, 2017

    @ramya-rao-a
    ContributorAuthor

    Pine (@octref) Also see #29532 (comment)

    Ifemmet.showExpandedAbbreviation is set to always and the user has the mapping "vue-html": "html" in emmet.includeLanguages, then the emmet extension itself will provide the emmet suggestions.

    So check for that before providing completions from vetoer

    emmet.includeLanguages is the replacement for emmet.syntaxProfiles.
    See #29678 (comment)

  12. ramya-rao-a commented on Jun 29, 2017

    @ramya-rao-a
    ContributorAuthor

    Closing this issue as the work from vscode's side is done.

    Using the module from vetur is being tracked in vuejs/vetur#232

  13. octref commented on Jun 29, 2017

    @octref
    Contributor

    Ramya Rao (@ramya-rao-a) I see because npm package was pointing to Microsoft/vscode-emmet-helper.

    But currently emmet doesn't seem to be working correctly in Insider, for either html or vue

    emmet

    Is it because the new build is not out yet? Mine is

    9541932
    2017-06-29T05:03:32.047Z

  14. ramya-rao-a commented on Jun 29, 2017

    @ramya-rao-a
    ContributorAuthor

    Pine (@octref) That happens when you have a word stop (like * or :). The suggestions get filtered out. There was a change that went in yesterday in the filtering logic of suggest widget which caused this.

    See #29758. I am working on it

    You can still hit Ctrl+Space and you will see the same suggestions as before.

  15. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

emmetfeature-request

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions