nvim-ts-autotag icon indicating copy to clipboard operation
nvim-ts-autotag copied to clipboard

How to make this plugin work on html.heex templates from Phoenix

Open jpx40 opened this issue 1 year ago • 14 comments

Hey, i am using Elixir Phoenix for an Project but this Plugins seems to not really work with heex files.

jpx40 avatar Nov 11 '23 12:11 jpx40

commenting for visibility! Would also be nice for other embedded languages if erb files for ruby on rails!

sharkby7e avatar Nov 12 '23 14:11 sharkby7e

I figured it out, I have two separate config files, one to load the plugin and call setup which is lazy loaded nvim-ts-autotag.lua

return {
  "windwp/nvim-ts-autotag",
  config = function()
    require('nvim-ts-autotag').setup({})
  end,
  lazy = true
}

and then my nvim-treesitter.lua has

return {
  'nvim-treesitter/nvim-treesitter',
  lazy = false,
  priority = 999,
  build = ":TSUpdate",
  cmd = { "TSUpdateSync" },
  dependencies = {
    "windwp/nvim-ts-autotag",
    "tpope/vim-endwise",
    "HiPhish/nvim-ts-rainbow2",
    "nvim-treesitter/nvim-treesitter-textobjects",
  },
  config = function()
    require 'nvim-treesitter.configs'.setup {
      ensure_installed = { "elixir", "heex", "eex", "ruby" },
      autotag = {
        enable = true,
        filetypes = { "html", "xml", "eruby", "heex", "elixir", "embedded_template" },
      },
    }
  end
}(rest of config)

sharkby7e avatar Nov 14 '23 04:11 sharkby7e

@sharkby7e could you solve the Issue?

jpx40 avatar Nov 14 '23 15:11 jpx40

@sharkby7e so i could try to add the autotag to nvimtreesitter

jpx40 avatar Nov 14 '23 16:11 jpx40

@jpx40 yeah that's what fixed it for me!

sharkby7e avatar Nov 14 '23 17:11 sharkby7e

@sharkby7e Can you help me fix my config? It doesn't work yet. I changed to another file format in Golang templ.

jpx40 avatar Nov 14 '23 18:11 jpx40

@jpx40 sure, post ur config!

sharkby7e avatar Nov 14 '23 22:11 sharkby7e

@sharkby7e https://github.com/jpx40/dotfiles/tree/main/dot_config/nvim

jpx40 avatar Nov 15 '23 05:11 jpx40

It's based on LazyVim, so i kinda don't made the most my self.

jpx40 avatar Nov 15 '23 05:11 jpx40

@jpx40 I think ur missing the treesitter config. Check out my config here https://github.com/sharkby7e/nvim

sharkby7e avatar Nov 16 '23 01:11 sharkby7e

@jpx40 did the pr you pushed fix this?

sharkby7e avatar Nov 16 '23 02:11 sharkby7e

I don't know if the commit is right way since templ is an custom file. I figured out that autotag is pre-configured in Lazyvim. The easiest way would be an fork.

jpx40 avatar Nov 16 '23 04:11 jpx40

hey guys, not sure if this is the right issue for it, but I'm trying to make autotag work with ~H sigil inside ex files, but for some reason it does not. I'm using lunarvim and my current config for autotag looks like this:

  {
    "windwp/nvim-ts-autotag",
    config = function()
      require("nvim-ts-autotag").setup({
        enable = true,
        filetypes = { "html", "xml", "eruby", "heex", "elixir", "embedded_template" }
      })
    end,
    lazy = true,
  },

any help is greatly appreciated!

Vagab avatar Dec 26 '23 21:12 Vagab

@Vagab sry, i still have similar problems my knowledge about this plugin and neovim is not good enough to help you. If i figure something out i will help you.

jpx40 avatar Jan 03 '24 11:01 jpx40

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 03 '24 16:03 stale[bot]