• Bug#1100003: hx: Syntax highlighting requires building grammar plugins

    From Jonas Smedegaard@21:1/5 to All on Tue Jul 22 13:30:01 2025
    Hi Nonjoe,

    Quoting Ninjoe (2025-07-22 12:33:05)
    I'm one of those who were surprised by syntax highlighting not working
    in the default installation, even though hx --health indicates that it should. (Apologies—I haven’t read Debian’s README either.)

    Thanks for admitting up front that your opinions are provided without
    reading the README file. I appreciate your sharing your opinions
    regardless.


    I think that, at the very least, in the default installation, hx
    --health shouldn't show check marks for syntax highlighting if it
    doesn't work. I think this can mislead users—especially those who skip
    the README.

    How --health option behaves is a different issue than the one tracked in
    this bugreport.

    Debian packaging does not patch Rust code for the --health argument, so
    if you want that health argument to behave differently, then please file
    a bugreport upstream about that.


    # Sources for grammar plugins is not in Debian

    Either hundreds of source packages need to be introduced to Debian, or
    the src:hx package would need to carry hundreds of embedded projects.

    I think the best approach is to package the sources for the more popular grammars only, and think the best approach is that those interested in some grammar join the tree-sitter team and file a bugreport against hx when sources are available in Debian.

    I would also like to see the default installation support some popular grammars out of the box. Having to install g++ on a server just to
    enable syntax highlighting for, say, JavaScript and CSS, doesn't feel right.  In contrast, Helix package on Fedora and Arch includes many pre-compiled grammars and is quite ready for use by most users.

    I don't know how other distros handle build-time dependencies, but guess
    that they either have network access during build or that additional dependencies have been packaged for those distributions which are not
    packaged in Debian. I.e. exactly my point in the text you quoted, so I
    fail to see any relevancy in your note above - please do elaborate if
    you think I am missing something helpful there.


    # Grammar plugins slows startup of Helix

    My main concern with many plugins is not size but speed: As I recall,
    I experienced a noticable slowdown in startup of Helix when many plugins are loaded.

    I'm not sure if this is still the case. At least, on my Fedora desktop,
    the distro's Helix package installs over 200 pre-compiled grammars and
    it starts instantly for me.

    Could you perhaps share how beefy or not your machine is, and how big
    files you tried to open and how fast they opened? Then I will try do
    the same if/when I get around to loading the hundreds of plugins again.

    - Jonas

    --
    * Jonas Smedegaard - idealist & Internet-arkitekt
    * Tlf.: +45 40843136 Website: http://dr.jones.dk/
    * Sponsorship: https://ko-fi.com/drjones

    [x] quote me freely [ ] ask before reusing [ ] keep private

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jonas Smedegaard@21:1/5 to All on Tue Jul 22 14:20:01 2025
    Quoting Ricardo Fernández Serrata (2025-05-14 05:59:09)
    Package: hx
    Version: 25.01.1-4
    Followup-For: Bug #1100003

    Dear Maintainer(s), the control file should have `Recommends: g++ | clang, git`:
    - `hx -g fetch` requires `git`
    - `hx -g build` requires any C++14 compiler

    Thanks, applied to experimental package now.

    Please in future consider filing a separate bugreport for related issues
    to not risk it being missed as was about to happen here.

    - Jonas

    --
    * Jonas Smedegaard - idealist & Internet-arkitekt
    * Tlf.: +45 40843136 Website: http://dr.jones.dk/
    * Sponsorship: https://ko-fi.com/drjones

    [x] quote me freely [ ] ask before reusing [ ] keep private

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jonas Smedegaard@21:1/5 to All on Tue Jul 22 17:10:02 2025
    Quoting Bastian Venthur (2025-03-11 09:44:00)
    Package: hx
    Followup-For: Bug #1100003
    X-Debbugs-Cc: [email protected]

    Hi Jonas,

    thanks for your reply.

    There are multiple concerns here:

    # Sources for grammar plugins is not in Debian

    Either hundreds of source packages need to be introduced to Debian, or
    the src:hx package would need to carry hundreds of embedded projects.

    I think the best approach is to package the sources for the more
    popular grammars only, and think the best approach is that those
    interested in some grammar join the tree-sitter team and file a
    bugreport against hx when sources are available in Debian.

    Thanks for the explanation, I understand that these tree-sitter plugins should be packaged separately so they can be used by other packages such
    as neovim. Does that mean that the few existing tree-sitter packages for
    C, Lua, Markdown, etc. could already be utilized by hx?

    There are (as I understand it) no "tree-sitter plugins", but intead
    Helix plugins (which are not reusable by other editors, but which
    build-depends on libraries often related to tree-sitter project which
    might transitively be shared among multiple editors) and language
    servers (which in principle are shared among all editors supporting the Language Server Protocol, LSP).

    Helix plugins with all build-dependencies already in Debian are easier
    to package but still need some custom setup which has not been fleshed
    out yet: When using upstream build routines, the core code for each of
    those plugins is fetched from git repos, which is not permitted to do
    on Debian build daemons.

    Also, would you be open to make hx depend on a reasonable set of
    treesitter plugins by default?

    I think it is more sensible to recommend plugins than depend on them.


    # Grammar plugins are either system-shared or personal

    If I recall correctly (it is some time ago I looked into that),
    grammar plugins can be stored below /usr - but if a single plugin
    exists below ~/.config/helix/runtime/grammars then the system-shared plugins are all ignored.

    Ideally we should convince upstream to improve this, but if not then I
    am willing to carry a reasonably small patch for Debian. Help making
    such patch is welcome.

    This sounds not right, maybe this has been fixed upstream already. If
    not, this should probably be fixed.

    Please feel free to test if possible to use a combination of
    system-shared and personally built plugins, and if not initiate a
    conversation upstream about introducing such support.


    # Grammar plugins slows startup of Helix

    My main concern with many plugins is not size but speed: As I recall,
    I experienced a noticable slowdown in startup of Helix when many
    plugins are loaded.

    Can you verify if that is still the case? I tried both cases: none and
    all tree-siter plugins and did not perceive any performance difference.

    No, I have not found time to verify that yet.

    Please consider sharing how beefy your system is, and to measure the
    it takes to load Helix both with an enpty document and with a large
    document, with and without many plugins enabled.


    Kind regards,

    - Jonas

    --
    * Jonas Smedegaard - idealist & Internet-arkitekt
    * Tlf.: +45 40843136 Website: http://dr.jones.dk/
    * Sponsorship: https://ko-fi.com/drjones

    [x] quote me freely [ ] ask before reusing [ ] keep private

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)