tpmatthes / Twig.novaextension

Nova Extension: Syntax Highlighting and Completions for Twig Files (.twig)
MIT License
12 stars 1 forks source link

Emmet does not trigger with tab key #3

Closed freinbichler closed 3 years ago

freinbichler commented 4 years ago

Hi, first of all thank you for creating this extension! One minor issue I have since enabling this extension is that the tab key does not trigger emmet in Twig files anymore. Only Ctrl + E seems to work. Is there a preference to enable Emmet in the default autocomplete view that is triggered with the tab key, like it works in HTML files?

tpmatthes commented 4 years ago

Hey, thanks for taking the time to submit an issue! šŸ˜„ Iā€™ve installed the Emmet plugin and I can definitely see the problem.

This plugin provides a list of tags for Novaā€™s built-in autocomplete function, it doesnā€™t do anything else. It actually has two syntax definitions: Twig-HTML (Twig code alongside regular HTML tags with built-in HTML as a subsyntax) and ā€œnormalā€ Twig (Twig code inside brackets). The Emmet plugin doesnā€™t show completions inside either of them.

As it seems, the Emmet plugin does work in PHP files, if no other completions are available. The built-in PHP syntax and this plugin use the same structure. Iā€™ve temporarily removed all completions from the Twig plugin, but it still doesnā€™t work. So, it may be a problem with the Emmet plugin itself.

Iā€™ve briefly looked into the code for the Emmet plugin: It seems like it has an internal list of file types that are supported. See: https://github.com/emmetio/nova-plugin/blob/a2148a73762910dfd3fad95a37049584282fb218/src/lib/syntax.ts#L11

This plugin adds a syntax definition for Twig, and Twig isnā€™t part of that list. Therefore (I guess) it doesnā€™t work anymore.

Actually, thereā€™s an open issue about this topic on the pluginā€™s repository: https://github.com/emmetio/nova-plugin/issues/17

Iā€™ll be happy to work with the authorā€™s of the Emmet plugin to solve this issue.

freinbichler commented 4 years ago

Thank you very much for investigating! Let's hope the emmet developers add the twig filetype, or even better, allow the filetypes to be customised in the plugin settings.