Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax highlighting broken for .*eex files #562

Open
superhawk610 opened this issue Mar 31, 2022 · 12 comments
Open

syntax highlighting broken for .*eex files #562

superhawk610 opened this issue Mar 31, 2022 · 12 comments

Comments

@superhawk610
Copy link

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
@dekkofilms
Copy link

dekkofilms commented Apr 2, 2022

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.

@superhawk610
Copy link
Author

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

@dekkofilms
Copy link

@superhawk610 my vim version is 8.2

@cvincent
Copy link

cvincent commented Apr 7, 2022

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.

@RTLS
Copy link

RTLS commented Apr 8, 2022

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

@jbodah
Copy link
Collaborator

jbodah commented Apr 8, 2022

$ 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

@aptinio
Copy link

aptinio commented Apr 9, 2022

I've sent the following PRs to vim and neovim:

@nickjj
Copy link

nickjj commented Apr 10, 2022

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.

@superhawk610
Copy link
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

@michalwski
Copy link

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

@juanpabloaj
Copy link

juanpabloaj commented Jul 14, 2023

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

juanpabloaj added a commit to juanpabloaj/dotfiles that referenced this issue Jul 14, 2023
it because vim-elixir doesnt' have support for heex,
read more about it here

elixir-editors/vim-elixir#562
@matt-savvy
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants