elixir-tools / elixir-tools.nvim

Neovim plugin for Elixir
MIT License
403 stars 30 forks source link

Otter.nvim Integration for ~H Heex support? #101

Open zolrath opened 1 year ago

zolrath commented 1 year ago

Looking at otter.nvim (discussion here) it seems it scans for specific sections of your main languages buffer, in our case ~H"""<embedded language>"""", and allows you to use another language within it by synchronizing a hidden buffer.

It would be amazing to be able to comment out sections of the html in embedded heex like we can .heex files!

mhanberg commented 1 year ago

I think this might be already possible with a few lines of treesitter magic or with one of the more advanced comment plugins.

I'll look into it!

zolrath commented 1 year ago

Sounds good, that would be nice regardless!

Another benefit of using something like otter would be snippets that target .heex would be able to trigger inside the ~H""" """ section. I have a number of html specific snippets that work in .heex files.

pauloffborba commented 1 year ago

Maybe this could help. I saw this config in the Svelte repo to understand their ~V sigil:

LiveSvelte

Neovim Treesitter Config To enable syntax highlighting in Neovim with Treesitter, create the following file:

~/.config/nvim/after/queries/elixir/injections.scm

`; extends

; Svelte (sigil (sigil_name) @_sigil_name (quoted_content) @svelte (#eq? @_sigil_name "V"))`

mhanberg commented 1 year ago

That already exists for the H sigil. It allows the highlighting of the snippet.