evanleck / vim-svelte

Vim syntax highlighting and indentation for Svelte 3 components.
BSD 3-Clause "New" or "Revised" License
319 stars 11 forks source link

Move template closes above opens #5

Closed davidroeca closed 5 years ago

davidroeca commented 5 years ago

This PR changes no code other than the ordering of things. It prioritizes first whether the current line is a closing template block line ({/each}, {/if}, etc.) prior to checking the previous line. This provides what I believe is the correct indentation of empty blocks. Take for example the following workflow:

I write out {#if statement} on one line, hit enter, and then type out the closing part of the block {/if}, assuming that the plugin will handle indentation. Below is the diff between the current version and the update:

{#if statement}
-  {/if}
+{/if}
evanleck commented 5 years ago

Seems reasonable enough to me, thanks!