-
Notifications
You must be signed in to change notification settings - Fork 10
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
script attributes like context="module" or lang="ts" break indent #19
Comments
Yeah... Adding this does the job: elseif a:str == "ts" || a:str = "typescript"
return "typescript" Can we somehow override functions from Interesting, after this addition, no matter what modifications I do to the |
I have the same issue. |
@cloudhead @non25 sorry for the tremendous delay... I've been trying to improve the HTML indent behavior and found that adding othree/html5.vim fixes some issues. Mind giving that a shot and letting me know how it works? I've updated the README to include html5.vim as a dependency of this plugin as well. |
@evanleck Giving a little update here. After adding <script context="module">
function add(a, b) {▌
}
</script> ...and I press <script context="module">
function add(a, b) {
▌
}
</script> The new line is indented to 2 spaces when it should be 4 inside the function body.
And here is my vim.fn["plug#begin"](vim.fn.stdpath("data") .. "/plugged")
vim.fn["plug#"]("othree/html5.vim") -- depended upon by evanleck/vim-svelte
vim.fn["plug#"]("pangloss/vim-javascript") -- depended upon by evanleck/vim-svelte
vim.fn["plug#"]("evanleck/vim-svelte") -- needed for good svelte file indentation
vim.fn["plug#end"]()
vim.o.number = true -- line numbers
vim.o.expandtab = true -- convert tabs to spaces
vim.o.softtabstop = 2 -- how many spaces to insert for each <tab>
vim.o.tabstop = 2 -- the width to display a <tab> character
vim.o.shiftwidth = 2 -- used by commands like =, >, and < to know how much to indent
vim.o.cindent = true |
Same issue here, but I still don't get any indentation even with Svelte file: <script lang="ts">
function test(): void {
alert('wrong indentation');
}
</script> It works without My require('lazy').setup({
-- other plugins
{
'evanleck/vim-svelte',
version = 'main',
ft = 'svelte',
dependencies = {
'pangloss/vim-javascript',
'othree/html5.vim'
}
}
})
vim.g.svelte_preprocessors = {'typescript'} |
To reprocude, simply add some attributes to the script tag:
Can't seem to figure out what causes this behavior. I've read indent script and haven't found anything that could mess with it.
Perhaps that's another
indent/html.vim
feature for me.The text was updated successfully, but these errors were encountered: