-
Notifications
You must be signed in to change notification settings - Fork 143
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
Wrong indent with interfaces #133
Comments
This is also occurring with enums: enum Foo {
Bar = 'one',
Bazinga = 'two'
} Indenting with vim turns enum into: enum Foo {
Bar = 'one',
Bazinga = 'two'
} I am not sure where to start, looking at the indent file 😨 |
Same issue, it's disturbing. |
I found the indent file from https://github.com/HerringtonDarkholme/yats.vim works well. |
Is this project just unmaintained? Maybe time to start a fork. |
Not unmaintained but low on my priorities right now - I'm happy to take in PRs but I don't have time to fix this indent issue. Note, the indent file is almost entirely a copy of the indent file in https://github.com/pangloss/vim-javascript. This issue might be fixed by updating to their latest version. |
There are three ways to terminate member declarations in Typescript interfaces and object type aliases: semicolons, commas, and newlines. interface foo {
a: number;
b: number;
}
interface foo {
a: number,
b: number,
}
interface foo {
a: number
b: number
} The latest version of this plugin correctly indents all but comma-terminated member declarations within interface declarations (not within object type aliases). Such style might be uncommon, but it is legal. I was using it, but I'm not sure where I picked up the habit; perhaps from switching a type alias to an interface declaration. I'm going to change my personal style, but if this plugin wants to be 100% complete, it will need to handle that case. |
since I don't see this getting fixed I have disabled indent from this plugin and used https://github.com/jason0x43/vim-js-indent which seems to actually work. |
Although I still have this plugin installed (I guess for syntax highlighting), I've switched to using Prettier to format my TypeScript. It's a huge relief. |
@thejohnfreeman The indent support for ts (from whichever plugin) is still useful while you are typing in code? |
@leafgarland Yes, the TypeScript indentation is still mildly useful. I believe it comes from this plugin (it is the only TypeScript-specific plugin I have, and I disabled vim-polyglot for TypeScript). However, JSX in TypeScript is not indented correctly, and so I rely on Prettier to fix it up for me. |
https://github.com/neoclide/coc-tsserver could provide on type format, which not only indent the lines, but also add/remove space according to your configuration when typing. |
Same. Forced to use Prettier to clear this up. |
Plugin corrects
to
The text was updated successfully, but these errors were encountered: