GNU bug report logs -
#74610
31.0.50; Submitting mhtml-ts-mode, treesitter alternative to mhtml-mode
Previous Next
Reported by: Vincenzo Pupillo <v.pupillo <at> gmail.com>
Date: Fri, 29 Nov 2024 21:58:01 UTC
Severity: wishlist
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Ciao Jury,
I was just about to write, you anticipated me.
The function `html-ts-mode--outline-predicate`, does not work correctly in
`mhtml-ts-mode`, the function seems to fail to calculate the end of the tag it
is on (see outline_issue_1.png)
And, exactly as you wrote, with treesit-outline-predicate set to nil it does
not work because the function `treesit-outline-predicate--from-imenu` does not
check the variable `treesit-aggregated-simple-imenu-settings` but only
`treesit-simple-imenu-settings`.
I attach a new patch adapted to the latest commits.
Thanks.
Vincenzo.
In data giovedì 13 febbraio 2025 18:55:59 Ora standard dell’Europa centrale,
Juri Linkov ha scritto:
> >> I think we need now clarify the relation
> >> between mhtml-ts-mode and html-ts-mode.
> >>
> >> For example, currently I added a new function
> >> 'html-ts-mode--outline-predicate' to html-ts-mode.el.
> >> Should it be used in mhtml-ts-mode.el as well?
> >
> > I have to try but I think so, mhtml-ts-mode is declared as derived from
> > html- ts-mode (although it is not very clear to me how derived modes
> > work). The treesit-outline-predicate variable is set by html-ts-mode and
> > mhtml-ts-mode inherits the same value.
>
> It seems inheritance doesn't work for embedded ts-modes
> since even the primary ts-mode should be configured
> by aggregation like with treesit-aggregated-simple-imenu-settings,
> not by inheritance.
>
> I see that you added TODO for an aggregated version of
> treesit-defun-type-regexp. Then treesit-outline-predicate
> also needs an aggregated version, and maybe other settings too.
> Ok, I could look how to do this with treesit-outline-predicate.
>
> >> What about other settings? Should html-ts-mode and mhtml-ts-mode
> >> always be kept in sync? Or html-ts-mode should be obsoleted
> >> when it will be superseded by mhtml-ts-mode?
> >>
> >> Maybe html-ts-mode would be still needed as a separate mode
> >> to be used as embedded submode in such files as e.g.
> >> Vue single-file component with *.vue files that contain parts
> >> from js-ts-mode, css-ts-mode, and html-ts-mode for templates.
> >
> > I don't know. In general, I think having simple major modes makes it
> > easier to build more complex aggregations, rather than having to disable
> > some features inherited from complex major modes, as in html-ts-mode: "
> >
> > ;; `html-ts-mode' inherits from `html-mode' that sets
> >
> > ;; regexp-based outline variables. So need to restore
> > ;; the default values of outline variables to be able
> > ;; to use `treesit-outline-predicate' above.
>
> I checked that neither aggregation nor inheritance from html-ts-mode
> can be used for vue-ts-mode since tree-sitter-vue duplicates
> HTML grammar in its own grammar. Even tree-sitter-astro
> incorporates a simplified HTML grammar into its own grammar.
> This is similar to HTML-like jsx elements in tsx grammar.
[outline_issue_1.png (image/png, attachment)]
[0001-Add-mhtml-ts-mode.patch (text/x-patch, attachment)]
This bug report was last modified 98 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.