Skip to content

Cant get indentation to work #49

@Sitzdev

Description

@Sitzdev

Hi, I am currently trying to setup treesitter with Angular. But can`t get the indentation to work for the htmlangular filetype.

I am using nvim nightly as suggested
(Version: NVIM v0.11.0-dev-1418+g557f2d9700)

here is my treesitter config:

return {
	"nvim-treesitter/nvim-treesitter",
	event = { "BufReadPre", "BufNewFile" },
	build = ":TSUpdate",
	dependencies = {
		"windwp/nvim-ts-autotag",
	},
	config = function()
		-- import nvim-treesitter plugin
		local treesitter = require("nvim-treesitter.configs")

		-- configure treesitter
		treesitter.setup({ -- enable syntax highlighting
			highlight = {
				enable = true,
			},
			sync_install = false,
			-- enable indentation
			indent = { enable = true },
			-- ensure these language parsers are installed
			ensure_installed = {
				"angular",
				"json",
				"javascript",
				"typescript",
				"tsx",
				"yaml",
				"html",
				"css",
				"prisma",
				"markdown",
				"markdown_inline",
				"svelte",
				"graphql",
				"bash",
				"lua",
				"vim",
				"dockerfile",
				"gitignore",
				"query",
				"vimdoc",
				"c",
				"rust",
				"astro",
			},
			incremental_selection = {
				enable = true,
				keymaps = {
					init_selection = "<C-space>",
					node_incremental = "<C-space>",
					scope_incremental = false,
					node_decremental = "<bs>",
				},
			},
		})
	end,
	{
		"windwp/nvim-ts-autotag",
		event = "InsertEnter",
		config = function()
			require("nvim-ts-autotag").setup({
				aliases = {
					["htmlangular"] = "html",
				},
			})
		end,
	},
}

when I try to move to a new line in a htmlangular file the indentation won`t work as expected

e.g.

<div>
<!-- div inserted after line break -->
<div>
</div>
</div>

I am not quite sure if I have misconfigured something. Any help is highly appreciated.

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions