Skip to content

syntax highlighting broken for .*eex files #562

Open

Description

@superhawk610

After the recent change that removed ftdetect, syntax highlighting is no longer working for .*eex files (.heex, .leex, etc). It appears that the default filetype detection marks these files as e.g. ft=heex instead of ft=eelixir, as the previous ftdetect plugin did.

Actual

set ft?
  filetype=heex

image

Expected

If I run set ft=eelixir, I get this:

image

However, if I first run let b:eelixir_subtype = 'heex', I get this:

image

Not sure which of these is correct.

$ nvim --version
NVIM v0.7.0-dev+1348-g524f6294a
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by a80323765@USC02F834HMD6N

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-524f629/share/nvim"

Run :checkhealth for more info

Activity

  1. dekkofilms commented on Apr 2, 2022

    @dekkofilms

    My syntax highlighting is also broken with that recent change. My computer now goes back and reads these files as euphoria3 instead of elixir.

    Edit: FWIW, it is broken for .ex and .exs files as well, on my end. For now, I just added the removed lines from that latest commit into my .vimrc and it's back to perfection.

  2. superhawk610 commented on Apr 3, 2022

    @superhawk610
    Author

    @dekkofilms which version of vim/neovim are you using?

  3. dekkofilms commented on Apr 3, 2022

    @dekkofilms

    @superhawk610 my vim version is 8.2

  4. cvincent commented on Apr 7, 2022

    @cvincent

    I'm on latest master NeoVim and had to manually revert that commit on my local install for syntax highlighting and indentation to come back for .heex files.

  5. RTLS commented on Apr 8, 2022

    @RTLS

    as @dekkofilms mentioned, adding the following to .vimrc or init.vim fixes:

    au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
    au BufRead,BufNewFile *.eex,*.heex,*.leex,*.sface,*.lexs set filetype=eelixir
    au BufRead,BufNewFile mix.lock set filetype=elixir
    
  6. jbodah commented on Apr 8, 2022

    @jbodah
    Collaborator
    $ nvim -v
    NVIM v0.7.0-dev+1410-g2c7dc648c
    Build type: Release
    LuaJIT 2.1.0-beta3
    Compiled by ...
    
    Features: +acl +iconv +tui
    See ":help feature-compile"
    
       system vimrc file: "$VIM/sysinit.vim"
      fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-2c7dc64/share/nvim"
    
    Run :checkhealth for more info
    

    Running with nvim -u none I get the following for each extension when calling set ft?:

    • ex => elixir
    • heex => heex
    • exs => elixir
    • eex => eelixir
    • leex => eelixir
    • sface => surface
    • lexs => (no ft)
    • mix.lock => elixir
  7. aptinio commented on Apr 9, 2022

    @aptinio
  8. nickjj commented on Apr 10, 2022

    @nickjj

    FWIW, it is broken for .ex and .exs files as well, on my end. For now, I just added the removed lines from that latest commit into my .vimrc and it's back to perfection.

    This happened to me too with Vim 8.1. I ended up reverting this plugin to an older version for now.

  9. superhawk610 commented on Apr 11, 2022

    @superhawk610
    Author

    Copying this here since it seemed relevant:

    HEEx and Surface are distinct tempting languages compared to LEEx and EEx (they use different compilers) and should be considered different file types so the corresponding tooling can handle their differences.

    The consequence of this patch is now downstream tooling that does not use the vim-elixir plugin is breaking (for example, nvim-treesitter which uses different tree-sitter parsers for eex, heex, and surface). If vim-elixir does not make a distinction between heex, surface, and eex, resulting in issues with highlighting, then I think that is a bug in that plugin, not Vim itself.

    A suggestion: consider .eex and .leex extensions as eelixir, but restore the new file types heex and surface that were recently added and fix how vim-elixir handles those file types.

    via @connorlay, from the PR linked above to vim link

  10. michalwski commented on Sep 6, 2022

    @michalwski

    Hello, what's the status of the issue? Will it be fixed here in vim-elixir like suggested by @connorlay ?

  11. juanpabloaj commented on Jul 14, 2023

    @juanpabloaj

    the @RTLS recomendation worked for me. Another option is to use nvim-treesitter/nvim-treesitter

    install that was not so obvious for me, so here my steps

    add the plugin to your ~/.config/nvim/init.vim

    Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
    

    and install it

    :PlugInstall
    

    enable the highlight in your ~/.config/nvim/lua/init.lua

    require'nvim-treesitter.configs'.setup{
      highlight={
        enable=true
      }
    }
    

    and finally install elixir

    :TSInstall elixir
    :TSInstall eex
    :TSInstall heex
    
  12. matt-savvy commented on Oct 4, 2024

    @matt-savvy

    For neovim users with lua configs, adding this to my init.lua resolved it for me.

    vim.filetype.add({
        extension = {
            heex = "eelixir",
            eex = "eelixir",
            leex = "eelixir",
            sface = "eelixir",
            lexs = "eelixir",
        }
    })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions