kristoff-it / superhtml

HTML Language Server & Templating Language Library
MIT License
548 stars 20 forks source link

Differentiating Superhtml vs SSI Html #23

Closed EliSauder closed 2 months ago

EliSauder commented 2 months ago

In order to get full language support in the vim ecosystem, a way to differentiate between server side includes and superhtml needs to be established. As of now, I think the best way to do this is to try and detect server side includes as they have a fairly distinct syntax. However, I was wondering if there is a way that superhtml uses to distinguish itself that would be easier. That, or is there another file extension that could be considered? Is there ever a time where someone would want to use SSI and superhtml together?

Vim issue for posterity's sake: https://github.com/vim/vim/issues/15355

kristoff-it commented 2 months ago

Looking at

https://github.com/vim/vim/blob/508e7856ec4afc9d6038b14bb6893668268dccab/runtime/autoload/dist/ft.vim#L408-L438

You could search for <extend or <super> in the code. Make sure to search for one or the other (also notice how extend is missing the final diamond bracket). If a superhtml template doesn't contain either I think it's fine to detect the file as plain HTML.

If people in the future find SuperHTML useful enough they can pester the Vim project to prioritize it over server side includes then (and customize that in their own config files in the meantime).

EliSauder commented 2 months ago

Logic for this has been implemented for vim. Marking as completed https://github.com/vim/vim/pull/15367